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]]
______________________________________________
[email protected] 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.