My understanding is that prcomp
and princomp
work off the dataset itself (row of observations, across variables in the columns). Is there a function that will run a principal component analysis directly off a correlation or covariance matrix, without having the "raw" dataset?
Solved – Principal components using correlation matrix in R
pcar
Best Answer
You can use
eigen()
. For example:So the eigenvalues of the covariance matrix are the squares of the standard deviations (i.e, variances) of the principal components and the principal components themselves are same as eigenvectors of covariance matrix (though signs may be opposite as they are here).