I'm following up on this question and this answer. The answer mentions that without having a clear study design, understanding whether the random-effects specified in an lmer()
model syntax are CROSSED or NESTED is not possible.
Therefore, in this thread, I want to visually provide a couple of study designs as well as their suggested model syntax (from this blogpost) and learn how the model syntax may match up with the study design in terms of CROSSED or NESTED random-effects defined in them. In the following syntax, tx
is a binary treatment indicator (0=control, 1=treatment).
DESIGN 1:
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.
The suggested lmer()
model syntax is (Q: How does this model syntax match up with DESIGN 1?):
lmer(y ~ time * tx + ## DON'T RUN
(time | therapist:subjects) +
(time * tx || therapist),
data = data)
DESIGN 2:
Imagine in a 3-wave, longitudinal study, two therapists both get to deliver ONLY the treatment arm of the study to different subjects. The control arm subjects will NOT meet any therapist at all.
The suggested lmer()
model syntax is (Q: How does this model syntax match up with DESIGN 2?):
lmer(y ~ time * tx + ## DON'T RUN
(1 | therapist:subjects) +
(0 + time | therapist:subjects) +
(0 + time:tx | therapist) +
(0 + tx | therapist),
data = data)