popSpectra2D {ChemoSpec2D}R Documentation

Plain Old PCA (POP) of Spectra2D Objects


This function unstacks a Spectra2D object and conducts IRLBA PCA on it. To unstack, each F1 slice (parallel to F2) is concatenated one after the other so that each 2D spectrum becomes a 1D spectrum. The length of this spectrum will be equal to the length of the F2 dimension times the length of the F1 dimension. PCA is performed on the collection of 1D spectra (one spectrum from each 2D spectrum). The IRLBA algorithm is used because the resulting matrix (n samples in rows x F1 * F2 columns) can be very large, and other PCA algorithms can struggle.


popSpectra2D(spectra, n = 3, choice = "noscale", ...)



An object of S3 class Spectra2D.


Integer. The number of components desired.


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


Other parameters to be passed to prcomp_irlba.


The scale choice autoscale scales the columns by their standard deviation. Pareto scales by the square root of the standard deviation. "autoscale" is called "standard normal variate" or "correlation matrix PCA" in some literature. This action is performed on the unstacked matrix, as is centering.


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


Bryan A. Hanson, DePauw University.


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

See Also

For other data reduction methods for Spectra2D objects, see miaSpectra2D and pfacSpectra2D.


res <- popSpectra2D(MUD1)
plotScores(MUD1, res, main = "POP Scores", ellipse = "cls")
MUD1a <- plotLoadings2D(MUD1, res,
  load_lvls = c(-0.2, -0.1, 0.1, 0.2),
  load_cols = rep("black", 4), main = "POP Comp. 1 Loadings"

[Package ChemoSpec2D version 0.4.187 Index]