# Justifying terms taken as random at different levels in a mixed-model in R (study design and code provided)

I'm following up on this question. In short, imagine in a 3-wave, longitudinal study, two therapists both get to deliver the treatment and the control arms of the study to a different set of subjects (see the study design below).

The accepted answer mentions that for the study design shown below, the following (see The Suggested Model Syntax below) can be a reasonable model syntax (using R's lme4 package). In the following syntax, tx is a binary treatment indicator (0=control, 1=treatment).

Question: Let's focus on the terms to the left of | (i.e., time & time * tx), how can we justify the use of (time | subjects) and (time * tx | therapists)?

Stated differently, given the study design below, why should we estimate the random slope of time for subjects, but then the random slope of time * tx for therapists? What effects are being measured or disentangled from one another using these two terms in this particular design?

ps1. Why not (time * tx | therapists/subjects) OR (time | therapists/subjects)?

ps2. Does it have any effect on the model syntax to know that we have EITHER randomly assigned the therapists or subjects OR NOT in the below design?

# The Suggested Model Syntax:

lmer(y ~ time * tx +                      ## DON'T RUN
(time | subjects) +
(time * tx | therapists),
data = data)


why should we estimate the random slope of time for subjects, but then the random slope of time * tx for therapists.

We may be justified in fitting random slopes for a variable if we have sound theoretical a priori reasons for believing that the variable will vary by the relevant grouping term.

In this design, clearly time varies within subjects so it is natural to think of fitting random slopes - this allows each subject to have their own slope for time. On the other hand, treatment does not vary with subject, so it would not make sense to fit random slopes for it. So (time | subjects) makes sense.

Treatment and time both vary with therapists, so again it would be reasonable to fit random slopes for both, hence time * tx | therapists makes sense, and in this case we allow for covariance between the random effects.

ps. Why not (time * tx | therapists/subjects) OR (time | therapists/subjects)?

The latter would be fine (both these random slopes are included in the main model anyway). however the former would not make sense because it would be ftting random slopes for treatment by subject (treatment does not vary within subject).

In short, in this design, treatment and time can both be random slopes within therapist but only time can be a random slope within subjects.

• Thank you, Rob! Two clarification/follow-up questions. First, in the above design is there a way (via model syntax) to disentangle the effect of treatment on subjects from the effect of therapists on subjects? Second, does it have any effect on the model syntax to know that either the therapists or subjects in the above design have OR have not been randomly assigned to the two available treatment conditions? Dec 6, 2020 at 17:35
• Dear Rob, I'm assuming my ps2. question falls outside your area of interest, correct? Dec 8, 2020 at 18:56
• Sorry didn't notice the comment. As for the 2nd question, no. As for the 1st, I think this was put into a new question already. Dec 9, 2020 at 4:22