[R] COMPUTING DETERMINANT FROM SVD

Simon Wood snw at mcs.st-and.ac.uk
Sat May 19 21:18:36 CEST 2001


> 
> I computed determinant of a square matrix "var.r" using the SVD output:
> 
> detr _ 1
> 
> d _ svd(var.r)$d
> 
> for (i in 1:length(d)) {
> 
> detr _ detr*d[i]
> 
> }
> print(detr)
> 30.20886
> 
> BUT when I tried :
> 
> det(var.r)
> I got :
> -30.20886
> 
> Is this because SVD output will only give absolute of the eigenvalues ?

Yes, the singular values of A are the square roots of eigen values of A'A
(where the latter are non -ve of course, since A'A is +ve semi definite). 


>, If 
> this is the case
> how can I get the original eigenvalues?

- eigen(A)$values , for example.

Simon

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