| predict.specproc_macropca | R Documentation |
Projects new observations onto a robust PCA model fitted by robpca(),
rospca() or macropca(), and computes their score and orthogonal
distances with the cut-offs of the calibration data.
## S3 method for class 'specproc_macropca'
predict(object, newdata, ...)
## S3 method for class 'specproc_cellpca'
predict(object, newdata, ...)
## S3 method for class 'specproc_robpca'
predict(object, newdata, ...)
object |
An object returned by |
newdata |
A numeric matrix or data frame with the same variables as
the calibration data. For |
... |
Not used. |
A tibble with the scores (PC1, ..., PCk), the score distance
sd, the orthogonal distance od and the outlier_type of each new
observation.
plot_outlier_map(), which can display new observations.
data(forageLIBS)
wl <- suppressWarnings(as.numeric(names(forageLIBS)))
spectra <- forageLIBS[which(wl > 760 & wl < 780)] # the K I resonance lines
set.seed(1)
fit <- robpca(spectra[1:300, ])
head(predict(fit, spectra[301:368, ]))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.