Re: [R] rank of a matrix

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Thu 05 May 2005 - 05:32:14 EST

Gabor Grothendieck wrote:

> In this case, try a lower tolerance (1e-7 is the default):
> 
> 
>>qr(hilbert(9), tol = 1e-8)$rank
> 
> [1] 9

But don't trust the results. For example, create a matrix with 4 identical copies of hilbert(9). This still has rank 9. It's hard to find, though:

> h9 <- hilbert(9)
> temp <- cbind(h9, h9)
> h9times4 <- rbind(temp, temp)
>
> qr(h9times4,tol=1e-7)$rank

[1] 7
> qr(h9times4, tol=1e-8)$rank

[1] 10
> qr(h9times4, tol=1e-9)$rank

[1] 11
> qr(h9times4, tol=1e-10)$rank

[1] 12

There's a tolerance that gives the right answer (1.5e-8 works for me), but how would I know that in a real problem where I didn't already know the answer?

Duncan Murdoch



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu May 05 05:36:41 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:35 EST