[R] Problems understanding qr. family of functions

Kjetil Brinchmann Halvorsen kjetil at acelerate.com
Wed Oct 13 18:41:13 CEST 2004


Hola!

By my understanding of reading   ?qr
the following shold result a 3 x 3 matrix:  (rw2000)

 x <- matrix( rnorm(12), 4,3)
 y <- matrix( rnorm(12), 4,3)
 xqr <- qr(x)
 yqr <- qr(y)

 qr.qty( xqr, qr.Q(yqr) ) # dim (3,3)
            [,1]       [,2]      [,3]
[1,]  0.16815466 -0.1970936 0.2351670
[2,]  0.15667444  0.4939800 0.8443340
[3,] -0.97096971  0.1029652 0.1456355
[4,] -0.06629443 -0.8405570 0.4588976

 # The following should be equal:
 t( qr.Q(xqr) ) %*% qr.Q(yqr)
           [,1]       [,2]      [,3]
[1,]  0.1681547 -0.1970936 0.2351670
[2,]  0.1566744  0.4939800 0.8443340
[3,] -0.9709697  0.1029652 0.1456355

but evidently is not.

There is at least one bug:
1) in R
2) in the help page
3) in my reading of the help page

Kjetil



-- 

Kjetil Halvorsen.

Peace is the most effective weapon of mass construction.
               --  Mahdi Elmandjra




More information about the R-help mailing list