[R] What an element in loading is missing? (princomp)

Peng Yu pengyu.ut at gmail.com
Mon Oct 19 05:52:20 CEST 2009


Please see below that [3,1] of loadings is not printed. I am wondering
what the problem is?

> 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
>




More information about the R-help mailing list