有人可以帮助我了解如何从具有对比的 ANOVA 计算科恩的 D 吗?我从向量或数据集计算科恩的 D 没有问题,但无法从对比中弄清楚如何做到这一点。谢谢。
#Create data frame
group = c("treatment","treatment","treatment","treatment","treatment","treatment","treatment","treatment","treatment","treatment",
"control","control","control","control","control","control","control","control","control","control",
"other","other","other","other","other","other","other","other","other","other")
score = c(7,8,9,10,7,8,9,10,7,8,
6,5,4,6,5,4,6,5,4,6,
3,2,1,3,2,1,3,2,1,3)
sample =data.frame(group,score)
#Set contrasts
contrast = c(-1,0,1)
#Bind contrasts
contrasts(sample$group) = cbind(contrast)
#Check contrasts
contrasts(sample$group)
#Run ANOVA w/ contrasts
aov1 = aov(score ~ group, sample)
summary.lm(aov1)