Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cv_pcaSpectra

Cross-Validation of Classical PCA Results for a Spectra Object


Description

This 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.

Usage

cv_pcaSpectra(
  spectra,
  pcs,
  choice = "noscale",
  repl = 50,
  segments = 4,
  segment.type = c("random", "consecutive", "interleaved"),
  length.seg,
  trace = FALSE,
  ...
)

Arguments

spectra

An object of S3 class Spectra.

pcs

As per pcaCV where it is called amax; an integer giving the number of PC scores to include.

choice

A character string indicating the choice of scaling. One of c("noscale", "autoscale", "Pareto").

repl

As per pcaCV; the number of replicates to perform.

segments

As per pcaCV.

segment.type

As per pcaCV.

length.seg

As per pcaCV.

trace

As per pcaCV.

...

Parameters to be passed to the plotting routines.

Value

Invisibly, a list as described in pcaCV. Side effect is a plot.

Author(s)

Bryan A. Hanson, DePauw University. Derived from pcaCV.

References

K. Varmuza and P. Filzmoser Introduction to Multivariate Statistical Analysis in Chemometrics, CRC Press, 2009.

See Also

pcaCV for the underlying function. Additional documentation at https://bryanhanson.github.io/ChemoSpec/

Examples

data(SrE.IR)
pca <- cv_pcaSpectra(SrE.IR, pcs = 5)

ChemoSpec

Exploratory Chemometrics for Spectroscopy

v5.3.11
GPL-3
Authors
Bryan A. Hanson [aut, cre] (<https://orcid.org/0000-0003-3536-8246>), Mike Bostock [cph, ctb] (author of the d3.js library used by plotSpectraJS, http://d3js.org), Matt Keinsley [ctb] (author of initial AOV-PCA code)
Initial release
2021-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.