Here comes my case:

I conducted an experiment with the following design:

  • 30 participants, each with a unique id, were screened and classified according to a trait.
  • Then, all participants were tested in two conditions (in random order), and each outcome was measured for each limb of each participant (in random order as well).

Data structure:

$id        : Factor w/ 30 levels
$trait     : Factor w/ 2 levels "Y", "N"
$condition : Factor w/ 2 levels "CTL", "EXP"
$limb      : Factor w/ 2 levels "R", "L"
$outcome   : num

If we were to calculate whether the outcome differs between conditions or traits and their interaction, the left side and fixed terms of the lmer formula would be something like outcome ~ condition * trait.

And here comes when I need your expertise. So far, I believe that the random terms of my model should take into account that:

  • Participants (id) in each trait are completely different (Q1 Is id really nested within trait?)
  • Each trait/id has 4 related outcomes: 2 conditions (CTL, EXP) x 2 limbs (R, L). (Q2 Are trait/id, condition and limb crossed?)

After doing some research (1, 2, 3, 4, 5) I explored some alternatives:

m1 <- lmer(outcome ~ condition * trait + (1|id) + (1|limb) + (1|condition), data)

m2 <- lmer(outcome ~ condition * trait + (1|outcome/id) + (trait|limb) + (trait|condition), data)

m3 <- lmer(outcome ~ condition * trait + (1|condition/limb/id), data)

Note: m3 returns the following Error message: number of levels of each grouping factor must be < number of observations.

[EDITED:] No matter how many models I try, I am never sure about what terms would be reasonable to include as randoms. My main question then (Q3) is: should I specify, incorporating random effects, that there exist nested and crossed variables?

Furthermore, I have a last question (Q4): Would it make sense to initially include limb as a fixed term, to explore possible differences between hemispheres, and in case of not finding any limb differences continue the analisis modelling it as random?

I would really appreciate if some of you could point me in the right direction...

  • 5
    $\begingroup$ I'm voting to reopen this question because the aspect of how to translate a specific experimental design into possible random effects is a statistical question that is largely independent of the software used. $\endgroup$ Jun 10, 2018 at 12:06
  • 2
    $\begingroup$ I can see why you might want a random intercept (for id) but why the others? I would certainly have included trait, limb and condition only as fixed effects myself but perhaps there is something here which you have not explained. I agree with @COOLSerdash by the way so I voted to reopen too. $\endgroup$
    – mdewey
    Jun 10, 2018 at 13:05
  • $\begingroup$ Thanks @COOLSerdash and @mdewey for your comments and support. @mdewey, In case of not being interested in the differences between limbs, wouldn't it make sense to consider it as a random effect? Is just adding (1|id) the proper way to indicate that certain degree of variability might come from the existence of crossed variables? I really appreciate your comment! $\endgroup$
    – rcirer
    Jun 10, 2018 at 16:17
  • 1
    $\begingroup$ The maximal model (under assumption that you don't expect any consistent differences between R and L limbs) is outcome ~ condition * trait + (condition | id). Most of the models that you "explored" don't make any sense and show that you don't really know what you are doing. It might make sense to study mixed models more systematically before you proceed. $\endgroup$
    – amoeba
    Jun 11, 2018 at 7:57
  • 1
    $\begingroup$ OK. Then I think the maximal model is outcome ~ condition * trait * limb + (condition | id) + (1 | id:limb). Regarding some of the models in your question: ( ... | limb) does not make sense because limb has only 2 levels. ( ... | condition) does not make sense for the same reason. ( ... | outcome) does not make sense because it's the dependent variable. (trait | ...) does not makes sense because trait is between-subject variable. $\endgroup$
    – amoeba
    Jun 12, 2018 at 9:00


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.