[R] Signs of loadings from princomp on Windows
Francisco Chamu
fchamu at gmail.com
Thu Sep 16 01:07:01 CEST 2004
I am sorry to insist, but we have three other people that were able to
reproduce the behavior I mentioned. I have also installed R 1.9.1
from the CRAN binaries on a different Windows machine and again I see
the differents signs as mentioned before. What would be causing the
difference?
-Francisco
On Tue, 14 Sep 2004 11:04:29 -0600, Tony Plate
<tplate at blackmesacapital.com> wrote:
> FWIW, I see the same behavior as Francisco on my Windows machine (also an
> installation of the windows binary without trying to install any special
> BLAS libraries):
>
> > 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
> > 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
> >
>
> My machine is a dual-processor hp xw8000.
>
> I also get the same results with R 2.0.0 dev as in
> > R.version
> _
> platform i386-pc-mingw32
> arch i386
> os mingw32
> system i386, mingw32
> status Under development (unstable)
> major 2
> minor 0.0
> year 2004
> month 09
> day 13
> language R
> >
>
> -- Tony Plate
>
>
>
> At Tuesday 10:25 AM 9/14/2004, Prof Brian Ripley wrote:
> >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
> >
> >______________________________________________
>
>
> >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
>
>
More information about the R-help
mailing list