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. 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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.1866417I 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thanks to Thomas Lumley, Peter Dalgaard, and Simon Wood who responded to my post.>From the responses, the problem seems to be in our systeminstallation. I'll try to track it down. I'll try on my linux box tonight and I expect to see the same reasonable results as yours. To answer Thomas Lumley, the errors were produced on our AIX machine. Chong Gu -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._