我对R psych包中加权kappa的行为感到有些困惑。我有五个类(1,2,3,4,5)和三个注释器的数据。似乎只要一个特定的类(比如1)只被一个注释器使用(导致该类的协议矩阵的对角线上的空值),心理就会抱怨:
library(psych);
df2 <- read.table('classes/WB/mcrae.quants.features.time.numeric', sep='\t');
cohen.weights <- matrix(c(0,5,35,95,100,5,0,30,90,95,35,5,0,60,65,95,90,60,0,5,100,95,65,5,0),ncol=5);
cohen.kappa(df2,cohen.weights)
Error in `rownames<-`(`*tmp*`, value = c("2", "3", "4", "5")) :
length of 'dimnames' [1] not equal to array extent
Calls: cohen.kappa -> cohen.kappa1 -> rownames<-
Execution halted
我的数据如下:
5 3 3
5 3 3
5 4 3
5 4 3
3 3 3
5 4 4
3 4 4
3 3 3
2 3 2
...
1 3 4
有人可以告诉我,我做错了什么吗?当至少两个注释器使用所有类时,上面的代码可以工作。 谢谢!
输出(df2):
structure(list(V1 = c(5L, 5L, 5L, 5L, 3L, 5L, 3L, 3L, 2L, 4L,
3L, 4L, 3L, 4L, 5L, 3L, 5L, 5L, 3L, 5L, 3L, 5L, 3L, 5L, 4L, 5L,
5L, 5L, 5L, 3L, 4L, 4L, 5L, 5L, 5L, 3L, 3L, 5L, 5L, 5L, 5L, 3L,
3L, 5L, 5L, 3L, 4L, 3L, 4L, 3L, 5L, 5L, 4L, 3L, 5L, 5L, 5L, 5L,
5L, 3L, 3L, 5L, 5L, 5L, 5L, 5L, 4L, 3L, 5L, 5L, 5L, 5L, 4L, 4L,
4L, 5L, 4L, 4L, 3L, 3L, 5L, 3L, 4L, 3L, 5L, 1L), V2 = c(3L, 3L,
4L, 4L, 3L, 4L, 4L, 3L, 3L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 4L, 4L,
3L, 5L, 4L, 4L, 5L, 5L, 3L, 3L, 3L, 4L, 4L, 3L, 4L, 3L, 3L, 4L,
4L, 3L, 4L, 5L, 4L, 4L, 3L, 4L, 3L, 3L, 4L, 3L, 4L, 3L, 4L, 4L,
5L, 4L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 3L, 4L, 4L,
4L, 4L, 4L, 4L, 5L, 3L, 4L, 4L, 3L, 4L, 4L, 3L, 3L, 3L, 4L, 3L,
3L, 3L, 4L, 3L), V3 = c(3L, 3L, 3L, 3L, 3L, 4L, 4L, 3L, 2L, 3L,
2L, 3L, 3L, 3L, 4L, 2L, 3L, 4L, 3L, 3L, 4L, 4L, 5L, 5L, 4L, 3L,
3L, 3L, 5L, 3L, 3L, 4L, 4L, 4L, 3L, 3L, 4L, 4L, 4L, 4L, 3L, 4L,
4L, 4L, 4L, 4L, 3L, 5L, 4L, 3L, 5L, 4L, 3L, 4L, 5L, 5L, 4L, 3L,
5L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 4L, 4L, 3L, 3L, 4L, 4L,
3L, 4L, 4L, 4L, 3L, 3L, 4L, 3L, 3L, 3L, 3L, 4L)), .Names = c("V1",
"V2", "V3"), class = "data.frame", row.names = c(NA, -86L))
答案 0 :(得分:0)
需要变化,因为Kappa计算了评估者间的可靠性并纠正了机会协议。有两个未知数,没有可变性,无法计算。