prcompfast | R Documentation |
fast Principal Component Analysis (PCA)
prcompfast(x, retx = TRUE, center = TRUE, scale. = FALSE, tol = NULL, ...)
x |
a numeric or complex matrix (or data frame) which provides the data for the principal components analysis. |
retx |
a logical value indicating whether the rotated variables should be returned |
center |
a logical value indicating whether the variables should be shifted to be zero centered. Alternately, a vector of length |
scale. |
a logical value indicating whether the variables should be scaled to have unit variance before the analysis takes place. The default is |
tol |
a value indicating the magnitude below which components should be omitted. (Components are omitted if their standard deviations are less than or equal to |
... |
arguments passed to or from other methods. |
prcomp
returns a list with class prcomp
containing the followin components:
sdev |
the standard deviations of the principal components (i.e., the square roots of the eigenvalues of the covariance/correlation matrix, though the calculation is actually done with the singular values of the data matrix). |
rotation: |
the matrix of variable loadings (i.e., a matrix whose columns
contain the eigenvectors). The function |
x: |
if |
center , scale: |
the centering and scaling used, or |
. pcafast <- prcompfast(iris[,1:4]) pcadefault <- prcompfast(iris[,1:4]) ## check if both results are idential (ignoring the sign) all.equal(lapply(pcafast,abs),lapply(pcadefault,abs))
this function returns the same results as prcomp
(apart from sign differences) but uses smarter matrix decompositions making it faster for nrow(x) >> ncol(x) and nrow(x) << ncol(x).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.