[R] stepwise variable selection with multiple dependent variables

Mitchell Maltenfort mmalten at gmail.com
Fri Feb 10 23:56:50 CET 2012


"Anova.mlm" would be one way to do model selection.



On Fri, Feb 10, 2012 at 4:29 PM, Fugate, Michael L <fugate at lanl.gov> wrote:
> Good Day,
>
> I fit a multivariate linear regression model with 3 dependent variables and several predictors using the lm function.  I would like to use stepwise variable selection to produce a set of candidate models.  However, when I pass the fitted lm object to step() I get the following error:
>
> Error from R:
> Error in drop1.mlm(fit, scope$drop, scale = scale, trace = trace, k = k,  :
>  no 'drop1' method for "mlm" models
>
> My dependent data is in the matrix ymat where ymat is 35 rows by 3 columns.  The predictors are in X where X is 35 by 6
>
> The steps I used were:
> m.fit <- lm(ymat ~ ., data=X)
> m.step <- step(m.fit)
>
> If variable selection is not possible with step() is there another package that will perform variable selection in a multivariate setting?
>
> System information:
> platform       x86_64-apple-darwin9.8.0
> arch           x86_64
> os             darwin9.8.0
> system         x86_64, darwin9.8.0
> status
> major          2
> minor          13.1
> year           2011
> month          07
> day            08
> svn rev        56322
> language       R
> version.string R version 2.13.1 (2011-07-08)
>
> Thanks in advance.
>
> ______________________________________________
> 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