[R] Signs of loadings from princomp on Windows

Francisco Chamu fchamu at gmail.com
Tue Sep 14 06:06:40 CEST 2004


I start a clean session of R 1.9.1 on Windows and I run the following code:

> library(MASS)
> data(painters)
> pca.painters <- princomp(painters[ ,1:4])
> loadings(pca.painters)

Loadings:
            Comp.1 Comp.2 Comp.3 Comp.4
Composition  0.484 -0.376  0.784 -0.101
Drawing      0.424  0.187 -0.280 -0.841
Colour      -0.381 -0.845 -0.211 -0.310
Expression   0.664 -0.330 -0.513  0.432

               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
> 

However, if I rerun the same analysis, the loadings of the first 
component have the opposite sign (see below), why is that?  I have
read the note
in the princomp help that says

    "The signs of the columns of the loadings and scores are arbitrary,
     and so may differ between different programs for PCA, and even
     between different builds of R."
     
However, I still would expect the same signs for two runs in the same session.

> pca.painters <- princomp(painters[ ,1:4])
> loadings(pca.painters)

Loadings:
            Comp.1 Comp.2 Comp.3 Comp.4
Composition -0.484 -0.376  0.784 -0.101
Drawing     -0.424  0.187 -0.280 -0.841
Colour       0.381 -0.845 -0.211 -0.310
Expression  -0.664 -0.330 -0.513  0.432

               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
> 
> R.version 
         _              
platform i386-pc-mingw32
arch     i386           
os       mingw32        
system   i386, mingw32  
status                  
major    1              
minor    9.1            
year     2004           
month    06             
day      21             
language R              
> 

BTW, I have tried the same in R 1.9.1 on Debian and I can't reproduce
what I see
on Windows.  In fact all the runs give the same as the second run on Windows.

-Francisco




More information about the R-help mailing list