I'm performing a model comparison using the likelihood ratio test in R with two mixed models fitted with lme4.
My model is:
fit1 <- lmer(y ~ x * z + (z|id))
If I want to compare fit1 with a model without the effect z and then compare models with anova(fit1, fit0) should I need to remove also the random slope?
# Option 1
fit0 <- lmer(y ~ x + (1|id))
# Option 2
fit0 <- lmer(y ~ x + (z|id))
anova(fit1, fit0)
My idea is that when dropping a fixed effect I should also remove the random part. However, I guess that removing also the random slopes can somehow influence the test partially hiding the contribution of the fixed effect.
What should I do?