[ top | up ]
Principal Components Analysis
Usage
prcomp(x=, scale=FALSE, use="all.obs")
print.prcomp(prcomp.obj)
plot.prcomp(prcomp.obj)
Arguments
x
|
a matrix (or data frame) which provides the data
for the principal components analysis.
|
scale
|
a logical value indicating whether the variables should
be scaled to have unit variance before the analysis takes place.
|
use
|
the strategy to use for dealing with missing observations.
The possible values are "all.obs" , "complete.obs" ,
or "pairwise.complete.obs" .
An unambiguous substring can be used.
|
Description
This function performs a principal components analysis on
the given data matrix and returns the results as a
prcomp
object. The print method for the these
objects prints the results in a nice format and the
plot method produces a scree plot.
Value
prcomp
returns an list with class "prcomp"
containing the following components:
var
|
the variances of the principal components
(i.e. the eigenvalues)
|
load
|
the matrix of variable loadings (i.e. a matrix
whose columns contain the eigenvectors).
|
scale
|
the value of the scale argument.
|
References
Mardia, K. V., J. T. Kent and J. M. Bibby (1979).
Multivariate Analysis, London: Academic Press.
See Also
cor
, cov
, eigen
.
Examples
# the variances of the variables in the
# crimes data vary by orders of magnitude
data(crimes)
prcomp(crimes)
prcomp(crimes,scale=TRUE)