R psych包:计算加权kappa

R psych package: calculating weighted kappa

我对 R psych 包中加权 kappa 的行为感到有些困惑。我有五个 classes (1,2,3,4,5) 和三个注释器的数据。似乎每当一个特定的 class(比如说,1)只被一个注释者使用(导致 class 的一致矩阵对角线上的空值),心理抱怨:

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

有人可以告诉我我做错了什么吗?当至少两个注释器使用所有 classes 时,上面的代码有效。 谢谢!

dput(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))

需要可变性,因为 Kappa 会计算评估者间的可靠性并针对机会一致性进行更正。有两个未知数,没有可变性,无法计算。