N_cal_23SEP2015: N_cal_23SEP2015: NIR calibration for Nitrogen

Description Usage Format Examples

Description

NIR calibration for Nitrogen 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
27
#  library(leaf.spec)
#  library(leaf.spec.DB)

#######################################################################################################################
#######################################################################################################################
# N: 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$N),] # 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_N <- leaf.spec.data$N # for clarity, put the response in a new vector
  ## select a 10 % validation set with MDKS, but use ! to return TRUE for the training set 
  # training_set_MDKS <- !(subdivideDataset(spectra = NUTNET_SCANS, component = component_N, method = "MDKS", p=0.1, type = "validation"))
  # N_opt <- optimizePLS(component=component_N, spectra=NUTNET_SCANS, training_set = training_set_MDKS)
  # N_cal <- calibrate(component=component_N, spectra=NUTNET_SCANS, optimal_params=N_opt, optimal_model=1, validation = "testset", training_set = training_set_MDKS)


## LOAD CALIBRATION
# data(N_cal_23SEP2015)

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