P_cal_23SEP2015: P_cal_23SEP2015: NIR calibration for Phosphorus

Description Usage Format Examples

Description

NIR calibration for Phosphorus using version 1 of leaf.spec.data, excluding litter and bryophytes.

Usage

1

Format

An object of class PLScalibration.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#  library(leaf.spec)
#  library(leaf.spec.DB)

#######################################################################################################################
#######################################################################################################################
# P: Code to create this calibration
#######################################################################################################################
#######################################################################################################################
  ## LOAD DATA FROM leaf.spec.DB
  # data(leaf.spec.spectra)
  # data(leaf.spec.data)
  # leaf.spec.data <- leaf.spec.data[!(leaf.spec.data$SCAN_FILE=="SCAN_00225.dpt"),] # remove an outlier
  # leaf.spec.data <- leaf.spec.data[leaf.spec.data$VERSION==1,] # use dataset version 1
  # leaf.spec.data <- leaf.spec.data[!is.na(leaf.spec.data$P),] # remove data where response is NA
  ## remove litter and bryophytes  
  # leaf.spec.data <- leaf.spec.data[!(leaf.spec.data$FUNCTIONAL_TYPE=="bryophyte"|leaf.spec.data$FUNCTIONAL_TYPE=="litter"),]
  # NUTNET_SCANS <- leaf.spec.spectra[leaf.spec.data$SCAN_FILE,] # choose scans based on remaining data
  # plot(NUTNET_SCANS) # inspect scans
  # component_P <- leaf.spec.data$P # for clarity, put the response in a new vector
  ## select a 10 % validation set with SPXY, but use ! to return TRUE for the training set 
  # training_set_SPXY <- !(subdivideDataset(spectra = NUTNET_SCANS, component = component_P, method = "SPXY", p=0.1, type = "validation"))
  # P_opt <- optimizePLS(component=component_P, spectra=NUTNET_SCANS, training_set = training_set_SPXY)
  # P_cal <- calibrate(component=component_P, spectra=NUTNET_SCANS, optimal_params=P_opt, optimal_model=1, validation = "testset", training_set = training_set_SPXY)

## LOAD CALIBRATION
# data(P_cal_23SEP2015)

griffithdan/plantspecDB documentation built on May 29, 2019, 11:05 p.m.