[R] svd and eigen

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Sep 6 17:36:19 CEST 2001


Stephane Dray <dray at biomserv.univ-lyon1.fr> writes:

> >The singular values of a matrix A are the +ve square roots of
> >the eigenvalues of A'A, or AA' (depending on the shape of A), where A' is
> >transpose of A. e.g....
> >
> >>  A<-matrix(rnorm(10),2,5)
> >>  svd(A)$d
> >[1] 1.6157235 0.9652578
> >>  eigen(A%*%t(A))$values^0.5
> >[1] 1.6157235 0.9652578
> >
> 
> Yes, of course ... but :
> >  svd(mat)$d
>   [1] 1.17069725 1.01156192 0.90637068 0.81183730 0.75508662
> 0.57540484 0.53941772 0.51359072 0.49338327 0.45236340
> [11] 0.42074523 0.40355803 0.37502763 0.36161939 0.31022290 0.30024633
> 0.27126673 0.25990555 0.19974930 0.18071039
> [21] 0.14214615 0.13599764 0.09270370 0.06966780 0.04571913
> >  eigen(mat)$values
>   [1]  1.00000000  0.89480696  0.79123824  0.69792179 -0.63442305
> -0.55072855 -0.52263267  0.50820449 -0.50552311
> [10] -0.45431956 -0.40717371  0.37976933 -0.36275320  0.34892256
> -0.34126875 -0.31841576 -0.30411335  0.27663288
> [19] -0.22103895 -0.19623454 -0.14990290  0.14228531 -0.10127212
> 0.08101399 -0.05099532

You're under the mistaken impression that the eigenvalues of A'A have
anything to do with those of A:

A <- matrix(rnorm(9),3)
eigen(t(A)%*%A)$values
abs(eigen(A)$values)^2

# it only works when A is symmetric:
A <- A+t(A)
eigen(t(A)%*%A)$values
eigen(A)$values
eigen(A)$values^2


-- 
   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