Re: [R] PRESS criterion in leaps

From: Thomas Lumley <>
Date: Mon, 14 May 2007 08:52:39 -0700 (PDT)

On Fri, 11 May 2007, Andrew Smith wrote:
> I thought it would be simplest to build on already existing functions like
> regsubsets in package leaps. It's easy enough to calculate the PRESS
> criterion for a fitted lm object, but I'm having trouble deciphering the
> structure of the regsubsets objects that leaps works with. Is there any way
> to calculate press from a regsubsets? Or, to put it another way, can I get
> the residual vector and the diagonal entries of the hat matrix from a
> regsubsets object? In fact, if the hat matrix is never calculated
> explicitly, the columns of Q from the QR factorization would suffice.

Not only is the hat matrix never calculated explicitly, the Q matrix isn't calculated either. The code forms R and Q^TY directly (the same code is used in the biglm package to provide bounded-space linear regression).

         -thomas mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 14 May 2007 - 16:17:18 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 Mon 14 May 2007 - 17:31:33 GMT.

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