Dear Thilo Thanks for your suggestion. I guess the model you are fitting here has only a single random effect term, namely subject. If the effect of A depends on S, one needs to include an additional random effects term for the S:A interaction.
With lme I can get output for the effect of A which is very similar to the aov output using lme( y ~ A + B, random=~ 1|S/A ) but here I have cheated by not including factor B in the 'random=' terms. But the output from anova( lme( y ~ A + B, random=~ 1|S/A ) ) is numDF denDF F-value p-value (Intercept) 1 54 388.4006 <.0001 B 2 54 154.0193 <.0001 A 1 13 4.4581 0.0547 where the last line appears equivalent to the aov output: Error: Subject:Treatment Df Sum Sq Mean Sq F value Pr(>F) A 1 0.66074 0.66074 4.4581 0.05467 . Residuals 13 1.92676 0.14821 But I still need to account for the random S:B interaction. I can see a similar issue has been discussed earlier, see eg https://stat.ethz.ch/pipermail/r-help/2006-August/111018.html Here, lme( y ~ A*B, random=~1|S ) was also suggested (essentially), but this gives quite different results from aov and the lme example above. In this particular case I get numDF denDF F-value p-value (Intercept) 1 67 388.3976 <.0001 B 2 67 104.8436 <.0001 A 1 67 10.3707 0.002 I have seen instances of something like random=list(S=pdBlocked(list(pdIdent(~A-1)..., but I can't get this to work (and I have no idea what this does). Best regards, Kim. 2007/1/12, Thilo Kellermann <[EMAIL PROTECTED]>: > Dear Kim, > as far as I understandyour problem correct the specification of the model in > lme is: > > lme( fixed=y ~ A*B, random=~1|S) > > Thilo > > On Friday 12 January 2007 15:54, Kim Mouridsen wrote: > > 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. > > > > ______________________________________________ > > R-help@stat.math.ethz.ch mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html and provide commented, minimal, > > self-contained, reproducible code. > > -- > ________________________ > Thilo Kellermann > Department of Psychiatry und Psychotherapy > RWTH Aachen University > Pauwelstr. 30 > 52074 Aachen > Tel.: +49 (0)241 / 8089977 > Fax.: +49 (0)241 / 8082401 > E-Mail: [EMAIL PROTECTED] > > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.