[R] stepwise regression
Spencer Graves
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
deletion.
2. The use of "AIC.c" for model selection, following Burnham and
Anderson (2002) Model Selection and Multimodel Inference, 2nd ed.
(Springer).
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
specified scope.
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.
Best Wishes,
Spencer Graves
################################
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:
>
>
>>Hello,
>>Does anybody know where I can find an R function to carry out variable
>>selection using stepwise similar (or even better) to the stepwise
function
>>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
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
More information about the R-help
mailing list