[R] how to run stepAIC starting with NULL model?

Peter Ehlers ehlers at math.ucalgary.ca
Fri Apr 7 20:56:28 CEST 2006

Joshua B Robins wrote:

> Hello,
> I'm trying to figure out how to run the stepAIC function starting with the
> NULL model.  I can call the null model (e.g., lm(y ~ NULL)), but using
> this object in stepAIC doesn't seem to work.
I don't know what "doesn't seem to work" means here, but your null
model is equivalent to lm(y ~ 1) and stepAIC handles both just fine
for me. Did you specify 'scope' with an 'upper' component?

Peter Ehlers

> The objective is to calculate AICc.  This can be done if stepAIC can be
> run starting with the NULL model; the (2p(p-1)/(n-p-1))to get AICc would
> be added to the final step AIC value. Can anyone suggest how to run
> stepAIC beginning with the NULL model, and sequentially adding and
> removing variables (essentially a bottom-up approach)?
> Thanks,
> Josh Robins
> School of Fisheries and Ocean Sciences
> University of Alaska Fairbanks
> Juneau Center
> (206) 331-8633
> j.robins at uaf.edu
> http://students.washington.edu/jbrobins
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

More information about the R-help mailing list