[R] Within-subject factors in lme

Kim Mouridsen kim.mouridsen at gmail.com
Fri Jan 12 15:54:49 CET 2007


Dear R-users

I'm considering a repeated measures experiment where two
within-subject factors A (2 levels) and B (3 levels) have been
measured for each of 14 subjects, S. I wish to test the effect of
factor A. I know that a variance component model with random effects
S, S:A, S:B and S:A:B can be fitted using aov:

aov( y ~ A*B + Error(S/(A*B)) )

If there is no significant interaction, the test for the effect of A
is carried out in the S:A error strata.

How can a test for the effect of A be performed using lme from the nlme package?

( lme( y ~ A*B, random=~1|S/(A*B)) is apparently not correct )

Thanks in advance for your advice.
Kim.



More information about the R-help mailing list