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??
-Peter Ehlers
>
>> 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 at 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.
>
>