pca {KODAMA} | R Documentation |
Principal Components Analysis
Description
Performs a principal components analysis on the given data matrix and returns the results as an object of class "prcomp
".
Usage
pca(x, ...)
Arguments
x |
a matrix of data. |
... |
arguments passed to |
Value
The function returns a list with class prcomp
containing the following 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 |
txt |
the component of variance of each Principal Component. |
Author(s)
Stefano Cacciatore
References
Pearson, K
On Lines and Planes of Closest Fit to Systems of Points in Space.
Philosophical Magazine 1901;2 (11): 559-572. doi:10.1080/14786440109462720. Link
See Also
Examples
data(MetRef)
u=MetRef$data;
u=u[,-which(colSums(u)==0)]
u=normalization(u)$newXtrain
u=scaling(u)$newXtrain
class=as.numeric(as.factor(MetRef$gender))
cc=pca(u)
plot(cc$x,pch=21,bg=class)