[R] Stepwise procedure with force.in command

Peter Ehlers ehlers at ucalgary.ca
Mon Apr 9 14:47:00 CEST 2012


On 2012-04-09 00:44, Hien Nguyen wrote:
> Dear R-helpers,
>
> I am trying to do a stepwise procedure in which I want to force some
> variables in the model. I have searched around and it seems that only
> leaps package allows to force the variable in the stepwise procedure. I
> use the leaps package and use the regsubsets(lm1, force.in = 1, data) to
> force 1 variable in the model. However, the force.in command only allow
> me to force 1 variable in. I want to force several variables in the
> procedure. How could I force them in?

Well, I don't know where you've searched, but the help page for
step() or for stepAIC() in pkg MASS tells you that there's a
scope= argument which should do what you want.

Peter Ehlers

>
> Thanks a lot,
>
> Hien
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list