# When a model with all random slopes will not converge, what is the best way to choose which random effects to include?

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().

• 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. – whuber Oct 31 '18 at 17:55
• 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. – Dave Oct 31 '18 at 18:10
• I was hoping to make it evident that asking for general guidelines is likely to make your question overly broad for this site. – whuber Oct 31 '18 at 18:45
• Gotcha. I will add the info you asked for in an edit. – Dave Oct 31 '18 at 19:00
• 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. – gung - Reinstate Monica Oct 31 '18 at 19:09

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.