[Rd] possible bug in det using method="qr" (PR#1244)

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
05 Jan 2002 12:45:55 +0100


Armin Roehrl <armin@approximity.com> writes:

> Good morning,
> 
> >dput(m2)
> structure(c(9822616000, 3841723000, 79790.09, 3841723000, 1502536000, 
> 31251.82, 79790.09, 31251.82, 64156419.36), .Dim = c(3, 3))
> 
> > det(m2, method="eigenvalues")
> [1] -9.331893e+19
> > det(m2, method="qr")
> [1] 9.331893e+19
> 
> I hope it's not just some numerical accuracy thing and therefore
> wasting your time.

It's a numerical accuracy thing, but not a waste of time. The issue
is that qr() thinks that the matrix is singular:

> prod(diag(qr(m,tol=1e-9)$qr))
[1] -9.331893e+19
> prod(diag(qr(m)$qr))
[1] 9.331893e+19

Two issues here: 
(a) if qr() thinks a matrix is singular, I think det() should take the
consequences and return zero.
(b) Perhaps there ought to be a way to pass the tol= argument to det. 

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._