[R] stepwise variable selection with multiple dependent variables
Fugate, Michael L
fugate at lanl.gov
Fri Feb 10 22:29:31 CET 2012
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.
More information about the R-help
mailing list