I am doing a Principal Component Analaysis (PCA) on a 44x19 matrix. with > princomp(x,cor=TRUE,scores=TRUE) and > prcomp(x,scale=TRUE,center=TRUE) The resulted eigenv. and rotated matrix are the same (as expected), however the sum of eigenvalues is lower than 19 (number of variables). With a commercial stat software it worked correctly, with the same dataset. Am I doing something wrong? Thanks Alex -- No virus found in this outgoing message. Checked by AVG Anti-Virus. -- No virus found in this outgoing message. Checked by AVG Anti-Virus.
On Fri, 2005-04-08 at 11:12 +0200, Alessandro Bigi wrote:> I am doing a Principal Component Analaysis (PCA) on a 44x19 matrix. > with > > princomp(x,cor=TRUE,scores=TRUE) > and > > prcomp(x,scale=TRUE,center=TRUE) > The resulted eigenv. and rotated matrix are the same (as expected), however > the sum of eigenvalues is lower than 19 (number of variables).What about the sum of squared sdev? (Hint, the "prcomp" help page says that the returned sdev are the square root of the eigenvalues. While "princomp" help does not say this explicitly, it says that "sdev" are standard deviations). cheers, jari oksanen -- Jari Oksanen -- Dept Biology, Univ Oulu, 90014 Oulu, Finland Ph. +358 8 5531526, cell +358 40 5136529, fax +358 8 5531061 email jari.oksanen at oulu.fi, homepage http://cc.oulu.fi/~jarioksa/
R2.0.1> x<-matrix(rnorm(44*19),nrow=44) > princomp(x,cor=TRUE,scores=TRUE)Call: princomp(x = x, cor = TRUE, scores = TRUE) Standard deviations: Comp.1 Comp.2 Comp.3 Comp.4 Comp.5 Comp.6 Comp.7 Comp.8 1.5874672 1.4652217 1.3088833 1.2339949 1.1697727 1.1402570 1.0774402 1.0458567 Comp.9 Comp.10 Comp.11 Comp.12 Comp.13 Comp.14 Comp.15 Comp.16 1.0152164 0.9403912 0.8854087 0.8433314 0.7918201 0.7454395 0.6680463 0.6240805 Comp.17 Comp.18 Comp.19 0.5752994 0.4873633 0.4205193 19 variables and 44 observations.> sum(princomp(x,cor=TRUE,scores=TRUE)$sdev^2)[1] 19 it seems ok. On Fri, 08 Apr 2005 11:12:26 +0200 Alessandro Bigi <abigi at agrsci.unibo.it> wrote:> I am doing a Principal Component Analaysis (PCA) on a 44x19 matrix. > with > > princomp(x,cor=TRUE,scores=TRUE) > and > > prcomp(x,scale=TRUE,center=TRUE) > The resulted eigenv. and rotated matrix are the same (as expected), however > the sum of eigenvalues is lower than 19 (number of variables). > > With a commercial stat software it worked correctly, with the same dataset. > Am I doing something wrong? > Thanks > Alex > > > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > > > > > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html