fast Principal Component Analysis (PCA)
prcompfast(x, retx = TRUE, center = TRUE, scale. = FALSE, tol = NULL, ...)
prcomp
returns a list with class prcomp
containing the followin components:
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).
the matrix of variable loadings (i.e., a matrix whose columns
contain the eigenvectors). The function princomp
returns
this in the element loadings
.
if retx
is true the value of the rotated data (the centred
(and scaled if requested) data multiplied by the rotation
matrix) is returned. Hence, cov(x)
is the diagonal matrix
diag(sdev^2)
. For the formula method, napredict()
is
applied to handle the treatment of values omitted by the
na.action
.
the centering and scaling used, or FALSE
. 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))
a numeric or complex matrix (or data frame) which provides the data for the principal components analysis.
a logical value indicating whether the rotated variables should be returned
a logical value indicating whether the variables should be shifted to be zero centered. Alternately, a vector of length
a logical value indicating whether the variables should be scaled to have unit variance before the analysis takes place. The default is FALSE
for consistency with S, but in general scaling is advisable. Alternatively, a vector of length equal the number of columns of x
can be supplied. The value is passed to scale
. equal the number of columns of x
can be supplied. The value is passed to scale
.
a value indicating the magnitude below which components should be omitted. (Components are omitted if their standard deviations are less than or equal to tol
times the standard deviation of the first component.) With the default null setting, no components are omitted. Other settings for tol could be tol = 0
or tol = sqrt(.Machine$double.eps)
, which would omit essentially constant components.
arguments passed to or from other methods.