pca | R Documentation |
Performs a principal components analysis on the given data matrix and returns the results as an object of class "prcomp
".
pca(x, ...)
x |
a matrix of data. |
... |
arguments passed to |
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. |
Stefano Cacciatore
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
prcomp
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.