Re: [Rd] Suggest adding a 'pivot' argument to qr.R

From: Tim Hesterberg <>
Date: Tue, 11 Sep 2012 22:23:14 -0700

>On Sep 11, 2012, at 16:02 , Warnes, Gregory wrote:
>> On 9/7/12 2:42 PM, "peter dalgaard" <> wrote:
>>> On Sep 7, 2012, at 17:16 , Tim Hesterberg wrote:
>>>> I suggest adding a 'pivot' argument to qr.R, to obtain columns in the
>>>> same order as the original x, so that
>>>> a <- qr(x)
>>>> qr.Q(a) %*% qr.R(a, pivot=TRUE)
>>>> returns x.
>>> That would come spiraling down in flames the first time someone tried to
>>> use backsolve on it, wouldn't it? I mean, a major point of QR is that R
>>> is triangular; doesn't make much sense to permute the columns without
>>> retaining the pivoting permutation.
>> As I understand Tim's proposal, the pivot argument defaults to FALSE, so
>> the new behavior would only be activated at the user's request.
>Sure. I'm just saying that I see little use for the un-pivoted qr.R because, generically, the first thing you want to do with qr.R is to invert it, which is easier when it is triangular.

Greg Warnes is correct, I propose keeping the default FALSE, for backward compatibility.

My use for the pivoted R is in computing a covariance matrix, using   R <- qr.R(QR, pivot = TRUE)
  Rinv <- ginverse(R)
  covTerm <- Rinv %*% t(Rinv)

But I see that lm() and glm() use chol2inv, that may be preferable. mailing list Received on Wed 12 Sep 2012 - 05:26:06 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 Mon 01 Oct 2012 - 11:50:45 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive