[R] buggy eigen function

Yves Gauvreau cyg at sympatico.ca
Wed Mar 22 00:41:20 CET 2000


----- Original Message -----
From: "Thomas Lumley" <thomas at biostat.washington.edu>
To: "Chong Gu" <chong at stat.purdue.edu>
Cc: <r-help at stat.math.ethz.ch>; <tomlinso at stat.purdue.edu>
Sent: Tuesday, March 21, 2000 3:43 PM
Subject: Re: [R] buggy eigen function


> On Tue, 21 Mar 2000, Chong Gu wrote:
>
> >
> > It was a real surprise, but a student in my class found that the
> > function eigen is buggy.  He traced to the problem from his inability
> > of getting principal component analysis to work on his data.
>
> I can't reproduce this problem.  I've tried on Linux and on AIX (which I
> believe is your system) and I get
>
> > jj
>            [,1]      [,2]       [,3]
> [1,]  0.8288469 -1.269783 -0.7533517
> [2,] -1.2697830  2.162132  2.0262920
> [3,] -0.7533517  2.026292  4.1927134
> > eigen(jj)
> $values
> [1]  5.795187e+00  1.388505e+00 -2.006855e-07
>
> $vectors
>            [,1]       [,2]       [,3]
> [1,] -0.3417893  0.4739218 -0.7067794
> [2,]  0.7093264 -0.4978512 -0.5411749
> [3,]  1.0576086  0.4870615  0.1345488
>
>
> which looks right to me.
>
> There may be a problem with your BLAS system or something. What OS and
> compilers are you using?
>
> -thomas
>
> Thomas Lumley
> Assistant Professor, Biostatistics
> University of Washington, Seattle
>
>
> >
> > Chong Gu
> >
> >
> > Here is a matrix I generated through X'X, where X is 2x3.
> >
> > > jj
> >            [,1]      [,2]       [,3]
> > [1,]  0.8288469 -1.269783 -0.7533517
> > [2,] -1.2697829  2.162132  2.0262917
> > [3,] -0.7533517  2.026292  4.1927134
> >
> >
> > Here are the 0.90.1 eigen results.
> >
> > > eigen(jj)
> > $values
> > [1]  3.06206547  0.20492432 -0.04955518
> >
> > $vectors
> >            [,1]        [,2]        [,3]
> > [1,] -0.2316032  0.05778620  0.06998513
> > [2,]  0.4932735 -0.04951172  0.06919350
> > [3,]  0.8489300  0.06527175 -0.01966568
> >
> >
> > Here are the 1.0.0 eigen results.
> >
> > > eigen(jj)
> > $values
> > [1]  2.765885782  0.008839573 -0.122630879
> >
> > $vectors
> >            [,1]       [,2]       [,3]
> > [1,] -0.2236327  0.6670340  0.7106715
> > [2,]  0.4693452 -0.5653355  0.6783147
> > [3,]  0.8542268  0.4852437 -0.1866417
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-
> > r-help mailing list -- Read
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> > Send "info", "help", or "[un]subscribe"
> > (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> >
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
> >
>
> Thomas Lumley
> Assistant Professor, Biostatistics
> University of Washington, Seattle
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-
> r-help mailing list -- Read
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
>

Here's what I get on a NT 4.0 SP6

R : Copyright 2000, The R Development Core Team
Version 1.0.0  (February 29, 2000)

tt
           [,1]      [,2]       [,3]
[1,]  0.8288469 -1.269783 -0.7533517
[2,] -1.2697830  2.162132  2.0262920
[3,] -0.7533517  2.026292  4.1927134
> eigen(tt)
$values
[1]  5.795187e+00  1.388505e+00 -2.748282e-07

$vectors
           [,1]       [,2]       [,3]
[1,] -0.2592216  0.5625659  0.7850629
[2,]  0.5379709 -0.5909711  0.6011160
[3,]  0.8021169  0.5781633 -0.1494517

which seem different also.

Yves

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list