predictPLS: Prediction method for 'PLScalibration'.

Description Usage Arguments Value Author(s) Examples

View source: R/predictPLS.R

Description

This function accepts a PLS model of class PLScalibration and new data as a spectra.matrix. It uses the pls::predict.mvr method for predicting new data and also provides a mahalanobis distance (to the multivariate center of the calibration dataset) for each new sample. In order to do conduct the prediction, the new data are subsetted with subsetSpectra() and then preprocessed with preprocess(), according to the optimal transformation information stored in the PLS calibration object.

Usage

1
predictPLS(object, newdata, ...)

Arguments

object

An object of class PLScalibration containing the model.

newdata

New data (scans) in the same units and resolution as the spectra used to fit the PLS model. These spectra should be raw (without preprocessing) if the spectra used to fit the model were not manually manipulated before the use of optimizePLS() or calibrate(). predictPLS() will automaticall conduct the appropriate preprocessing and spectral subsetting if these steps were conducted within calibrate().

...

Additional args.

Value

Returns named a vector of predicted values with the following attributes:
"mahalanobis" - The mahalanobis distance of each new spectrum from the calibration mean.
"mahalanobis_threshold" - The maximum mahalanobis distance in the calibration dataset.
"outlier" - Logical. TRUE is "mahalanobis" is greater than "mahalanobis_threshold."

Author(s)

Daniel M Griffith

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
data(shootout)
data(N_cal_shootout)

shootout_scans <- convertSpectra(x = shootout_scans, method = "WL_to_WN")

N_predicted <- predict(object = N_cal_shootout, newdata = shootout_scans)
hist(N_predicted)

## End(Not run)

griffithdan/plantspec documentation built on May 17, 2019, 8:37 a.m.