I want to test the differences in my interval-scaled dependent variable - measured at three time intervals (within subj.), for two conditions (within subj.), while accounting for a interval-scaled covariate that has two values per subject (one per condition).

Sample size is low twenties. Data looks like this:

enter image description here What's the best way to go about testing this?

To my understanding, a typical repeated measures ANOVA struggles with this because the covariate has different values for the same person depending on the second within subject factor. I was wondering if a mixed model could accommodate the design, but my knowledge of lme4 is too limited.

Could someone share an insight?


1 Answer 1


It seems that this situation could be modeled with a mixed effects model, with crossed random effects (random intercepts) for Subject and Condition:

Outcome ~ Time + Covariate + (1| Subject) + (1|Condition)

However, since there appears to be a 1:1 correspondence between Covariate and Condition and your research question seems to be about the fixed effect of Covariate the random effect for Condition may not be needed (including it may not change the estimate for Covariate but it may reduce the precision of it).

  • $\begingroup$ Thank you for this helpful comment. However, I am also interested in the Fixed Effect of Condition. Could I just add it as an additional factor like this, or would this neglect the nesting of the covariate? Outcome ~ Time + Covariate + Condition + (1| Subject) $\endgroup$
    – bs92
    Commented May 16, 2019 at 13:05
  • $\begingroup$ Is there a 1:1 correspondence between Covariate and Condition which is implied by your sample data and your question where it says " (one per condition)". If so, that will result in a rank-deficient fixed effects model matrix, so you would have to just include Condition as a fixed effect. $\endgroup$ Commented May 16, 2019 at 13:17
  • $\begingroup$ Just to clarify, if Covariate and Condition are perfectly correlated, you can't include both of them as fixed effects (you can still include Time $\endgroup$ Commented May 16, 2019 at 16:18

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.