Description Usage Format Examples
NIR calibration for Potassium using version 1 of leaf.spec.data, excluding litter and bryophytes.
1 |
An object of class PLScalibration
.
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)
#######################################################################################################################
#######################################################################################################################
# K: 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$K),] # 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_K <- leaf.spec.data$K # for clarity, put the response in a new vector
## select a 10 % validation set with KS, but use ! to return TRUE for the training set
# training_set_KS <- !(subdivideDataset(spectra = NUTNET_SCANS, method = "KS", p=0.1, type = "validation"))
# K_opt <- optimizePLS(component=component_K, spectra=NUTNET_SCANS, training_set = training_set_KS)
# K_cal <- calibrate(component=component_K, spectra=NUTNET_SCANS, optimal_params=K_opt, optimal_model=1, validation = "testset", training_set = training_set_KS)
## LOAD CALIBRATION
# data(K_cal_23SEP2015)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.