[R] Anova with repeated measures for unbalanced design

Ben Bolker bbolker at gmail.com
Sat Jan 8 21:39:20 CET 2011

Frodo Jedi <frodo.jedi <at> yahoo.com> writes:

> Dear all,
> I need an help because I am really not able to find over 
> internet a good example
> in R to analyze an unbalanced table with Anova with 
> repeated measures.
> For unbalanced table I mean that the questions are 
> not answered all by the same 
> number of subjects.
> For a balanced case I would use the command 
> aov1 = aov(response ~ stimulus*condition + 
>  Error(subject/(stimulus*condition)), 
> data=scrd)

  I recommend that you find a copy of Pinheiro and Bates 2000 ...

> Does the same code still work for unbalanced design?

  No, it doesn't.

> Can anyone provide a R example of code in order to get the same analysis?

  Something like

lme1 <- lme(response~stimulus*condition,random=~1|subject,data=scrd)

or possibly

lme1 <- lme(response~stimulus*condition,random=~stimulus*condition|subject,

if your experimental design would allow you to estimate stimulus and condition
effects for each subject.

  Further questions along these lines should probably go to
the r-sig-mixed-model mailing list.

More information about the R-help mailing list