4
$\begingroup$

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?

$\endgroup$

1 Answer 1

7
$\begingroup$

Your intuition is correct - you should remove the random slopes too.

You don't have to drop the random slope, but if you don't then you need to be extremely sure that the overall effect of that variable is zero. Recall that random effects are assumed to be normally distributed and can be interpreted as an offset to the global estimate for the relevant variable. So for example, with random intercepts the model will typically estimate a global intercept and then each group for which random intercepts are specified has their own offset from that global intercept. If you remove the global intercept from the model and just fit random intercepts you are saying that the individual intercepts for each group are clustered around zero with a normal distribution. With random slopes it is the same so if you remove the fixed effect without removing the random effect you are assuming that the overall effect for that variable is zero. Since this is hardly ever the case, this is typically not a good idea.

Also, try not to choose which variables you include in your regression model with a likelihood ratio test.

$\endgroup$
9
  • $\begingroup$ Thank you for your response! $\endgroup$ Commented Jun 25, 2021 at 17:23
  • $\begingroup$ Does this answer your question ? If so please consider marking it as the accepted answer. If not, please let us know why. Also, if you haven't already, please consider upvoting it. $\endgroup$ Commented Jul 24, 2021 at 12:02
  • $\begingroup$ Hi Robert, thanks for your response, my case is very similar to this one. I have a model with an interaction with full random effects. So y = xz + (xz|id). The wald test is telling me my fixed effect for the interaction x:z is wildly insiginficant (p = 0.75). However if I use LLR test and drop both the fixed and random effect for the interaction, it tells me it is highly significant. What should I do? If I drop only the fixed and keep the random it's still significant. I think it's only the fixed component that is insignificant but it would be weird to keep the random slope in. $\endgroup$ Commented Jan 2, 2022 at 5:01
  • $\begingroup$ @teeniv is this a model containing only the interaction as fixed effects ? What about the main effects ? It's hardly ever a good idea to fit a model with an interaction but without main effects. $\endgroup$ Commented Jan 2, 2022 at 11:54
  • $\begingroup$ @RobertLong sorry, the formatting didn't help. This is a generalised linear mixed effects model (log link and gaussian variance structure) with main and interaction effects, and full random effects. So y = x + z + x:z + (x + z + x:z|id). Wald Z test says x:z fixed effect is not significant, but not sure how to test this correctly using LLR tests. $\endgroup$ Commented Jan 2, 2022 at 14:32

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.