# How to assign degrees of freedom for two-way ANOVA with two within-subjects factors?

I have an experiment with 44 subjects and two within-subject factors, condition (3 levels) and round (6 levels). It is fully crossed such that each person completes one of each task condition in each round. I have done the analysis (and ANOVA) in R using the lmer function. My lmer model is:

lmer(dist ~ condition*round + (1|id) + (1|condition:id) + (1|round:id),data=data_dist)


For various reasons that are described around the web, lmer doesn't provide denominator degrees of freedom and thus it doesn't compute p-values. Because my design is simple I would like to assign the degrees of freedom just as I would for any other repeated-measures ANOVA.

However, I have looked all over the web and can not find any resources for how to construct a repeated-measures ANOVA when both independent variables are within-subject. My current thinking for degrees of freedom is as follows:

condition: 2 (# of memory conditions - 1)
round: 5 (# of rounds - 1)
interaction: 10
subject error: 43 (# of subjects - 1)
error: 628
total: 688 (# of observations - 1)

I think I also need degrees of freedom for the two interactions from the model (condition:id and round:id). Also after I calculate these degrees of freedom, I am unsure which one should be used in the denominator for my p-values. Can somebody please point me in the right direction?

Thank you!

EDIT: My views have evolved. Here is my current idea:

subj: 43
cond: 2
subj X cond: 86?
rnd: 5
subj X rnd: 215?
cond X rnd: 10
err: 688 - all of above
tot: 688

What's confusing me now is if the DoF should equal the number of non-empty cells for those subj interactions. Keep in mind I'm using lmer from R and thus being unbalanced is not a problem. This means that some subjects did not experience some rounds, for example, so those cells are blank. Should the subj interaction DoF match the actual number of observations, or just be the product of the relevant DoFs?

I'm not sure I understand the question exactly, but if you are asking about the df for the two-way, factorial, within-subjects ANOVA, here they are:

• A = a - 1, where a = number of levels of A
• B = b - 1, where b = number of levels of B
• A x B = (a - 1)(b - 1)
• S = n - 1, where s = number of levels of S (i.e., number of subjects)
• A x S = (a - 1)(n - 1)
• B x S = (b - 1)(n - 1)
• A x B x S = (a - 1)(b - 1)(n - 1)

E.g.:

• A = cond (a = 3); B = rnd (b = 6); S (s = 44)

• dfA = 2
• dfB = 5
• dfA x B = 10
• dfS = 43
• dfA x S = 86
• dfB x S = 215
• dfA x B x S = 430
• I think there is a small error in the answer, the degrees of freedom for AxBxS should be (a-1)(b-1)(s-1) = 430. – user68813 Feb 12 '15 at 10:39