Re: [R] PCA functions

2009-02-16 Thread S Ellison
Many apologies for the poor steer; you are quite right. 'fraid I hit 'send' before double-checking the help page myself. Next time... S >>> Gavin Simpson 16/02/2009 10:59 >>> On Mon, 2009-02-16 at 10:45 +, S Ellison wrote: > princomp uses the raw data and calculates the correlation or > co

Re: [R] PCA functions

2009-02-16 Thread Gavin Simpson
On Mon, 2009-02-16 at 10:45 +, S Ellison wrote: > 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. That *isn't* what princomp() does. If you supply a vali

Re: [R] PCA functions

2009-02-16 Thread andrew
sqrt(svd(x)$d) maybe 2 more operations than princomp(covmat=x), but it is hardly a chore. On Feb 16, 9:15 pm, Mark Difford wrote: > Hi Glen, Andrew, > > >> The PCA is just a singular value decomposition on a sample covariance/... > > I believe that Bjørn-Helge Mevik's point was that __if you read

Re: [R] PCA functions

2009-02-16 Thread S Ellison
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()

Re: [R] PCA functions

2009-02-16 Thread Mark Difford
Hi Glen, Andrew, >> The PCA is just a singular value decomposition on a sample covariance/... I believe that Bjørn-Helge Mevik's point was that __if you read the documentation__ you will see the argument "covmat" to princomp(). This, really, is much more straightforward and practical than Andrew

Re: [R] PCA functions

2009-02-16 Thread andrew
The PCA is just a singular value decomposition on a sample covariance/ correlation matrix. Do a search for ?svd and get the eigenvalues and vectors from that function. On Feb 14, 10:30 am, "glenn" wrote: > Hi All, would appreciate an answer on this if you have a moment; > > Is there a function (

Re: [R] PCA functions

2009-02-16 Thread Bjørn-Helge Mevik
"glenn" 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 _