Reputation: 835
I used the following syntax for the mixed model and then step but it did not work.
Does it normally work like this or I actually can not use backward elimination with lmer? Thanks!
fullmodel<-lmer(Eeff~NDF+ADF+CP+NEL+DMI+FCM + (1|Study),data=na.omit(phuong))
step(fullmodel, direction = "backward", trace=FALSE )
Upvotes: 6
Views: 16018
Reputation: 7755
You can do this with lmerTest
package:
library(lmerTest)
step(fullmodel)
After testing this function with my rather complex data, it does seem to produce feasible model alternatives.
Upvotes: 7
Reputation: 3534
The function you want is stepAIC
from the MASS
package.
stepAIC
(and step
) use AIC by default, which is asymptotically equivalent to leave-one-out cross validation.
As for the trenchant criticisms, expert knowledge is a great starting point for model selection, but I too often see this used as an excuse to pass the responsibility for making complex statistical decisions off to an applied researcher who doesn't understand statistics.
Edit: sorry, my bad, misread your question, I thought you said 'lme' instead of 'lmer'. I have no idea whether stepAIC supports lmer.
Upvotes: -1
Reputation: 23758
You could do it, just not with the step function. Since your model is just additive it shouldn't take that long to do by hand.
Upvotes: 2