Imagine the following model:

lmer(DV ~ Control Variable A + Control Variable B + Control Variable C + 
         Variable of Interest A + Variable of Interest B + Variable of Interest C + 
         Variable of Interest A x Variable of Interest B + 
         Variable of Interest A x Variable of Interest C + (1|Subject) + (1|Item)

(I only included random intercepts for the purpose of the example.)

If a model with all possible random slopes does not converge, what's the best way to decide which random slopes to include. Should it only be based on theory, and which effects are more likely to vary by subject/item?

Edit: I am fitting an lmer() model using lme4. I know that might make this seem like a stackoverflow issue, but I'm really interested in the theory of how to decide which random slopes to include when I can't include all of them (as Barr er al., 2013 recommend). It is a linear mixed effects model for data in which participants responded to various stimuli. Thus the model includes random subject and item intercepts. The variables of interest were manipulated within subjects but not within items. There are 120 observations per participant. I used whatever optimized is the default for lmer().

  • 2
    $\begingroup$ The problem might be the optimizer rather than the model itself. It's unclear what you're really doing, because of the vagueness of "all possible random slopes," the lack of any indication of what kind of "model" you are fitting, how much data are available, or even of the purpose of the modeling. Perhaps you could include that information in an edited version of this question. $\endgroup$
    – whuber
    Commented Oct 31, 2018 at 17:55
  • $\begingroup$ I purposefully kept it vague because I was interested in more of a general guideline than advice for this specific model. But if you think it's easier I can add in extra info. $\endgroup$
    – Dave
    Commented Oct 31, 2018 at 18:10
  • 1
    $\begingroup$ I was hoping to make it evident that asking for general guidelines is likely to make your question overly broad for this site. $\endgroup$
    – whuber
    Commented Oct 31, 2018 at 18:45
  • $\begingroup$ Gotcha. I will add the info you asked for in an edit. $\endgroup$
    – Dave
    Commented Oct 31, 2018 at 19:00
  • 1
    $\begingroup$ Still more information would be useful. Can you include the function call, eg? What the random effects are is not at all clear. What optimizer was used? Etc. $\endgroup$ Commented Oct 31, 2018 at 19:09

1 Answer 1


Note that random effects are used to capture correlations in the data. In particular, when you include a random effect for a grouping variable (i.e., the variable that you put after the | symbol), you postulate that measurements of your outcome variable that have the same value for the grouping variable are correlated. What you put in front of the | symbol determines how these correlations look like. For example,

  • if you put only an intercept (i.e., 1 | id), you assume the same correlation for all pairs of measurements with the same value of the grouping variable;
  • if you put a random slope (i.e., x | id), you postulate that outcome measurements that have x values closer in magnitude are more strongly correlated than measurements for which the difference between corresponding x values is of larger magnitude. E.g., in a longitudinal study if x is time, then you say that measurements closer in time are more strongly correlated than measurements further apart in time.

In that regard, you have to carefully think what random effects you put in your model, and which random slopes you really need to begin with. Hence, putting all random slopes may result in an overly complicated, not realistic model.

If you want to have a closer on how random effects model correlations, you may have a look in the shiny app for my Repeated Measurements course, in particular check Section 3.3 in both the slides and the app.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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