首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >科恩的D与R中的对比度

科恩的D与R中的对比度
EN

Stack Overflow用户
提问于 2020-05-19 07:12:13
回答 1查看 233关注 0票数 0

有没有人能帮我理解一下如何从具有对比度的方差分析中计算出cohen's D?从向量或数据集计算cohen's D没有问题,但我不能从对比中找出如何计算。谢谢。

代码语言:javascript
复制
#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)
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-05-19 09:37:03

计算科恩的D的函数至少在三个不同的R包中,包括effsizerstatixpsych包。在aov()函数中没有专门用来计算科恩D的特性。

Cohen的D需要一个二分群变量。给定OP中的数据以及比较测试组和控制组的对比语句,我们将使用psych::cohen.d()比较测试组和控制组。

代码语言:javascript
复制
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) 

sample2 <- sample[sample$group != "other",]
sample2$group <- factor(sample2$group)
library(psych)
cohen.d(score ~ group, data = sample2)

对输出执行...and操作:

代码语言:javascript
复制
> cohen.d(score ~ group, data = sample2)

Cohen's d

d estimate: -3.114651 (large)
95 percent confidence interval:
    lower     upper 
-4.512240 -1.717062 
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61880546

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档