Consider a pure repeated measures design, with (let's say) 3 experimental within-subject factors A, B, and C, and (for simplicity) 2 levels per factor. So we have 2*2*2 = 8 measurements per subject.

Now I would like to test the fixed effects with a linear mixed effects model. I have read in several sources (for example Andy Field's Book "Discovering Statistics using R", and this site: http://www.jason-french.com/tutorials/repeatedmeasures.html ) that with lme, one should use the following syntax:

model <- lme(dv ~ A*B*C, random = ~1|id/A/B/C)

However, I do not understand why you would "nest" the factors within the subject in the random part of the model, and not just use (1|id). What is the point of this, and what does it do?

Conceptually, I don't understand why one would nest the experimental fixed factors within the random subject factor. The way I understood nesting until now, you would only use it to account for the fact that certain lower factor levels only exist within certain higher factor levels - like pupils within classes within schools within cities, etc. How does this apply to a repeated measures design with fully crossed within-subject factors?

Mathematically, the way I understood this is that such a model would first estimate a random intercept for each subject, capturing random differences in the average values of the dependent variable between subjects. So in the case of, (let's say) 20 subjects, we get 20 different random intercepts. Then, apparently, the model estimates random intercepts for each combination of subject and level of factor A (resulting in 40 random intercepts), then for each combination of subject, factor A and factor B (80 random intercepts), all the way down to the most specific level, where we get as many estimated random intercepts as we have measurements (160). What is the point of this, and why would we not only estimate a random intercept per subject (1|subject)? Also, wouldn't all of these random intercepts together explain the dependent variable nearly perfectly, and leave little to nothing to be explained by the fixed effects?

Lastly, my intuition tells me that these random intercepts should at least partially explain the same information as would be captured by entering random slopes of the experimental factors into the model. Is that correct?

  • $\begingroup$ Try to write models mathematically, then comparing them with your real situation to see which one is more reasonable. $\endgroup$ – user158565 Jun 13 '17 at 1:35
  • 1
    $\begingroup$ This is a purely theoretical question - I don't have a specific real situation. What I am interested in is why this is recommended as a standard way to analyze repeated measures data (at least by some authors), and what it means conceptually and mathematically to have a random intercept on each of these levels of "nested" experimental factors. $\endgroup$ – Lukas McLengersdorff Jun 13 '17 at 9:11
  • 2
    $\begingroup$ +1. This is an excellent question. It's very closely related to something I asked here some time ago: stats.stackexchange.com/questions/232109 - but unfortunately there is no satisfactory answer in that thread (existing answers might only add to the confusion, so be careful). I am planning to write an answer there myself at some point, but I still need to do some investigations beforehand... $\endgroup$ – amoeba Jun 14 '17 at 21:19
  • 1
    $\begingroup$ Still, some partial answers. (i) You are right, nothing is really "nested" here. We use the "nesting operator" because we want to have (1|id) + (1|id:A) + (1|id:B) + (1|id:A:B) + ... etc. structure, but it would not be correct to say that A,B,C are nested in subjects. They are not. (ii) We want (1|id) + (1|id:A) + ... structure because it mimics the approach of repeated measures ANOVA (RM-ANOVA). I can't properly explain why RM-ANOVA does that though. (iii) Yes, you can have random slopes (A*B*C - A:B:C | id) instead. But it's very different model when A,B,C have many levels. $\endgroup$ – amoeba Jun 14 '17 at 21:23
  • $\begingroup$ Thanks! I did some research myself in the meantime, and found that with lme4, you can nearly perfectly replicate the RM ANOVA (with three factors A,B,C, like in my example) with the model 'y~ABC + (1|id) + (1|id:A) + (1|id:B) + (1|id:C) + (1|id:A:B) + (1|id:A:C) + (1|id:B:C)'. Or, put more simply, a random intercept for subject, plus a random intercept for every interaction of subject and every main effect and interaction of the within-subject factors, except for the highest order interaction. $\endgroup$ – Lukas McLengersdorff Jul 10 '17 at 15:20

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.