I have a multilevel problem where I want to have a random intercept and a random slope. However the random slope is the interaction of two predictors. In this case, do I also have to allow random slopes for the individual predictors?

For example, with lme4 is this OK?

lmer(y ~ x + w + x:w + (1 + x:w|group), data=mydata)

Or should i use

lmer(y ~ x + w + x:w + (1 + x + w + x:w|group), data=mydata)

even if I am not interested in either x or w to be random?


1 Answer 1


My recommendations would be to allow random slopes for all the interactive terms. This will allow for the model to adjust the interaction not only according to fixed effects but also according to random effects for each cluster group and for each covariate parameter. Only if the random terms (for x or y or both) do not show any significant effect could you take them out. Basically compare then the deviance statistics between the fully specified random term model with its alternatives.

  • $\begingroup$ Thanks. So if x or w or both do not improve the model but xw does, it is OK to keep just xw $\endgroup$ Jul 2, 2014 at 12:40
  • 1
    $\begingroup$ Yes, I would say so. Remember, that (1) when you add an interaction you are asking whether the effect of x on y changes across the values of w – or alternatively, w changes across the values of x depending on the causal story you want to tell; (2) when you then let any of these terms (x or w) vary at random there is then no good statistical reason why you should constrain the random terms only to xw since the effect on y depends now not only on the fixed effects but also on the random effects of x, z and xz. $\endgroup$
    – Adel
    Jul 2, 2014 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.