make posth-hoc test with repeated measure design in r

To conduct a post-hoc test with a repeated measure design in R, you can use the pairwise.t.test function. Here is an example code:

main.r
# Conducting a repeated measure ANOVA
rm_anova <- aov(value ~ group * time + Error(subject/(group*time)), data=my_data)

# Conducting pairwise t-tests with Bonferroni correction
pairwise.t.test(x = my_data$value, g = my_data$group, t.test = "paired", p.adjust.method = "bonferroni")
283 chars
6 lines

In the example code, my_data is the name of your data frame, group is the grouping variable, time is the repeated measure variable, and value is the dependent variable. The pairwise.t.test function will conduct pairwise comparisons between each level of the grouping variable with a Bonferroni correction to adjust for multiple comparisons.

gistlibby LogSnag