[R] Same eigenvalues but different eigenvectors using 'prcomp' and 'principal' commands
John Fox
jfox at mcmaster.ca
Thu Mar 14 13:47:57 CET 2013
Dear Arlindo,
When, as here, the eigenvalues are distinct, corresponding eigenvectors are defined only up to multiplication by a nonzero constant. As you can verify, the first set of eigevectors is normalized to length 1 while the second set is normalized to have length equal to the corresponding eigenvalues.
I hope this helps,
John
------------------------------------------------
John Fox
Sen. William McMaster Prof. of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/
On Thu, 14 Mar 2013 01:01:56 -0700 (PDT)
Arlindo Meque <mequitomz at yahoo.com.br> wrote:
>
>
> Dear all,
>
> I've used the 'prcomp' command to
> calculate the eigenvalues and eigenvectors of a matrix(gg).
>
> Using the command 'principal' from the
> 'psych' package I've performed the same exercise. I got the same
> eigenvalues but different eigenvectors. Is there any reason for that
> difference?
>
> Below are the steps I've followed:
>
> 1. PRCOMP
>
> #defining the matrix
> gg=matrix(byrow = TRUE, nrow = 3,data =
> c(1, 0, 1, 1, 4, 2))
>
> > gg
> [,1] [,2]
> [1,] 1 0
> [2,] 1 1
> [3,] 4 2
>
> pc=prcomp(gg,center=TRUE,scale=TRUE)
>
>
> # The eigenvectors
> pc$rotation
> PC1 PC2
> [1,] 0.7071068 0.7071068
> [2,] 0.7071068 -0.7071068
>
>
> # The eigenvalues:
>
> > pc$sdev^2
> [1] 1.8660254 0.1339746
>
>
> 2. PSYCH Package:
>
> > pp=principal(gg,nfactors=2)
>
> # The eigenvectors
>
>
> > pp$loadings
> Loadings:
> PC1 PC2
> [1,] 0.966 -0.259
> [2,] 0.966 0.259
>
> # The eigenvalues
>
> pp$values
>
>
>
> 1] 1.8660254 0.1339746
>
>
>
> Sincerely,
>
> Arlindo
> [[alternative HTML version deleted]]
>
More information about the R-help
mailing list