# Post hoc test for repeated measurements ANOVA

Hi everyone,
I am quite new in R and trying to find my way around, which worked well so far. My question might be also a bit statistical, but I hope I am still right here. I have a dataset of residues from different plots(Repetitions) on several days (DAA- 0-5) and would like to show whether there are statistical differences in residues from day to day. As I have collected samples from the same plots each day, I have tried to run an ANOVA with repeated measurements. I found two codes for doing this, which seem to be alright, but I struggle to perform a multiple paired t- test after the anova, to show where the day-to-day differences are.
My data:

`````` Sample                   DAA   Repetition Residues
<chr>                    <fct> <fct>         <dbl>
1 Cyp SF DIL1000 Day 0-1   0     1             161.
2 Cyp SF DIL1000 Day 0-2   0     2             206.
3 Cyp SF DIL1000 Day 0-3   0     3             263.
4 Cyp SF DIL1000 Day 0-4   0     4             278.
5 Cyp SF DIL1000 Day 0-5   0     5             301.
6 Cyp SF DIL1000 Day 1-1   1     1              62.0
7 Cyp SF DIL1000 Day 1-2   1     2             115.
8 Cyp SF DIL1000 Day 1-3   1     3              98.6
9 Cyp SF DIL100 Day 1-4rep 1     4              75.2
10 Cyp SF DIL100 Day 1-5rep 1     5              80.9
# ... with 17 more rows
``````
``````summary(Poll)
Sample          DAA   Repetition    Residues
Length:27          0:5   1:6        Min.   :  4.505
Class :character   1:5   2:5        1st Qu.: 16.443
Mode  :character   2:5   3:6        Median : 25.079
3:5   4:6        Mean   : 72.547
4:4   5:4        3rd Qu.: 89.786
5:3              Max.   :300.541
>
``````

The codes I have tried for the repeated measurements anovas:

``````within.aov <- anova_test(data = Poll, Residues ~ DAA, within = DAA, type = 3, white.adjust = TRUE)
``````

Output:

``````Coefficient covariances computed by hccm()
> get_anova_table(within.aov)
ANOVA Table (type III tests)

Effect DFn DFd      F        p p<.05
1    DAA   5  21 42.518 2.75e-10     *
``````
``````test<-aov(Residues~DAA+Error(Repetition/DAA), data=Poll)
summary(test)
``````

output:

``````Error: Repetition
Df Sum Sq Mean Sq F value Pr(>F)
DAA        2   6130  3064.8   3.347   0.23
Residuals  2   1831   915.6

Error: Repetition:DAA
Df Sum Sq Mean Sq F value   Pr(>F)
DAA        5 189056   37811   51.16 1.19e-09 ***
Residuals 17  12565     739
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
``````

The t test I have tried:

``````pairwise.t.test(x=Poll\$Residues, g=Poll\$DAA, paired=T)
``````

Which gave the following error:

``````> pairwise.t.test(x=Poll\$Residues, g=Poll\$DAA, paired=T)
Error in complete.cases(x, y) : arguments have not the same length
``````

I assume that happens because I have less repetitions on DAA 4 and 5, but I am not sure how to solve this issue. Is there another test I could use?
Many thanks for any comments or tips, and I hope I have posted everything in the right format!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.