# 1. Nominal ratings, 4 raters, 12 units (from Krippendorff 2011 Tab. 1):
ratings <- matrix(c(
1, 2, 3, 3, 2, 1, 4, 1, 2, NA, NA, NA,
1, 2, 3, 3, 2, 2, 4, 1, 2, 5, NA, 3,
NA, 3, 3, 3, 2, 3, 4, 2, 2, 5, 1, NA,
1, 2, 3, 3, 2, 4, 4, 1, 2, 5, 1, NA
), nrow = 12, ncol = 4)
krippendorff_alpha(ratings, level = "nominal")
# 2. Interval ratings:
set.seed(113)
r1 <- rnorm(30, 0, 1)
r2 <- r1 + rnorm(30, 0, 0.3)
krippendorff_alpha(cbind(r1, r2), level = "interval")
# The percentile bootstrap interval for the same ratings, which
# recomputes alpha on each of B resamples of the units; the table
# gains lower_limit, upper_limit, and B_used rows. B = 200 keeps the
# example quick; a reported interval deserves the default B = 1000.
krippendorff_alpha(cbind(r1, r2), level = "interval",
boot = TRUE, B = 200L, seed = 113)
Run the code above in your browser using DataLab