[R] prcomp function

2010-11-10 Thread kicker
Hello, I have a short question about the prcomp function. First I cite the associated help page (help(prcomp)): "Value: ... 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

Re: [R] prcomp function

2010-11-10 Thread Claudia Beleites
I think PCA decomposes matrix A according to A'A, not to COV (A). But if A is centered then A'A = (n + 1) COV (A). So for non-centered A, you want to look at A'A instead: > crossprod(A) %*% evec[,1] / (nrow (A) - 1) - eval [1] * evec [,1] [,1] [1,] 0.000e+00 [2,] 0.000e+00 [3,] 1.066e

Re: [R] prcomp function

2010-11-11 Thread kicker
Dear Claudia, you are right. Thank you very much for your explanations. So in the non-centered case SDEV does not contain the "square roots of the eigenvalues of the covariance/correlation matrix". In in the centered case it holds A´A=(n-1)*cov(A) (not n+1). Have a nice day. -- View this messa