我想做一个重复测量方差分析的TukeyHSD事后检验,输入公式“TukeyHSD”返回错误,我在论坛中找不到答案,我可以寻求帮助吗?
“treat”是重复测量因子,“vo2”是因变量。
下面是产生此错误的脚本:
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)
1条答案
按热度按时间k97glaaz1#
TukeyHSD()
无法处理重复测量ANOVA的aovlist
结果。作为替代方法,您可以使用lme4::lmer()
拟合等效混合效应模型,然后使用multcomp::glht()
进行事后检验。混合效应模型的ANOVA表与重复测量ANOVA结果的比较表明,两种方法在处理
treat
变量的方式方面是等效的: