如何计算Krippendorf在R中的Alpha的置信度?

时间:2017-01-30 20:20:08

标签: r confidence-interval

我确信这是Bootstrapping Krippendorff's Alpha的结果。但我不明白这个问题,也没有答案。看起来甚至答案和评论都是相互矛盾的。

set.seed(0)
df <- data.frame(a = rep(sample(1:4),10), b = rep(sample(1:4),10))
kripp.alpha(t(df))

这是输出。

 Krippendorff's alpha

 Subjects = 40 
   Raters = 2 
    alpha = 0.342 

如何在此计算置信区间?

1 个答案:

答案 0 :(得分:3)

你是对的,它连接到bootstrapping。您可以通过以下方式计算置信区间:

 library(irr)
 library(boot)

 alpha.boot <- function(d,w) {
        data <- t(d[w,])
        kripp.alpha(data)$value
 }

 b <- boot(data = df, statistic = alpha.boot, R = 1000)
 b
 plot(b)
 boot.ci(b, type = "perc")

这是输出:

 Bootstrap Statistics :
      original      bias    std. error
 t1* 0.3416667 -0.01376158   0.1058123

 BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
 Based on 1000 bootstrap replicates

 CALL : 
 boot.ci(boot.out = b, type = "perc")

 Intervals : 
 Level     Percentile     
 95%   ( 0.1116,  0.5240 )  
 Calculations and Intervals on Original Scale

还有来自Zapf等人的R脚本。 2016 look for Additional file 3 at the bottom of the page just before the references

或者您可以使用github MikeGruz/kripp.boot

上提供的kripp.boot函数