# within-subjects design using lmer and random effect

M

#### marsh

##### Guest
I conducted a study with two crossed within-subjects factors. 44 subjects used a single interface for 6 rounds. Each round contained 3 trials, each with a different memory task condition (3 conditions in random order). So this makes a 3x6 design. There are generally large individual differences, so I'm using a random effects term for subject.

My current script has the following calls:
Code:
m1 = lmer(dist ~ condition*round + (1|id),data=data_dist)
print(anova(m1))
So first of all, is this lmer line reasonable? I'm not too sure how to deal with the random effects term for this repeated measures design. Should there be another random term, or is just the one subject term appropriate?

I've read and have some basic understanding of the issues involving p-values in lmer. My designs have been simple enough that I have usually computed my own denominator degrees of freedom and p-values followed accordingly. But again, this design with two within-subjects variables is confusing me. My current thinking is this for the degrees of freedom:
condition: 2
round: 5
interaction: 10
subject error: 43
error: 628
total: 688

Is this reasonable? If so, would I use 43 as the denominator dof for both condition and round?

I'm hoping I'm on the right track with this, but I just want to get some feedback before proceeding. Thanks in advance.

Last edited by a moderator:
M

#### marsh

##### Guest
After some more research, I've modified my lmer line to:
Code:
lmer(dist ~ condition*round + (1|id) + (1|condition:id) + (1|round:id),data=data_dist)
I think perhaps this is more correct now, though I'm not certain that the other way doesn't automatically include these extra terms. Is this correct and best practice?

Also I'm still not sure which dof to use. It seems with these extra terms that perhaps I need a couple more error dofs as well. Thoughts?

Last edited by a moderator: