GAgreement & reliability · agreement.krippendorff
Krippendorff's alpha (any number of raters, missing ratings)
How reliably do several raters (coders, observers) agree, allowing for missing ratings and any level of measurement?
Krippendorff's α from the coincidence matrix for nominal, ordinal, interval or ratio data, with any number of raters and missing ratings (Krippendorff 2011). Reports observed and expected disagreement, the coincidence matrix and a bootstrap interval over units with the probability that α falls below Krippendorff's thresholds (.667 and .800).
A real result
Example “Nominal missing”, recorded in both engines. In the app, “Try this example” loads it into Analyze.
Krippendorff's α = .74, 95% CI [0.45, 1.00]
- α
- 0.7434
- 95% CI
- [0.4505, 1]
- Observed disagreement Do
- 0.2000
- Expected disagreement De
- 0.7795
Effect size
- Krippendorff's α 0.7434 95% CI [0.4505, 1]
Plots
View data
| Paired with | Count | Value | Coincidences |
|---|---|---|---|
| 1 | 7.0 | 1 | 7 |
| 2 | 1.3 | 1 | 1.333 |
| 3 | 0.3 | 1 | 0.3333 |
| 4 | 0.3 | 1 | 0.3333 |
| 5 | 0.0 | 1 | 0 |
| 1 | 1.3 | 2 | 1.333 |
| 2 | 10.0 | 2 | 10 |
| 3 | 1.3 | 2 | 1.333 |
| 4 | 0.3 | 2 | 0.3333 |
| 5 | 0.0 | 2 | 0 |
| 1 | 0.3 | 3 | 0.3333 |
| 2 | 1.3 | 3 | 1.333 |
| 3 | 8.0 | 3 | 8 |
| 4 | 0.3 | 3 | 0.3333 |
| 5 | 0.0 | 3 | 0 |
| 1 | 0.3 | 4 | 0.3333 |
| 2 | 0.3 | 4 | 0.3333 |
| 3 | 0.3 | 4 | 0.3333 |
| 4 | 4.0 | 4 | 4 |
| 5 | 0.0 | 4 | 0 |
| 1 | 0.0 | 5 | 0 |
| 2 | 0.0 | 5 | 0 |
| 3 | 0.0 | 5 | 0 |
| 4 | 0.0 | 5 | 0 |
| 5 | 3.0 | 5 | 3 |
Assumptions
- Units with two or more ratings — 11 of 12 units have two or more ratings (40 pairable values) — α is unstable with so few pairable values.
- Level of measurement — Nominal difference function over 5 distinct values.
Coincidence matrix (pairable values)
| Value | 1 | 2 | 3 | 4 | 5 | Total |
|---|---|---|---|---|---|---|
| 1 | 7 | 1.333 | 0.3333 | 0.3333 | 0 | 9 |
| 2 | 1.333 | 10 | 1.333 | 0.3333 | 0 | 13 |
| 3 | 0.3333 | 1.333 | 8 | 0.3333 | 0 | 10 |
| 4 | 0.3333 | 0.3333 | 0.3333 | 4 | 0 | 5 |
| 5 | 0 | 0 | 0 | 0 | 3 | 3 |
- Nominal α from the coincidence matrix (Krippendorff 2011); units with fewer than two ratings are left out.
- Percentile bootstrap over 11 units, 1000 resamples, seed 42 (the same resamples in Python and R). P(α < .667) = 0.313; P(α < .800) = 0.674.
Krippendorff's α = .74, 95% CI [0.45, 1.00]
- α
- 0.7434
- 95% CI
- [0.4505, 1]
- Observed disagreement Do
- 0.2000
- Expected disagreement De
- 0.7795
Effect size
- Krippendorff's α 0.7434 95% CI [0.4505, 1]
To keep this page light, the plots are shown once, under the R tab.
Assumptions
- Units with two or more ratings — 11 of 12 units have two or more ratings (40 pairable values) — α is unstable with so few pairable values.
- Level of measurement — Nominal difference function over 5 distinct values.
Coincidence matrix (pairable values)
| Value | 1 | 2 | 3 | 4 | 5 | Total |
|---|---|---|---|---|---|---|
| 1 | 7 | 1.333 | 0.3333 | 0.3333 | 0 | 9.000 |
| 2 | 1.333 | 10 | 1.333 | 0.3333 | 0 | 13.000 |
| 3 | 0.3333 | 1.333 | 8 | 0.3333 | 0 | 10 |
| 4 | 0.3333 | 0.3333 | 0.3333 | 4 | 0 | 5 |
| 5 | 0 | 0 | 0 | 0 | 3 | 3 |
- Nominal α from the coincidence matrix (Krippendorff 2011); units with fewer than two ratings are left out.
- Percentile bootstrap over 11 units, 1000 resamples, seed 42 (the same resamples in Python and R). P(α < .667) = 0.313; P(α < .800) = 0.674.
Do it in CodeSplash Run it on your own data, in Python or R, with the code to prove it.
Worked examples in the app
- Nominal missings3_kripp · raters: rater_1, rater_2, rater_3, rater 4
- Interval 90s3_kripp · raters: rater_1, rater_2, rater_3, rater 4
- Ratio no boots3_kripp · raters: rater_1, rater_2, rater_3, rater 4
- Ordinal categoriess3_ratings · raters: judge_a, judge_b, judge c
- Boolean autos3_ratings · raters: flag_a, flag_b
- Categorical ordinal missings3_kripp · raters: rater_1_cat, rater_2_cat, rater_3_cat
- Degenerate infs3_kripp · raters: rater_1, rater_2, rater_3, rater 4
In the guides
Where it sits in the decision guides
- Categorical (> 2 raters): Fleiss' κ · Statistics Guide · G — Agreement / reliability
- Agreement coefficients: Krippendorff α, Gwet AC1/AC2 · Statistics Guide · G — Agreement / reliability
What you need
- Ratersnumeric / categorical / boolean · 2–100 columns
- One column per rater (coder, observer) with the value given to each unit (rows). Missing ratings are allowed; units with fewer than two ratings are left out. All raters must use the same kind of value.
Choices you make
options
- Level of measurementdefault auto
The difference function δ. Ordinal uses the ranks of the values in the data; interval and ratio need numeric ratings.
- Automatic (nominal for categories, interval for numbers)(default) — Uses nominal for categories and interval for numbers; check that it matches how the ratings were made.
- Nominal — Any disagreement counts the same; pick it for unordered categories.
- Ordinal (stored category order or numeric order) — Disagreement grows with distance in rank; pick it for ordered categories.
- Interval (numbers only) — Disagreement grows with the squared difference; pick it for numbers with equal steps.
- Ratio (numbers only) — Disagreement is relative to the sizes; pick it for numbers with a true zero.
statistics
- Bootstrap resamplesdefault 1000
Units are resampled with replacement (the same resamples in Python and R for a seed); 0 skips the interval.
hypothesis
- Confidence leveldefault 0.95
How sure the intervals should be: 0.95 gives 95% confidence intervals. Higher confidence means wider intervals.
Checks and remedies
CodeSplash checks each testable assumption on every run and shows the result on the card; premises the data can’t test are marked. If a check fails, these are the ways forward.
Units with two or more ratings
α uses only units rated at least twice; few pairable values make α unstable.
Level of measurement
The difference function must match the scale; nominal α ignores how far apart categories are.
What it reports
- alpha
- The false-positive rate you accept before looking at the data, usually 0.05.
- ci_low
- A range of effect values compatible with your data at the chosen confidence level.
- ci_high
- A range of effect values compatible with your data at the chosen confidence level.
- do
- Chance-corrected agreement for any number of raters and any scale, and it tolerates missing ratings.
- de
- Chance-corrected agreement for any number of raters and any scale, and it tolerates missing ratings.
- units
- Units (rows) with two or more ratings. Only these count towards α.
- units_total
- Units (rows) with at least one rating, including those with a single rating that cannot be paired.
- pairable
- Chance-corrected agreement for any number of raters and any scale, and it tolerates missing ratings.
- n_values
- How many independent units the analysis used; it sets precision and power.
- raters
- How many raters (rating columns) were included in the agreement analysis.
- q_667
- Chance-corrected agreement for any number of raters and any scale, and it tolerates missing ratings.
- q_800
- Chance-corrected agreement for any number of raters and any scale, and it tolerates missing ratings.
Per group, level or term: n_value[<value>]
Python and R
Python and R agree to 10 decimals (relative tolerance 1e-10). Python uses pandas, numpy, scipy, codesplash; R uses stats, nanoparquet, codesplashr.
Default traps between the two languages
- Both engines use the same coincidence-matrix closed form (codesplash.stats.agreement_adv.kripp_alpha ↔ cs_agree_kripp), which reproduces irr::kripp.alpha and the krippendorff package (Krippendorff 2011's example: nominal .743, ordinal .815, interval .849, ratio .797). The interval resamples units with the shared Wichmann–Hill stream, so both engines draw the same resamples; it is not Krippendorff's own bootstrap over pairable values.
The exact script CodeSplash ran for example “Nominal missing” · Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Krippendorff's alpha (any number of raters, missing ratings)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method agreement.krippendorff 1.0.1 · spec b102e5b5a064fdc2
# Dataset: s3_kripp (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
import json
import numpy as np
import pandas as pd
import codesplash as cs
from codesplash.stats import agreement_adv as ag # Krippendorff's α (twin of R's cs_agree_kripp)
# krippendorff.alpha(reliability_data=x.T, level_of_measurement=level) computes the same α; the twin
# adds the coincidence matrix and a bootstrap over units drawn from the shared seed.
# %% Data (missing ratings are kept: α uses every unit with two or more ratings)
raters = ["rater_1", "rater_2", "rater_3", "rater 4"]
kinds = {"rater 4":"numeric","rater_1":"numeric","rater_2":"numeric","rater_3":"numeric"}
stored = json.loads("{\"rater 4\":null,\"rater_1\":null,\"rater_2\":null,\"rater_3\":null}")
df = pd.read_parquet("tests/parity/fixtures/s3_kripp.parquet", columns=raters)
warnings = []
cs.check_finite_columns(df, raters) # infinite ratings stop the run (registry/errors.yaml)
if len({kinds[r] for r in raters}) > 1:
raise ValueError("All raters must use the same kind of value (all numbers or all categories)")
numeric = kinds[raters[0]] == "numeric"
if numeric:
x = df[raters].to_numpy(dtype=float)
cats = None
else:
def text(s):
return [None if pd.isna(v) else (str(v).lower() if isinstance(v, (bool, np.bool_)) else str(v)) for v in s]
cols = {r: text(df[r]) for r in raters}
cats = []
for r in raters:
for v in stored[r] or sorted({v for v in cols[r] if v is not None}):
if v not in cats:
cats.append(v) # stored order across raters
pos = {c: i for i, c in enumerate(cats)}
x = np.column_stack([[pos[v] if v is not None else np.nan for v in cols[r]] for r in raters]).astype(float)
level = "nominal"
if level == "auto":
level = "interval" if numeric else "nominal"
if level in ("interval", "ratio") and not numeric:
raise ValueError(f"{level.capitalize()} α needs numeric ratings; choose nominal or ordinal for categories")
if level == "ratio" and np.nanmin(x) < 0:
raise ValueError("Ratio α needs non-negative values")
# %% Krippendorff's alpha
conf = 0.95
boot = int(1000)
seed = 42 # portable Wichmann–Hill stream: R draws the same resamples for this seed
res = ag.kripp_alpha(x, level, boot=boot, seed=seed, conf=conf)
vals = res["values"]
def label(v):
if cats is not None:
return cats[int(v)]
return f"{v:.0f}" if float(v).is_integer() else f"{v:.15g}"
labels = [label(v) for v in vals]
units_total = int(np.sum(np.sum(~np.isnan(x), axis=1) > 0))
has_ci = boot > 0 and np.isfinite(res["ci_low"])
values = {
"alpha": res["alpha"], "do": res["do"], "de": res["de"],
"ci_low": res["ci_low"] if has_ci else None, "ci_high": res["ci_high"] if has_ci else None,
"units": float(res["units"]), "units_total": float(units_total), "pairable": res["pairable"],
"n_values": float(len(vals)), "raters": float(len(raters)),
"q_667": res["q"][0.667] if has_ci else None, "q_800": res["q"][0.8] if has_ci else None,
}
n_c = res["o"].sum(axis=1)
for lb, nc in zip(labels, n_c):
values[f"n_value[{lb}]"] = float(nc)
# %% Assumptions
assumptions = [
{"key": "units", "label": "Units with two or more ratings", "status": "warn" if res["pairable"] < 50 or res["units"] < 10 else "pass",
"detail": f"{res['units']} of {units_total} units have two or more ratings ({res['pairable']:.0f} pairable values)"
+ (" — α is unstable with so few pairable values." if res["pairable"] < 50 or res["units"] < 10 else ".")},
{"key": "level", "label": "Level of measurement", "status": "info",
"detail": f"{level.capitalize()} difference function over {len(vals)} distinct values" + (f" (category order: {', '.join(labels)})." if level == "ordinal" else ".")},
]
# %% Result
pct = f"{conf:.0%}"
rows = [{"value": labels[i], **{f"v{j}": float(res["o"][i, j]) for j in range(len(vals))}, "n": float(n_c[i])} for i in range(len(vals))]
flat_o = [float(res["o"][i, j]) for i in range(len(vals)) for j in range(len(vals))]
stats_list = [{"key": "alpha", "label": "α", "value": res["alpha"]}]
if has_ci:
stats_list.append({"key": "ci", "label": f"{pct} CI", "value": [res["ci_low"], res["ci_high"]]})
stats_list += [{"key": "do", "label": "Observed disagreement Do", "value": res["do"]}, {"key": "de", "label": "Expected disagreement De", "value": res["de"]}]
notes = [f"{level.capitalize()} α from the coincidence matrix (Krippendorff 2011); units with fewer than two ratings are left out."]
if has_ci:
notes.append(f"Percentile bootstrap over {res['units']} units, {boot} resamples, seed {seed} (the same resamples in Python and R). "
f"P(α < .667) = {res['q'][0.667]:.3f}; P(α < .800) = {res['q'][0.8]:.3f}.")
cs.publish({
"method": "agreement.krippendorff",
"methodVersion": "1.0.1",
"title": "Krippendorff's alpha",
"engine": cs.engine_info("numpy", "codesplash"),
"n": int(res["units"]),
"summary": f"Krippendorff's α ({level}) = {res['alpha']:.3f}" + (f", {pct} CI [{res['ci_low']:.3f}, {res['ci_high']:.3f}]" if has_ci else "")
+ f" for {len(raters)} raters and {res['units']} units.",
"apa": f"Krippendorff's α = {cs.fmt_num(res['alpha'], 2, leading_zero=False)}" + (f", {pct} CI [{cs.fmt_num(res['ci_low'])}, {cs.fmt_num(res['ci_high'])}]" if has_ci else ""),
"statistics": stats_list,
"tables": [{"key": "coincidences", "title": "Coincidence matrix (pairable values)", "columns": [
{"key": "value", "label": "Value", "type": "string"},
*[{"key": f"v{j}", "label": labels[j], "type": "number"} for j in range(len(vals))],
{"key": "n", "label": "Total", "type": "number"},
], "rows": rows}],
"effectSizes": [{"key": "alpha", "label": "Krippendorff's α", "value": res["alpha"],
"ciLow": res["ci_low"] if has_ci else None, "ciHigh": res["ci_high"] if has_ci else None,
"ciLevel": conf, "method": f"percentile bootstrap over units ({boot} resamples)" if has_ci else "no interval"}],
"assumptions": assumptions,
"warnings": warnings,
"notes": notes,
"charts": [cs.chart("coincidences", "matrix-heatmap", "Coincidences of values", {
"row": cs.col("Value", [labels[i] for i in range(len(vals)) for _ in vals], "categorical", levels=labels),
"col": cs.col("Paired with", [labels[j] for _ in vals for j in range(len(vals))], "categorical", levels=labels),
"value": cs.col("Coincidences", flat_o, "numeric"),
"label": cs.col("Count", [f"{v:.1f}" for v in flat_o], "categorical"),
}, controls={"scale": "sequential"})],
"values": values,
})
The exact script CodeSplash ran for example “Nominal missing” · R version 4.5.1 (2025-06-13)
# Krippendorff's alpha (any number of raters, missing ratings)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method agreement.krippendorff 1.0.1 · spec b102e5b5a064fdc2
# Dataset: s3_kripp (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
library(codesplashr)
# irr::kripp.alpha(t(x), method = level) computes the same alpha; the twin cs_agree_kripp adds the
# coincidence matrix and a bootstrap over units drawn from the shared seed.
# %% Data (missing ratings are kept: alpha uses every unit with two or more ratings)
raters <- c("rater_1", "rater_2", "rater_3", "rater 4")
kinds <- c(
"rater_1" = "numeric",
"rater_2" = "numeric",
"rater_3" = "numeric",
"rater 4" = "numeric"
)
stored <- list(
"rater_1" = NULL,
"rater_2" = NULL,
"rater_3" = NULL,
"rater 4" = NULL
)
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/s3_kripp.parquet", col_select = raters))
warnings <- list()
cs_check_finite_columns(df, raters) # infinite ratings stop the run (registry/errors.yaml)
if (length(unique(kinds)) > 1) stop("All raters must use the same kind of value (all numbers or all categories)")
numeric <- kinds[[1]] == "numeric"
cats <- NULL
if (numeric) {
x <- sapply(raters, function(r) as.double(df[[r]]))
x <- matrix(x, ncol = length(raters))
} else {
text <- function(v) ifelse(is.na(v), NA_character_, if (is.logical(v)) tolower(as.character(v)) else as.character(v))
cols <- lapply(raters, function(r) text(df[[r]]))
names(cols) <- raters
cats <- character(0)
for (r in raters) {
lv <- if (!is.null(stored[[r]])) stored[[r]] else sort(unique(stats::na.omit(cols[[r]])), method = "radix")
for (v in lv) if (!(v %in% cats)) cats <- c(cats, v) # stored order across raters
}
x <- sapply(raters, function(r) match(cols[[r]], cats) - 1)
x <- matrix(as.double(x), ncol = length(raters))
}
level <- "nominal"
if (level == "auto") level <- if (numeric) "interval" else "nominal"
if (level %in% c("interval", "ratio") && !numeric) {
stop(sprintf("%s alpha needs numeric ratings; choose nominal or ordinal for categories", tools::toTitleCase(level)))
}
if (level == "ratio" && min(x, na.rm = TRUE) < 0) stop("Ratio alpha needs non-negative values")
# %% Krippendorff's alpha
conf <- 0.95
boot <- as.integer(1000)
seed <- 42 # portable Wichmann–Hill stream: Python draws the same resamples for this seed
res <- cs_agree_kripp(x, level, boot = boot, seed = seed, conf = conf)
vals <- res$values
label <- function(v) {
if (!is.null(cats)) return(cats[v + 1])
if (v == round(v)) sprintf("%.0f", v) else formatC(v, digits = 15, format = "g")
}
labels <- vapply(vals, label, character(1))
units_total <- sum(rowSums(!is.na(x)) > 0)
has_ci <- boot > 0 && is.finite(res$ci_low)
na_unless <- function(v) if (has_ci) v else NA
values <- list(
alpha = res$alpha, do = res$do, de = res$de, ci_low = na_unless(res$ci_low), ci_high = na_unless(res$ci_high),
units = res$units, units_total = units_total, pairable = res$pairable, n_values = length(vals), raters = length(raters),
q_667 = na_unless(if (has_ci) unname(res$q[1]) else NA), q_800 = na_unless(if (has_ci) unname(res$q[2]) else NA)
)
n_c <- rowSums(res$o)
for (i in seq_along(vals)) values[[sprintf("n_value[%s]", labels[i])]] <- n_c[i]
# %% Assumptions
few <- res$pairable < 50 || res$units < 10
assumptions <- list(
list(key = "units", label = "Units with two or more ratings", status = if (few) "warn" else "pass",
detail = paste0(sprintf("%d of %d units have two or more ratings (%.0f pairable values)", res$units, units_total, res$pairable),
if (few) " — α is unstable with so few pairable values." else ".")),
list(key = "level", label = "Level of measurement", status = "info",
detail = paste0(sprintf("%s difference function over %d distinct values", tools::toTitleCase(level), length(vals)),
if (level == "ordinal") sprintf(" (category order: %s).", paste(labels, collapse = ", ")) else "."))
)
# %% Result
pct <- sprintf("%.0f%%", conf * 100)
k <- length(vals)
rows <- lapply(seq_len(k), function(i) {
r <- list(value = labels[i])
for (j in seq_len(k)) r[[sprintf("v%d", j - 1)]] <- res$o[i, j]
r$n <- n_c[i]
r
})
cols <- c(list(list(key = "value", label = "Value", type = "string")),
lapply(seq_len(k), function(j) list(key = sprintf("v%d", j - 1), label = labels[j], type = "number")),
list(list(key = "n", label = "Total", type = "number")))
flat_o <- as.vector(t(res$o))
stats_list <- list(list(key = "alpha", label = "α", value = res$alpha))
if (has_ci) stats_list <- c(stats_list, list(list(key = "ci", label = paste(pct, "CI"), value = c(res$ci_low, res$ci_high))))
stats_list <- c(stats_list, list(list(key = "do", label = "Observed disagreement Do", value = res$do),
list(key = "de", label = "Expected disagreement De", value = res$de)))
notes <- list(sprintf("%s α from the coincidence matrix (Krippendorff 2011); units with fewer than two ratings are left out.", tools::toTitleCase(level)))
if (has_ci) {
notes <- c(notes, sprintf("Percentile bootstrap over %d units, %d resamples, seed %s (the same resamples in Python and R). P(α < .667) = %.3f; P(α < .800) = %.3f.",
res$units, boot, seed, res$q[1], res$q[2]))
}
cs_publish(list(
method = "agreement.krippendorff",
methodVersion = "1.0.1",
title = "Krippendorff's alpha",
engine = cs_engine_info("stats", "codesplashr"),
n = res$units,
summary = paste0(sprintf("Krippendorff's α (%s) = %.3f", level, res$alpha),
if (has_ci) sprintf(", %s CI [%.3f, %.3f]", pct, res$ci_low, res$ci_high) else "",
sprintf(" for %d raters and %d units.", length(raters), res$units)),
apa = paste0(sprintf("Krippendorff's α = %s", cs_fmt_num(res$alpha, 2, leading_zero = FALSE)),
if (has_ci) sprintf(", %s CI [%s, %s]", pct, cs_fmt_num(res$ci_low), cs_fmt_num(res$ci_high)) else ""),
statistics = stats_list,
tables = list(list(key = "coincidences", title = "Coincidence matrix (pairable values)", columns = cols, rows = rows)),
effectSizes = list(list(key = "alpha", label = "Krippendorff's α", value = res$alpha, ciLow = na_unless(res$ci_low), ciHigh = na_unless(res$ci_high),
ciLevel = conf, method = if (has_ci) sprintf("percentile bootstrap over units (%d resamples)", boot) else "no interval")),
assumptions = assumptions,
warnings = warnings,
notes = notes,
charts = list(cs_chart("coincidences", "matrix-heatmap", "Coincidences of values", list(
row = cs_col("Value", rep(labels, each = k), "categorical", levels = labels),
col = cs_col("Paired with", rep(labels, times = k), "categorical", levels = labels),
value = cs_col("Coincidences", flat_o, "numeric"),
label = cs_col("Count", sprintf("%.1f", flat_o), "categorical")
), controls = list(scale = "sequential"))),
values = values
))
Sources
- Krippendorff, K. (2011). Computing Krippendorff's alpha-reliability. University of Pennsylvania, Annenberg School for Communication.
- Krippendorff, K. (2004). Content analysis: An introduction to its methodology (2nd ed.). Sage.
- Hayes, A. F., & Krippendorff, K. (2007). Answering the call for a standard reliability measure for coding data. Communication Methods and Measures, 1, 77–89.
From the CodeSplash method registry · agreement.krippendorff v1.0.1.