[R] svd and eigen

Stephane Dray dray at biomserv.univ-lyon1.fr
Thu Sep 6 17:12:11 CEST 2001


>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

-- 
Stéphane DRAY
---------------------------------------------------------------
Biométrie et Biologie évolutive - Equipe "Écologie Statistique"
Universite Lyon 1 - Bat 711 - 69622 Villeurbanne CEDEX - France

Tel : 04 72 43 27 56			   Fax : 04 78 89 27 19
       04 72 43 27 57 	   E-mail : dray at biomserv.univ-lyon1.fr 
---------------------------------------------------------------
ADE-4               http://pbil.univ-lyon1.fr/ADE-4/ADE-4F.html
---------------------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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