[R] Plotting of regsubsets adjr2 values not correct

Thomas Lumley tlumley at uw.edu
Tue Sep 25 22:36:29 CEST 2012


On Wed, Sep 26, 2012 at 3:03 AM, Maximilian Lklweryc
<maxlklweryc at gmail.com> wrote:
> Hi,
> I want to make model selection with regsubsets. My code is:
>
> a<-regsubsets(Gesamt ~ CommunistSocialist + CountrySize + GNI + Lifeexp +
> Schoolyears + ExpMilitary + Mortality +
>   PopPoverty + PopTotal + ExpEdu + ExpHealth, data=olympiadaten, nbest=2)
> summary(a)
> plot(a,scale="adjr2")
>
> (output attached)
>
> The problem is now, that I want to fit the best model again "manually" and
> have a look at it, but the value of the adjusted R squared is not the same
> as in the regsubsets output?

Hard to tell: you haven't given us any way to reproduce what you did.
For the data example in the package the adjusted r2 values from
individual models match up with the ones on the graph. I've checked
another couple of data sets and they also agree.


>
> Also I do not understand, which models are shown there, e.g. the simple
> model just with an intercept and the variable GNI is not shown in the plot,
> why?

You asked for the two best models of each size, so you get the two
best models of each size.


   -thomas

-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland




More information about the R-help mailing list