[R] stepwise regression
spencer.graves at pdf.com
Sun Apr 27 20:13:15 CEST 2003
An incompletely debugged revision of the stepAIC function called
"stepAIC.c" is available for downloading from "prodsyse.com". This
version allows three modifications of "stepAIC":
1. It offers three different 'hierarchy' options: 'include',
'exclude' and 'ignore'. The 'include' option will test A^2 as 'A+A^2'
with 2 degrees of freedom if a the linear term is not already in the
model, with comparable adjustments for interactions and for backwards
2. The use of "AIC.c" for model selection, following Burnham and
Anderson (2002) Model Selection and Multimodel Inference, 2nd ed.
3. The output includes an attribute "models" summarizing all the
models fit sorted by the posterior probability that each model is the
best to use given the available data assuming a uniform prior over all
models tested. If you assume that the "best" model will likely have
either a dominant main effect or parabolic or two-factor interaction,
then this should be equivalent to a posterior over all models in the
This has been lightly tested with lm in S-Plus 6.1 and R 1.6.2. It
carries the standard GNU warranty, which is nothing. I am actively
working to improve this, and would appreciate your comments, questions,
and suggestions. However, I also have other commitments, so I can't
promise to respond any more than I respond to "r-help".
I hope some of you find this useful -- and maybe get excited enough
to improve it yourself.
stepAIC in MASS.
hope this helps. spencer graves
Thomas W Blackwell wrote:
> Probably you've already found the function step() in the base
> package, and its sub-functions add1(), drop1(). See the help
> for these.
> - tom blackwell - u michigan medical school - ann arbor -
> On Fri, 25 Apr 2003 edgar at uprm.edu wrote:
>>Does anybody know where I can find an R function to carry out variable
>>selection using stepwise similar (or even better) to the stepwise
>>available in S-Plus?. I have tried the mle.stepwise function available in
>>the wle package but I am not getting accurate results.
>>I have tried also the leaps package but it does not handle the options
>>f-in and f-out like in either MINITAB or SAS.
>>Thanks in advance
>>Dr. Edgar Acuna
>>University of Puerto Rico at Mayaguez
> R-help at stat.math.ethz.ch mailing list
More information about the R-help