| predict.specproc_rpcr | R Documentation |
Predicts the responses of new observations with a model fitted by
rpcr(), or computes their scores.
## S3 method for class 'specproc_rpcr'
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
rpcr()
data(forageLIBS)
wl <- suppressWarnings(as.numeric(names(forageLIBS)))
spectra <- forageLIBS[which(wl > 380 & wl < 430)]
set.seed(1)
fit <- rpcr(spectra[1:300, ], forageLIBS$Ca[1:300], ncomp = 5)
head(predict(fit, spectra[301:368, ]))
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.