#import lme4 package and lmerTest package
library(lmerTest)
m.carrots <- lmer(Preference ~ sens2 + Homesize
+(1+sens2|Consumer), data=carrots)
# only elimination of the random part is required.
#approximation of ddf is Satterthwaite
step(m.carrots, reduce.random = FALSE)
Run the code above in your browser using DataLab