[R] repeated measures anova, car package

John Fox jfox at mcmaster.ca
Tue Mar 2 03:52:39 CET 2010

Dear Kay,

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
> Behalf Of Kay Cichini
> Sent: March-01-10 10:45 AM
> To: r-help at r-project.org
> Subject: [R] repeated measures anova, car package
> Hello list,
> I' d very much appreciate some help with a two sample repeated measures
> I did the analysis yielding sign. main effects (between subj.=site, within
> subj.=cover) and a sign. interaction:
> Univariate Type II Repeated-Measures ANOVA Assuming Sphericity
>                 SS num Df Error SS den Df       F   Pr(>F)
> site       18.7620      1   18.831     10  9.9631 0.010220 *
> cover       6.4481      1   16.462     10  3.9169 0.075984 .
> site:cover 19.2963      1   16.462     10 11.7216 0.006507 **
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> But then I was interested in the significance of the within factor in each
> of the levels of the between factor.
> Also, I'm a bit confused if the type of SS does play a role here - I choose
> the default, the design is balanced.
> In despair of a better solution I did two seperate paired t-tests on each
> level, but I guess that's not the best solution.
> Thanks for any advise,
> Kay Cichini

In this case, the repeated-measures ANOVA is equivalent to analyzing the sum and difference of the two measures on cover. If you really want to test for the difference between the two levels of cover in each level of site, then the paired t-tests are perfectly reasonable. You could also these test hypotheses this using the car functions, e.g., by fitting the model mod <-  lm(cbind(cover1, cover2) ~ site - 1, data=Data), which would fit a means model for site rather than use an intercept and dummy-coded contrast. Then you can use the linear.hypothesis() function to test each of the two hypotheses -- e.g., linear.hypothesis(mod, "siteA", P=matrix(c(1, -1)). I'm making up the level name for site (A) and the names of the repeated-measures variables (cover1, cover2) because you didn't say what they are.

Because there's just one between-subjects factor, there's no distinction between type-II and -III tests, as you would have discovered had you tried both.

I hope this helps,

> --
> View this message in context: http://n4.nabble.com/repeated-measures-anova-
> car-package-tp1573721p1573721.html
> Sent from the R help mailing list archive at Nabble.com.
> ______________________________________________
> R-help at r-project.org 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.

More information about the R-help mailing list