[R] buggy eigen function
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Tue Mar 21 22:03:13 CET 2000
Chong Gu <chong at stat.purdue.edu> writes:
> 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.
..
> 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
I get this on an i386 (well, k6-III):
> 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.1345489
this is the same as S-PLUS 3.4 on a Sun SPARC, except that the sign of
the last two columns is reversed, and it also makes sense that one
eigenvalue should be zero for a rank-2 p.s.d. matrix. What hardware
are you working on?
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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