[R] Step-wise method for large dimension

R. Michael Weylandt michael.weylandt at gmail.com
Fri Nov 16 00:48:06 CET 2012


Probably you just want

Y ~ .

where "." means everything which doesn't appear elsewhere in the formula.

Michael

On Thu, Nov 15, 2012 at 8:45 PM, farnoosh sheikhi <farnoosh_81 at yahoo.com> wrote:
>
>
> Hi ,
>
> I want to apply the following code fo my data with 400 predictors.
> I was wondering if there ia an alternative way instead of typing 400 predictors for the following code.
> I really appreciate your help.
>
> fit0<-lm(Y~1, data= mydata)
> fit.final<- lm(Y~X1+X2+X3+.....+X400, data=mydata) ???
> step(fit0, scope=list(lower=fit0, upper=fit.final), data=mydata, direction="forward")
> step(fit.final, scope=list(lower=fit.final, upper=fit0), data=mydata, direction="backward")
>
> Best,Farnoosh Sheikhi
>         [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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