[R] QR Decompositon and qr.qty

From: Sebastian Bauer <Sebastian.Bauer_at_charite.de>
Date: Tue, 15 May 2007 15:20:00 +0100


Dear R people,

I do not have much knowledge about linear algebra but currently I need to understand what the function qr.qty is actually doing. The documentation states that it calculates t(Q) %*% y via a previously performed QR matrix decomposition.

In order to do that, I tried following basic example:

m<-matrix(c(1,0,0,0,1,0,0,0,1,0,0,1),ncol=3) # 4x3 matrix qr.qty(qr(m),matrix(c(1,2,3,4,2,3,4,5,1,1,1,1,2,2,2,2),nrow=4))

      [,1] [,2] [,3] [,4]
[1,] -1 -2 -1 -2
[2,] -4 -5 -1 -2
[3,] 3 4 1 2
[4,] -2 -3 -1 -2

As far as I understood the documentation a call such as

t(qr.Q(qr(m)))%*%matrix(c(1,2,3,4,2,3,4,5,1,1,1,1,2,2,2,2),nrow=4)

should produce the same result, but this produces a 3 by 4 rather than a four by four matrix as t(qr.Q(qr(m))) has only three rows.

      [,1] [,2] [,3] [,4]
[1,] -1 -2 -1 -2
[2,] -4 -5 -1 -2
[3,] 3 4 1 2

So the last line is missing. Any hints how R adds the last line would be appreciated.

Regards,
Sebastian



R-help_at_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 and provide commented, minimal, self-contained, reproducible code. Received on Tue 15 May 2007 - 13:23:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 15 May 2007 - 14:31:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.