# [R] Post hoc analysis for ANOVA with repeated measures

Frodo Jedi frodo.jedi at yahoo.com
Sun Jan 9 13:10:10 CET 2011

```Dear all,
how can I perform a post hoc analysis for ANOVA with repeated measures (in
presence of a balanced design)?
I am not able to find a good example over internet in R...is there among you
someone so kind to give
me an hint with a R example please?

For example, the aov result of my analysis says that there is a statistical
difference between stimuli (there are 7 different stimuli).
...I would like to know which stimuli are involved.

> aov1 = aov(response ~ stimulus*condition + Error(subject/(stimulus*condition)),
>data=scrd)
> summary(aov1)

Error: subject
Df Sum Sq Mean Sq F value Pr(>F)
Residuals 14 227.57  16.255

Error: subject:stimulus
Df Sum Sq Mean Sq F value  Pr(>F)
stimulus   6 11.695 1.94921  2.3009 0.04179 *
Residuals 84 71.162 0.84717
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Error: subject:condition
Df Sum Sq Mean Sq F value   Pr(>F)
condition  1 42.076  42.076  12.403 0.003386 **
Residuals 14 47.495   3.393
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Error: subject:stimulus:condition
Df Sum Sq Mean Sq F value Pr(>F)
stimulus:condition  6  9.124  1.5206  1.4465 0.2068
Residuals          84 88.305  1.0513
>

In attachment you find the table I am using, you can access it by means of:
scrd<-

The data are from an experiment where participants had to evaluate on a seven
point likert scale
the realism of some stimuli, which are presented both in condition "A" and in
condition "AH".