R/cv_pcaSpectra.R
cv_pcaSpectra.RdThis function carries out classical PCA on the data in a
Spectra object using a cross-validation method. A simple
re-write of Peter Filzmoser's pcaCV method
with some small plotting changes.
cv_pcaSpectra(
spectra,
pcs,
choice = "noscale",
repl = 50,
segments = 4,
segment.type = c("random", "consecutive", "interleaved"),
length.seg,
trace = FALSE,
...
)An object of S3 class Spectra().
As per pcaCV where it is called amax;
an integer giving the number of PC scores to include.
A character string indicating the choice of scaling. One of
c("noscale", "autoscale", "Pareto").
As per pcaCV; the number of
replicates to perform.
As per pcaCV.
As per pcaCV.
As per pcaCV.
As per pcaCV.
Parameters to be passed to the plotting routines.
Invisibly, a list as described in pcaCV.
Side effect is a plot.
K. Varmuza and P. Filzmoser Introduction to Multivariate Statistical Analysis in Chemometrics, CRC Press, 2009.
pcaCV for the underlying function.
Additional documentation at https://bryanhanson.github.io/ChemoSpec/
# You need to install package "pls" for this example
if (requireNamespace("pls", quietly = TRUE)) {
data(SrE.IR)
pca <- cv_pcaSpectra(SrE.IR, pcs = 5)
}