首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >‘.`.rowNamesDF<-’(x,value = value)中的cohen.d错误:无效的'row.names‘长度

‘.`.rowNamesDF<-’(x,value = value)中的cohen.d错误:无效的'row.names‘长度
EN

Stack Overflow用户
提问于 2019-12-25 10:29:37
回答 3查看 1.4K关注 0票数 1

在使用心理学中的cohen.d函数计算效果大小时,我得到以下错误。请参阅下面的示例数据。

代码语言:javascript
运行
复制
library(psych)
x <- c(1, 2, 3, 4, 5, 6, 7, 8)
y <- c(1, 1, 1, 1, 2, 2, 2, 2)
xy <- data.frame(x,y)
names(xy) <- c("x", "group")
CohensD <- cohen.d(xy, "group", alpha=.05)

.rowNamesDF<-(x,value = value)中的错误:无效的“row.names”长度

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2019-12-25 11:13:56

可能有一个错误,因为它在1.8.12中工作得很好,它也会生成同样的错误

代码语言:javascript
运行
复制
cohen.d(sat.act[1:8, c('education','gender')], "gender")

但不是和

代码语言:javascript
运行
复制
cohen.d(sat.act[1:8, c('education','gender','age')], "gender")

因此,应该可以很好地处理有两个以上列的数据帧。

代码语言:javascript
运行
复制
x <- c(1, 2, 3, 4, 5, 6, 7, 8)
y <- c(1, 1, 1, 1, 2, 2, 2, 2)
xy <- data.frame(x=x, group=y, z=rnorm(8))
cohen.d(xy, "group")

Call: cohen.d(x = xy, group = "group")
Cohen d statistic of difference between two means
  lower effect upper
x  0.53   3.58  6.60
z -0.71   0.88  2.37

Multivariate (Mahalanobis) distance between groups
[1] 3.6
r equivalent of difference between two means
   x    z 
0.87 0.40 
票数 2
EN

Stack Overflow用户

发布于 2019-12-31 21:38:47

这确实是我在向cohen.d添加Mahalabonis距离时引入的一个bug。修复在我的服务器上可用的psych_1.9.12.21中可用。您可以从那里安装它:

代码语言:javascript
运行
复制
install.packages("psych",repos="http://personality-project.org/r",type="source")

我将发布这个修补版本的CRAN,一旦它回来下周回来。在此期间,如果您不需要修补版本,只需使用包含两个以上列的数据集(正如A. Suliman所指出的)。

票数 1
EN

Stack Overflow用户

发布于 2021-04-10 16:44:47

你应该使用有效的包装,而不是心理。

Install.packages(“效应”)

图书馆(有效)

然后,使用咖啡豆。d。

X <- c(1、2、3、4、5、6、7、8)

Y <- c(1,1,1,1,2,2,2,2)

cohen.d(x,y)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59477475

复制
相关文章

相似问题

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