is it possible that regsubsets divides the subset dataset into training and
testing set.. so when it calculates R^2 it's not the same as what you'd
get
with lm. You probably need to look into the source code to know if this is
true or not
Edwards, David J wrote:>
> 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.
>
>
-----
Yasir H. Kaheil, Ph.D.
Catchment Research Facility
The University of Western Ontario
--
View this message in context:
http://www.nabble.com/help-with-regsubsets-tp17115128p17136650.html
Sent from the R help mailing list archive at Nabble.com.