[R] help with regsubsets

From: Edwards, David J <dedward6_at_utk.edu>
Date: Wed, 07 May 2008 17:19:05 -0400


Hi,  

I'm new to R and this mailing list, so I will attempt to state my question as appropriately as possible.  

I am running R version 2.7 with Windows XP and have recently been exploring the use of the function regsubsets in the leaps package in order to perform all-subsets regression.  

So, I'm calling the function as:  

sub=regsubsets(X,Y,nbest=5,nvmax=maxnv,method="exhaustive",really.big=F)  

I'm dealing with 14 observations and 23 variables and I'm aware of the linear dependencies that arise in these situations. I also know that regsubsets performs a branch-and-bound algorithm and that at times it is necessary to reorder the variables.  

However, anytime I get the message: "Reordering variables and trying again" the R^2 for a model chosen by regsubsets does not match the R^2 I get from fitting the same model using the usual linear model function (lm). If I don't get the "Reordering variables and trying again" message, I don't have any problems with R^2 (i.e. regubsets and lm match).  

Just for example, suppose the best 1-variable model chosen by regsubsets gives me an R^2 of 0.665. Fitting that same model using lm gives me an R^2 of 0.6317.  

Does anyone have any insight on why this may be happening?  

        [[alternative HTML version deleted]]



R-help_at_r-project.org 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 Wed 07 May 2008 - 21:28:20 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 Thu 08 May 2008 - 21:30:55 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.

list of date sections of archive