在使用心理学中的cohen.d函数计算效果大小时,我得到以下错误。请参阅下面的示例数据。
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”长度
发布于 2019-12-25 11:13:56
可能有一个错误,因为它在1.8.12
中工作得很好,它也会生成同样的错误
cohen.d(sat.act[1:8, c('education','gender')], "gender")
但不是和
cohen.d(sat.act[1:8, c('education','gender','age')], "gender")
因此,应该可以很好地处理有两个以上列的数据帧。
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
发布于 2019-12-31 21:38:47
这确实是我在向cohen.d添加Mahalabonis距离时引入的一个bug。修复在我的服务器上可用的psych_1.9.12.21中可用。您可以从那里安装它:
install.packages("psych",repos="http://personality-project.org/r",type="source")
我将发布这个修补版本的CRAN,一旦它回来下周回来。在此期间,如果您不需要修补版本,只需使用包含两个以上列的数据集(正如A. Suliman所指出的)。
发布于 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)
https://stackoverflow.com/questions/59477475
复制相似问题