[R] PCA functions

S Ellison S.Ellison at lgc.co.uk
Mon Feb 16 11:45:29 CET 2009

princomp uses the raw data and calculates the correlation or covariance matrix on the way to the PC's, so that doesn't use a correlation matrix itself. You do, however, get the choice.

However, PC's are the eigenvectors of the correlation (or covariance) matrix, so in principle calling eigen() on either would be sufficient for the PC's. The signs may differ, though, as they are arbitrary; compare prcomp(USArrests)$rotation with eigen(cov(USArrests)).


>>> Bjørn-Helge Mevik <b.h.mevik at usit.uio.no> 16/02/2009 09:05 >>>
"glenn" <g1enn.roberts at btinternet.com> writes:

> Is there a function (before I try and write it !) that allows the input of a
> covariance or correlation matrix to calculate PCA, rather than the actual
> data as in princomp()

Yes, there is: princomp(). :-)

Bjørn-Helge Mevik

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html 
and provide commented, minimal, self-contained, reproducible code.

This email and any attachments are confidential. Any use...{{dropped:8}}

More information about the R-help mailing list