Solved – When to include random slopes in linear mixed models

lme4-nlmemixed model

I'm running a few LMMs and I am finding that I don't quite understand when to include random slopes. I'm worried that my models will be wildly inaccurate and inflate the type I error rate.

First example: I'm testing whether condition (2 levels) affects reaction time and I'm using a mixed model because 1) subjects completed numerous trials on which reaction time was measured, so I want to include random intercepts for subjects, and 2) the reaction time data are from a task that includes two trial types that are not of relevance to the hypothesis, so I want to control for that by including trial type as a fixed effect.

Condition was manipulated within subjects. This is where I start to get confused. I plan to model condition as a fixed effect, like so:

lmer(RT ~ trialtype + condition + (1|subject), data=df, REML=F)

but is it also imperative that I include random slopes for subjects by condition like so?

lmer(RT ~ trialtype + condition + (1+condition|subject), data=df, REML=F)

(Note, to test my model I will compare this to a reduced model that drops the fixed effect of condition. Same is true for the following examples.)

Second example: I'm testing whether a measure of X predicts RT within one condition, which is different measure of X. I set this up like so:

lmer(cond2_RT ~ trialtype + Xmeasure + (1|subject), data=df, REML=F)

But I'm not sure if I should be including random slopes for subjects, like so:

lmer(cond2_RT ~ trialtype + Xmeasure + (1+Xmeasure|subject), data=df, REML=F)

I've read that it's important to include random slopes when you are testing the effect of some variable in order to control the type I error rate, but in this case I'm confused because Xmeasure is a predictor, not a manipulated variable and I don't know that I expect the relation between Xmeasure and cond2_RT to vary by subject. Am I thinking about this incorrectly?

Third and final example: I also want to test whether condition interacts with Xmeasure to predict RT. Here is how I've set this up:

lmer(cond2_RT ~ trialtype + Xmeasure*condition + (1+condition|subject), data=df, REML=F)

But again, I'm not sure if I should also be modeling random subject slopes for Xmeasure and also the interaction between condition and Xmeasure. I'm worried about including too much in the model, and also about not being able to justify the inclusion of these slopes. But I don't want to leave anything out that is crucial.

Thanks in advance for any suggestions!

Best Answer

If you have real doubt about whether or not random slopes would improve your model for whatever purpose you're putting it to, you don't need to decide in advance. Instead, use a generic model-selection technique, such as estimating predictive accuracy with cross-validation and selecting the most predictively accurate model. Just make sure that whatever design you want to consider is identifiable.