I would like to do Tukey HSD post hoc tests for a repeated measure ANOVA. The entered formula "TukeyHSD" returns me an error. I can't find the answer in the forum. Can I ask for help?
"treat" is repeated measures factor, "vo2" is dependent variable.
Below is a script that is producing this error:
my_data <- data.frame(
stringsAsFactors = FALSE,
id = c(1L,2L,3L,4L, 5L,1L,2L,3L,4L,5L,1L,2L,3L,4L,5L,1L,2L,3L,4L,5L),
treat = c("o","o","o","o","o","j","j","j","j","j","z","z","z","z","z","w","w","w","w","w"),
vo2 = c("47.48","42.74","45.23","51.65","49.11","51.00","43.82","49.88","54.61","52.20","51.31",
"47.56","50.69","54.88","55.01","51.89","46.10","50.98","53.62","52.77"))
summary(rm_result <- aov(vo2~factor(treat)+Error(factor(id)), data = my_data))
TukeyHSD(rm_result, "treat", ordered = TRUE)