# Fleiss (1971) Table 1 example: 30 subjects rated by 6 raters into
# 5 diagnostic categories (Depression, Personality Disorder,
# Schizophrenia, Neurosis, Other). Each row of `ratings` gives, for one
# subject, the count of raters who chose each category (rows sum to 6).
# kappa = 0.430, matching Fleiss (1971).
fleiss_1971 <- matrix(c(
0, 0, 0, 6, 0,
0, 3, 0, 0, 3,
0, 1, 4, 0, 1,
0, 0, 0, 0, 6,
0, 3, 0, 3, 0,
2, 0, 4, 0, 0,
0, 0, 4, 0, 2,
2, 0, 3, 1, 0,
2, 0, 0, 4, 0,
0, 0, 0, 0, 6,
1, 0, 0, 5, 0,
1, 1, 0, 4, 0,
0, 3, 3, 0, 0,
1, 0, 0, 5, 0,
0, 2, 0, 3, 1,
0, 0, 5, 0, 1,
3, 0, 0, 1, 2,
5, 1, 0, 0, 0,
0, 2, 0, 4, 0,
1, 0, 2, 0, 3,
0, 0, 0, 0, 6,
0, 1, 0, 5, 0,
0, 2, 0, 1, 3,
2, 0, 0, 4, 0,
1, 0, 0, 4, 1,
0, 5, 0, 1, 0,
4, 0, 0, 0, 2,
0, 2, 0, 4, 0,
1, 0, 5, 0, 0,
0, 0, 0, 0, 6
), nrow = 30, byrow = TRUE)
fleiss_kappa(fleiss_1971)
# A percentile bootstrap interval, which resamples the subjects (rows)
# with replacement and recomputes kappa on each resample. Compare its
# limits with the Wald interval above; z_value and p_value keep their
# asymptotic definitions. B = 2000 keeps the example quick; a reported
# interval deserves the default B = 10000.
fleiss_kappa(fleiss_1971, ci_method = "percentile", B = 2000,
seed = 113)
Run the code above in your browser using DataLab