[R] Implementing step-wise linear regression

Ben Bolker bbolker at gmail.com
Mon Jan 24 14:42:51 CET 2011

Tal Galili <tal.galili <at> gmail.com> writes:

> Hello Troy.
> A tiny question (without answering your question), why did you choose to do
> it this way instead of using
> ?step
> or
> ?stepAIC
> ?

  [snip snip]

> > My questions are:
> >
> > Should I be using var.test to run the F-test to decide which variable to
> > add
> > next?
> >
> > What is the difference between the F-test run by var.test and summary.lm?

 var.test isn't what you want at all; it is for comparing variances
among *populations*.

> >
> > Has step-wise model building using the F-test been programmed already?

  Not completely (?step uses AIC).
  However add1(...,test="F") is probably what you're looking for.

  Please note that stepwise regression is *strongly* deprecated
by many statisticians, e.g.


Harrell, Frank. 2001. Regression Modeling Strategies. Springer.

Mundry, Roger, and Charles L. Nunn. 2009. Stepwise Model Fitting and Statistical
Inference: Turning Noise into Signal Pollution. The American Naturalist 173, no.
1 (January 1): 119-123. doi:10.1086/593303.

WHITTINGHAM, MARK J., Philip A. Stephens, Richard B. Bradbury, and Robert P.
Freckleton. 2006. Why do we still use stepwise modelling in ecology and
behaviour? Journal of Animal Ecology 75, no. 5: 1182-1189.

More information about the R-help mailing list