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

irlba_pcaSpectra

IRLBA PCA of Spectra Objects


Description

A wrapper which carries out IRLBA PCA analysis on a Spectra object. The user can select various options for scaling. There is no normalization by rows - do this manually using normSpectra. The data can be supplied already centered if desired.

Usage

irlba_pcaSpectra(spectra, choice = "noscale", n = 3, center = TRUE, ...)

Arguments

spectra

An object of S3 class Spectra.

choice

A character string indicating the choice of scaling. One of c("noscale", "autoscale", "Pareto"). "autoscale" is called "standard normal variate" or "correlation matrix PCA" in some literature.

n

Integer. The number of components desired.

center

Logical. Should the data be centered? Data must be centered for PCA, either before arriving here or via this argument.

...

Other parameters to be passed to irlba.

Details

The scale choice autoscale scales the columns by their standard deviation. Pareto scales by the square root of the standard deviation.

Value

A modified object of class prcomp and computed_via_irlba, which includes a list element called $method, a character string describing the pre-processing carried out and the type of PCA performed (used to annotate plots).

Author(s)

Bryan A. Hanson, DePauw University.

References

J. Baglama and L. Reichel, "Augmented Implicitly Restarted Lanczos Bidiagonalization Methods" SIAM J. Sci. Comput. (2005).

See Also

prcomp_irlba for the underlying function, c_pcaSpectra for classical PCA calculations, r_pcaSpectra for robust PCA calculations, s_pcaSpectra for sparse PCA calculations. Additional documentation at https://bryanhanson.github.io/ChemoSpec/

Examples

data(SrE.NMR)
pca <- irlba_pcaSpectra(SrE.NMR)
plotScree(pca)
plotScores(SrE.NMR, pca,
  main = "SrE NMR Data",
  pcs = c(1, 2), ellipse = "cls", tol = 0.05
)
plotLoadings(SrE.NMR, pca,
  main = "SrE NMR Data",
  loads = 1:2, ref = 1
)

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.