[R] All possible subset selection?

zhu wang anoy69 at yahoo.com
Thu May 8 16:50:39 CEST 2003


Thanks to Prof Brian Ripley for the valuable
illustration.

Zheng Huang & Zhu Wang

--- Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> On Wed, 7 May 2003, zhu wang wrote:
> 
> > I am wondering if there is a function in R to do
> all
> > possible subset selection, e.g. using AIC/BIC. It
> > seems to me the function step can not do all
> possible
> > selection.
> 
> That's right, and I know of no function. 
> Potentially the computational 
> burden is horrendous, even of sorting out which are
> valid subset models.
> For continuous (rather than categorical) variables,
> look at package leaps.
> 
> > I am also want to know why the following functions
> > give me different results. It seems I missed some
> > points here.
> > 
> > lm <- lm(y ~., data=somedata)
> > AIC(lm)
> > extractAIC(lm)
> 
> Please don't call the result by the name of a
> function!
> 
> extractAIC (as its help says) is a helper function
> for step/add1/drop1,
> and it is designed to report Cp in some lm cases
> when AIC is Cp plus a
> constant. It predates AIC by several years.
> 
> Remember that AIC is only defined up to an additive
> constant, because a 
> log-likelihood is (it depends on the dominating
> measure used).  
> extractAIC.lm and AIC.lm use different ones, and in
> the case that the 
> scale is known, they use different maximizations
> too.  (AIC.lm is only 
> appropriate if the scale (error variance) is
> unknown.)
> 
> -- 
> Brian D. Ripley,                 
> ripley at stats.ox.ac.uk
> Professor of Applied Statistics, 
> http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865
> 272861 (self)
> 1 South Parks Road,                     +44 1865
> 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865
> 272595
>




More information about the R-help mailing list