At 01:37 PM 5/10/00 +0200, ralle wrote:>Hi, >I have a problem understanding what is going on with eigen() for >nonsymmetric matrices. >Example: >h<-rnorm(6) >> dim(h)<-c(2,3) >> c<-rnorm(6)"c" is not a great choice of identifier!>> dim(c)<-c(3,2) >> Pi<-h %*% c >> eigen(Pi)$values >[1] 1.56216542 0.07147773These could have been complex, of course, but as it happens they are real.>> svd(Pi)$d >[1] 2.85537780 0.03910517These must be real and they are not the eigenvalues of Pi.> >And now: >> Pi2<-Pi %*% t(Pi) #that means Pi2 is symmetric and the eigenvaluesshould be the> # squared eigenvalues of PiNot quite. It means Pi2 is symmetric all right, but it implies no simple relationship between the eigenvalues of Pi and Pi2. What you can say is the the *singular values* of Pi2 are the square of the *singular values* of Pi.>> eigen(Pi2)$values >[1] 8.153182389 0.001529214 >> svd(Pi2)$d >[1] 8.153182389 0.001529214 >Indeed: >diag(svd(Pi)$d) %*% diag(svd(Pi)$d) > [,1] [,2] >[1,] 8.153182 0.000000000 >[2,] 0.000000 0.001529214 >Moral: for any real matrix X the singular values are the positive square roots of the eigen values of t(X) %*% X. (Consequence: if X is symmetric and positive definite its eigenvalues are the same as its singular values, but otherwise this is not necessarily so.)>I conclude that eigen() works correctly for symmetric matrices only (or >makes sense ...).Nope.>Do I have misconceptions about the relationship between the results of >eigen()$values and >svd()$d and my conclusion is wrong ?You do have some serious misconceptions.>The VR-Book "Modern Applied Statistics" (1994) states explicitly that >eigen() is for >symmetric matrices. > >Can anybody help me to clarify this point ?Well the VR-book in 1994 was written for S-PLUS only, and in 1992-3 when that edition was written it did only work for symmetric matrices, but S-PLUS has changed and R has come of age. Things change fast in this territory. There have been two more editions of the VR-book since then this and only this reason. V. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi, I have a problem understanding what is going on with eigen() for nonsymmetric matrices. Example: h<-rnorm(6)> dim(h)<-c(2,3) > c<-rnorm(6) > dim(c)<-c(3,2) > Pi<-h %*% c > eigen(Pi)$values[1] 1.56216542 0.07147773> svd(Pi)$d[1] 2.85537780 0.03910517 And now:> Pi2<-Pi %*% t(Pi) #that means Pi2 is symmetric and the eigenvalues should be the# squared eigenvalues of Pi> eigen(Pi2)$values[1] 8.153182389 0.001529214> svd(Pi2)$d[1] 8.153182389 0.001529214 Indeed: diag(svd(Pi)$d) %*% diag(svd(Pi)$d) [,1] [,2] [1,] 8.153182 0.000000000 [2,] 0.000000 0.001529214 I conclude that eigen() works correctly for symmetric matrices only (or makes sense ...). Do I have misconceptions about the relationship between the results of eigen()$values and svd()$d and my conclusion is wrong ? The VR-Book "Modern Applied Statistics" (1994) states explicitly that eigen() is for symmetric matrices. Can anybody help me to clarify this point ? Thank you Ralph -- ------------------------------------------------------------------------------- There are three kinds of economists, those who can count and those who can''t. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 Wed, 10 May 2000, ralle wrote:> The VR-Book "Modern Applied Statistics" (1994) states explicitly that > eigen() is for > symmetric matrices.It does not on any of the pages indexed under `eigen'', and on those pages it "explicitly" discusses simplifications if the matrix is symmetric and the `symmetric'' argument! -- 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 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>The VR-Book "Modern Applied Statistics" (1994) states explicitly that >eigen() is for symmetric matricesAs I recall, eigen() in Splus did only work for symmetric matrices sometime in the last millenium. I believe it changed around 1994. I don''t think R had eigen() until around 1996, and I believe it may not have worked with non-symmetric matrices at first, but that changed very quickly. History buffs please correct me. I work with time series but I''m not good at remembering dates. Paul Gilbert -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi No problem with eigen (also in the asymmetric case, unless you set the option symmetric=T for an asymmetric matrix) or svd. I think your problem is here:> Pi2<-Pi %*% t(Pi) #that means Pi2 is symmetric and the eigenvalues should#be the squared eigenvalues of Pi This not true generally but only for symmetric Pi (i.e. Pi=t(Pi)) Yours Marcel -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._