2
$\begingroup$

I am considering a design where the dependent variable ('DV') is measured in each subject ('Sub') for each level of three factors ('TH', 'A', and 'B'). From what I understand this is a repeated measures design, and 'TH', 'A', and 'B' are within subject factors (since all levels of these factors are considered for each subject). In addition, 'Sub', 'TH', 'A', and 'B' are "crossed" for the same reason.

I am trying to fit linear mixed effect models in R using lme4 to test the effect of 'TH' (therapy) on 'DV'. I am including random effects to account for the dependence of within-subject measurements. The challenges for me are to figure out which random terms to include in the model, and to use the correct syntax.

I have read various sources, and have found particularly helpful the documentation of lme4 (p6-7), and this answer. My model attempts are as follows.

m1 = lmer(DV ~ A*B*TH + (1|sub), data=df)

This model includes random intercepts for each level of 'sub'.

m2 = lmer(DV ~ A*B*TH + (1+TH|sub), data=df)

Here, I have added a random slope for 'TH' within each level of 'sub'. This notation implies that deviations from the global slope and global intercept are correlated.

m3 = lmer(DV ~ A*B*TH + (1|sub) + (0+TH|sub), data=df)

Same thing, but the correlation mentioned above is forced to zero.

m4 = lmer(DV ~ A*B*TH + (1+A+B+TH|sub), data=df)
m5 = lmer(DV ~ A*B*TH + (1+A*B*TH|sub), data=df)

More random slopes can be added for each fixed effect factor (m4), and also for their interactions (m5). These models cannot be fitted successfully to my data ("boundary (singular) fit: see ?isSingular").

m6 = lmer(DV ~ A*B*TH + (1|sub) + (1|A:sub) + (1|B:sub) + (1|TH:sub), data=df)

This model is suggested here and here, and I understand it as having random intercepts for interactions between my within-subject factors and 'sub'.

How to choose which random effects should be included in the model to reflect the dependency structure in my design? Is m1 a fair model to test the effect of 'TH' (therapy) on 'DV' given my repeated measures design?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.