| predict.specproc_rsimpls | R Documentation |
Predicts the responses of new observations with a model fitted by
rsimpls(), or computes their scores.
## S3 method for class 'specproc_rsimpls'
predict(object, newdata, type = c("response", "scores"), ncomp = NULL, ...)
object |
An object returned by |
newdata |
A numeric matrix or data frame with the same variables as the calibration data. |
type |
|
ncomp |
With |
... |
Not used. |
With type = "response", a numeric vector of predictions (one
response) or a matrix with one column per response. With
type = "scores", a tibble with the scores (Comp1, ...), the score
distance sd and the orthogonal distance od of each observation.
Christian L. Goueguel
rsimpls()
data(forageLIBS)
wl <- suppressWarnings(as.numeric(names(forageLIBS)))
spectra <- forageLIBS[which(wl > 380 & wl < 430)]
set.seed(1)
fit <- rsimpls(spectra[1:300, ], forageLIBS$Ca[1:300], ncomp = 4)
head(predict(fit, spectra[301:368, ]))
head(predict(fit, spectra[301:368, ], ncomp = 2))
head(predict(fit, spectra[301:368, ], type = "scores"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.