[R] Different PCA results under Windows and Linux
Peter Dalgaard
P.Dalgaard at biostat.ku.dk
Wed Sep 17 11:12:22 CEST 2008
Steven McKinney wrote:
> Not likely that anyone can explain, as
> there is not enough information in your
> email.
>
> Including the contents of the freqtest.txt file
> was a good idea, as the posting guide suggests
> (the posting guide is that clearly labeled bit
> at the bottom that looks like this:
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> Check it out! It is cool.)
>
> Additionally, include the command
> sessionInfo()
> and its output from all machines you refer to
> so maintainers know which versions of software
> you are running. Also, include the output you obtained
> from your code (with your code being a self-contained
> and reproducible set of R commands).
>
> Finally, describe what the difference is and why
> the difference is problematic (i.e. don't report
> machine precision differences, or sign differences
> for PCA results - PCA vector directions are arbitrary
> modulo 180 degrees).
>
And that is provided that the eigenvalues are distinct! Other rotations
are possible if they are not.
If the data given are the whole data matrix, then it has rank 2. The
rest can be rotated arbitrarily in 6-dimensional space.
>
>> I also tried mean(xrcc2) and sd(xrcc2) on both machines, the results are the
>> same.
>> Please explain.
>>
>
> The R maintainers do an amazing job of creating
> numerically stable platform-independent software,
> so you get the same results almost everywhere.
> (Thank you R core!)
>
>
> HTH
>
> Steve McKinney
>
> -----Original Message-----
> From: r-help-bounces at r-project.org on behalf of jathine
> Sent: Tue 9/16/2008 2:19 PM
> To: r-help at r-project.org
> Subject: [R] Different PCA results under Windows and Linux
>
>
> I ran the following R script under both Linux and Windows, and got 2
> different results.
> Linux R version 2.7.1 and Windows R version 2.7.2.
>
>
>> library(FactoMineR)
>> x1=read.table("freqtest.txt",header=TRUE)
>> xrcc2=x1[,1:8]
>> p1=PCA(xrcc2, graph=FALSE)
>> p1$var
>>
>
> freqtest.txt file lines of text :
> M1 M2 M3 M4 M5 M6 M7 M8
> -1 -1 -1 -1 -1 -1 -1 -1
> 0 0 0 0 -1 -1 1 1
> -1 -1 -1 -1 -1 -1 -1 -1
> 0 0 0 0 -1 -1 1 1
>
> I also tried mean(xrcc2) and sd(xrcc2) on both machines, the results are the
> same.
> Please explain.
>
>
>
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list