View source: R/irlba_pcaSpectra.R
| irlba_pcaSpectra | R Documentation |
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.
irlba_pcaSpectra(spectra, choice = "noscale", n = 3, center = TRUE, ...)
spectra |
An object of S3 class |
choice |
A character string indicating the choice of scaling. One of
|
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 |
The scale choice autoscale scales the columns by their standard
deviation. Pareto scales by the square root of the standard
deviation.
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).
Bryan A. Hanson (DePauw University).
J. Baglama and L. Reichel, "Augmented Implicitly Restarted Lanczos Bidiagonalization Methods" SIAM J. Sci. Comput. (2005).
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/
For displaying the results, ChemoSpecUtils::plotScree(), ChemoSpecUtils::plotScores(), plotLoadings(), plot2Loadings(), sPlotSpectra().
## Not run:
# This example assumes the graphics output is set to ggplot2 (see ?GraphicsOptions).
library("ggplot2")
data(SrE.NMR)
pca <- irlba_pcaSpectra(SrE.NMR)
p1 <- plotScree(pca)
p1
p2 <- plotScores(SrE.NMR, pca, pcs = c(1, 2), ellipse = "cls", tol = 0.05)
p2 <- p2 + ggtitle("Scores: SrE NMR Data")
p2
p3 <- plotLoadings(SrE.NMR, pca, loads = 1:2, ref = 1)
p3 <- p3 + ggtitle("Loadings: SrE NMR Data")
p3
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.