In mixed effect models, do you add factors one by one? Or do you reduce the factors one by one? What I am doing is as follows. Are there any problems with the steps?
- Build a full model:
mod.full <- lmer(DV ~ A*B + C + D + (1 + E|participant) + (1 + B + E|item)
- Reduce the random slopes one by one. If p>0.05 then the omitted factor can be taken away from full model.:
mod.reduced1 <- lmer(DV ~ A*B + C + D + (1|participant) + (1 + B + E|item))
anova(mod.full, mod.reduced1) # compare models
mod.reduced2 <- lmer(DV ~ A*B + C + D + (1|participant) + (1 + E|item))
anova(mod.reduced2, mod.full) # compare models
mod.reduced3 <- lmer(DV ~ A*B + C + D + (1|participant) + (1 |item))
anova(mod.reduced3, mod.full) # compare models
mod.reduced4 <- lmer(DV ~ A*B + C + D + (1|participant)) # sometimes an entire random factor needs to go because the model has 'isSingular' warnings
anova(mod.reduced4, mod.full) # compare models
- I reduce the random factors until there is not 'isSingular' warning. And use it as a new full model if this model doesn't significantly differ from the full model. (I'm not sure what to do if the last model without the isSingular warning DOES differ from the original full model.)
- Then I reduce the fixed factors that are not critical to the study from the new model.
mod.new <- lmer(DV ~ A*B + C + D + (1|participant))
mod.C <- lmer(DV ~ A*B + C + (1|participant))
mod.D <- lmer(DV ~ A*B + D + (1|participant))
- Then I compare the models. If those fixed factors do not differ from the new full model, I remove them.
anova(mod.new, mod.C) # the results for this is the effect of fixed factor D. Remove D if p > 0.05
anova(mod.new, mod.D) # the results for this is the effect of fixed factor C. Remove C if p > 0.05
- After removing the fixed factors, I have a final full model. I use this to compare with models without the other fixed factors that I am interested in.
mod.final <- lmer(DV ~ A*B + D + (1|participant))
mod.A <- lmer(DV ~ A + A:B + D + (1|participant))
mod.B <- lmer(DV ~ B + A:B + D + (1|participant))
mod.AB <- lmer(DV ~ A + B + D + (1|participant))
anova(mod.final, mod.A) # the effect of B
anova(mod.final, mod.B) # the effect of A
anova(mod.final, mod.AB) # the effect of the A:B interaction
I was wondering whether this process is correct. I was also wondering whether the factors can be added up rather than reduced? For instance, I start from one random factor
mod.null <- lmer(DV ~ 1 + (1|participant))
and then add the fixed factors
mod.A <- lmer(DV ~ A + (1|participant))
anova(mod.A, mod.null)
Then when I want to add factor B, do I build a model with only B or with A + B? I'm not sure whether adding factors will work and how it works.