[R] Signs of loadings from princomp on Windows

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Sep 14 18:25:18 CEST 2004


On Tue, 14 Sep 2004, Francisco Chamu wrote:

> I have run this on both Windows 2000 and XP.  All I did was install
> the binaries from CRAN so I think I am using the standard Rblas.dll.
> 
> To reproduce what I see you must run the code at the beginning of the
> R session.  

We did, as you said `start a clean session'.

I think to reproduce what you see we have to be using your account on your 
computer.

> After the second run, all subsequent runs give the same
> result as the second set.
> 
> Thanks,
> Francisco
> 
> 
> On Tue, 14 Sep 2004 08:29:25 +0200, Uwe Ligges
> <ligges at statistik.uni-dortmund.de> wrote:
> > Prof Brian Ripley wrote:
> > > I get the second set each time, on Windows, using the build from CRAN.
> > > Which BLAS are you using?
> > 
> > 
> > Works also well for me with a self compiled R-1.9.1 (both with standard
> > Rblas as well as with the Rblas.dll for Athlon CPU from CRAN).
> > Is this a NT-based version of Windows (NT, 2k, XP)?
> > 
> > Uwe
> > 
> > 
> > 
> > 
> > > On Tue, 14 Sep 2004, Francisco Chamu wrote:
> > >
> > >
> > >>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
> > >>
> > >>______________________________________________
> > >>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
> > >>
> > >>
> > >
> > >
> > 
> >
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list