运行康格的卡帕

时间:2019-10-07 13:58:18

标签: r statistics r-haven

我需要在3个评估者的76个项目上运行Conger的kappa。此处的数据:

rater_df <- structure(list(Items = structure(c(1L, 12L, 23L, 34L, 45L, 56L, 
67L, 75L, 76L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 13L, 
14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 24L, 25L, 26L, 27L, 
28L, 29L, 30L, 31L, 32L, 33L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 
42L, 43L, 44L, 46L, 47L, 48L, 49L, 50L, 51L, 52L, 53L, 54L, 55L, 
57L, 58L, 59L, 60L, 61L, 62L, 63L, 64L, 65L, 66L, 68L, 69L, 70L, 
71L, 72L, 73L, 74L), .Label = c("Item1", "Item10", "Item11", 
"Item12", "Item13", "Item14", "Item15", "Item16", "Item17", "Item18", 
"Item19", "Item2", "Item20", "Item21", "Item22", "Item23", "Item24", 
"Item25", "Item26", "Item27", "Item28", "Item29", "Item3", "Item30", 
"Item31", "Item32", "Item33", "Item34", "Item35", "Item36", "Item37", 
"Item38", "Item39", "Item4", "Item40", "Item41", "Item42", "Item43", 
"Item44", "Item45", "Item46", "Item47", "Item48", "Item49", "Item5", 
"Item50", "Item51", "Item52", "Item53", "Item54", "Item55", "Item56", 
"Item57", "Item58", "Item59", "Item6", "Item60", "Item61", "Item62", 
"Item63", "Item64", "Item65", "Item66", "Item67", "Item68", "Item69", 
"Item7", "Item70", "Item71", "Item72", "Item73", "Item74", "Item75", 
"Item76", "Item8", "Item9"), class = "factor"), rater1 = c(0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, NA, 0L, 0L, 0L), rater2 = c(0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 1L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 1L, 0L, NA, 0L, 0L, 1L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), rater3 = c(0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 
1L, 1L, 0L, 1L, 0L, 1L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), Congers_kappa = c(NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA)), class = "data.frame", row.names = c(NA, 
-76L))

我使用了以下脚本,效果很好。但是,分数是0.46,我想看看如何为每个项目运行Conger的kappa,我可以在其中获得每个项目的分数,以确定在哪里可能存在评估者分歧。有任何线索吗?

library(haven)
library(rel)



#A numeric categories*categories matrix with custom weights 
cw <- diag(ncol(matrix(0,5,5)))
cw[cw!=diag(cw)] <- runif(20,0,1)

#Cohen's kappa with Fleiss corrected standard error formula
ckap(data=rater_df[,2:4], weight="unweighted", std.err="Cohen", conf.level = 0.95)

我想用三个评估者中每个项目的计算交叉表得分来填充Congers_kappa列。让我知道您是否需要更多细节。

0 个答案:

没有答案