[R] Forward Stepwise regression with stepAIC and step

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu May 8 11:34:50 CEST 2003


On Thu, 8 May 2003 pfm401 at lineone.net wrote:

> I cannot seem to get the R functions step or stepAIC to perform forward
> or stepwise regression as I expect.

[...]

> wateruse.lm.forward<-stepAIC(wateruse.lm,trace=FALSE,direction="forward")

[...]

> In other words no forward procedure has been run (similar results apply
> if I use direction="step")!!

That's not a valid value for `direction': see the help page.

> What am I doing wrong?? Thanks in advance for any help.

You not given a `scope' argument, so there are no variables to add.

-- 
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