On Mon, Oct 19, 2009 at 1:58 AM, Peter Ehlers <ehl...@ucalgary.ca> wrote: > > Peng Yu wrote: >> >> Please see below that [3,1] of loadings is not printed. I am wondering >> what the problem is? > > Not trying ?loadings, perhaps??
'loadings' gives me the same thing. > pca_result$loadings Loadings: Comp.1 Comp.2 Comp.3 Comp.4 [1,] 0.556 0.378 -0.467 -0.574 [2,] -0.511 0.266 -0.761 0.299 [3,] -0.887 -0.425 -0.169 [4,] -0.651 0.152 -0.744 Comp.1 Comp.2 Comp.3 Comp.4 SS loadings 1.00 1.00 1.00 1.00 Proportion Var 0.25 0.25 0.25 0.25 Cumulative Var 0.25 0.50 0.75 1.00 > loadings(pca_result) Loadings: Comp.1 Comp.2 Comp.3 Comp.4 [1,] 0.556 0.378 -0.467 -0.574 [2,] -0.511 0.266 -0.761 0.299 [3,] -0.887 -0.425 -0.169 [4,] -0.651 0.152 -0.744 >>> set.seed(0) >>> m=10 >>> n=4 >>> X=replicate(n,rnorm(m)) >>> pca_result=princomp(X) >>> svd_result=svd(apply(X,2,function(x){x-mean(x)})) >>> pca_result$loadings >> >> Loadings: >> Comp.1 Comp.2 Comp.3 Comp.4 >> [1,] 0.867 0.306 -0.281 -0.275 >> [2,] -0.215 0.532 -0.614 0.541 >> [3,] -0.682 -0.713 -0.155 >> [4,] -0.448 0.397 -0.186 -0.780 >> >> Comp.1 Comp.2 Comp.3 Comp.4 >> SS loadings 1.00 1.00 1.00 1.00 >> Proportion Var 0.25 0.25 0.25 0.25 >> Cumulative Var 0.25 0.50 0.75 1.00 >>> >>> svd_result$v >> >> [,1] [,2] [,3] [,4] >> [1,] -0.86704537 -0.3060826 0.2810007 -0.2749261 >> [2,] 0.21540928 -0.5321956 0.6144209 0.5411595 >> [3,] 0.03936291 0.6823365 0.7134127 -0.1546279 >> [4,] 0.44752846 -0.3968605 0.1859243 -0.7795205 >> >> ______________________________________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >> > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.