Intraclass correlation and its F test
One word, six formulas. Choose the ICC that matches your design, because on the same data the answers can range from poor to good.
What runs in CodeSplash
- STAT308Intraclass correlation F test Runs in CodeSplash
- Intraclass correlation (ICC) Verified in Python and R
You will be able to
- Choose the ICC model, type and unit that match a study
- Explain why a significant ICC doesn't establish adequate reliability
- Report an ICC form, its interval, and the standard error of measurement
Read first
Same word, different numbers
ReadFour judges rate six targets. The classic Shrout and Fleiss example gives every form of intraclass correlationIntraclass correlationThe share of variance due to differences between groups (or raters' agreement on the same subjects). from one table.
| Form | Value |
|---|---|
| ICC(1): one-way | 0.17 |
| ICC(A,1): two-way, absolute agreement | 0.29 |
| ICC(C,1): two-way, consistency | 0.71 |
All describe the same ratings. So "the ICC was high" means nothing until you say which one.
Three decisions
ReadModel. Different raters for each subject: one-way. Raters are a sample you want to generalize from: two-way random. These raters are the only ones that matter: two-way mixed.
Type. Must the raters give the same value (absolute agreement), or only rank subjects alike (consistency)?
Unit. Will you use one rater's score (single), or the average of the raters (average)?
Predict the gap
PredictPredict first
Some judges in this table are stricter than others across the board, but they order the targets similarly.
Compare ICC for consistency with ICC for absolute agreement. Which is higher?
Reveal
Consistency: 0.71 against 0.29. Consistency ignores a judge's overall leniency, and absolute agreement counts it as error. The card tests for that rater effect: = 31.9, p < .001.
Choose for yourself
CheckpointCheck yourself
Your hospital has several radiologists. You've sampled four. You want to know whether one radiologist's size measurement can be trusted, including any tendency to measure high. Which form?
Show the answer
Answer: c
Sampled raters mean random. Measuring high matters, so absolute agreement. You'll rely on one reading, so single.
Check yourself
Why is the "average of raters" ICC larger than the "single rater" ICC?
Show the answer
Answer: a
More raters mean more reliable averages. But it applies only if you really will average them in practice.
The F test
ReadEach form comes with a test. In the one-way case:
Rejecting says subjects differ more than noise. For a measurement meant to be reliable, that's a low bar. The two-way forms use their own F statistic and degrees of freedom, not this one-way formula; on the Shrout–Fleiss data, the two-way absolute-agreement ICC(A,1) has p < .001 while its interval runs from 0.02 to 0.76: a tiny p-value, and reliability anywhere from dreadful to good.
Test against a benchmark
ReadThe setup's Null value (r0) moves the test from to a benchmark you care about, such as the lower limit of "good" reliability in Koo and Li (2016). McGraw and Wong (1996) give the test for every form. For a single rater's consistency ICC it rescales the same ratio:
The absolute-agreement forms combine two mean squares in the denominator, so their second degrees of freedom come from Satterthwaite's approximation and need not be whole numbers.
On the Shrout–Fleiss data, ICC(A,1) tested against = 0.3 gives p = .522: no evidence that it beats even a modest benchmark. On 148 simulated subjects, ICC(C,k) tested against 0.75 gives p < .001, so the averaged scores clear the "good" bar.
Check yourself
A protocol requires reliability above 0.75. Which result supports that claim?
Show the answer
Answer: b
The usual test only rules out zero, and an estimate alone ignores its uncertainty. Testing against r0 = 0.75 addresses the benchmark directly.
Read a card
In the appSet Model, Type and Unit in the setup. The card highlights your form and lists the other five.
ICC(C,1) = .90, 95% CI [0.87, 0.92], F(147, 294) = 27.95, p < .001
- ICC(C,1)
- 0.8998
- 95% CI
- [0.8710, 0.9236]
- p
- < .001
- SEM
- 1.839
Effect size
- ICC(C,1) 0.8998 95% CI [0.8710, 0.9236]
Plots
View data
| Rater | Subject | Rating |
|---|---|---|
| score_1 | 1 | 17.200 |
| score_2 | 1 | 21.400 |
| score_3 | 1 | 15.100 |
| score_1 | 2 | 23.300 |
| score_2 | 2 | 25.200 |
| score_3 | 2 | 25 |
| score_1 | 3 | 30.700 |
| score_2 | 3 | 33.500 |
| score_3 | 3 | 24.700 |
| score_1 | 4 | 14.500 |
| score_2 | 4 | 14.400 |
| score_3 | 4 | 12.800 |
| score_1 | 5 | 23.800 |
| score_2 | 5 | 25.100 |
| score_3 | 5 | 22.200 |
| score_1 | 6 | 17.900 |
| score_2 | 6 | 21.300 |
| score_3 | 6 | 20.500 |
| score_1 | 7 | 14.500 |
| score_2 | 7 | 12.600 |
| score_3 | 7 | 14.400 |
| score_1 | 8 | 33.400 |
| score_2 | 8 | 33.400 |
| score_3 | 8 | 32.500 |
| score_1 | 9 | 23.900 |
| score_2 | 9 | 25.800 |
| score_3 | 9 | 24.400 |
| score_1 | 10 | 16.300 |
| score_2 | 10 | 14.800 |
| score_3 | 10 | 12 |
| score_1 | 11 | 14.600 |
| score_2 | 11 | 15 |
| score_3 | 11 | 13.200 |
| score_1 | 12 | 12.300 |
| score_2 | 12 | 14.600 |
| score_3 | 12 | 11.400 |
| score_1 | 13 | 23.900 |
| score_2 | 13 | 28.900 |
| score_3 | 13 | 30.400 |
| score_1 | 14 | 23.200 |
| score_2 | 14 | 28.600 |
| score_3 | 14 | 25.100 |
| score_1 | 15 | 22.700 |
| score_2 | 15 | 21.400 |
| score_3 | 15 | 24.300 |
| score_1 | 16 | 15.100 |
| score_2 | 16 | 14.900 |
| score_3 | 16 | 12.400 |
| score_1 | 17 | 22.700 |
| score_2 | 17 | 28.400 |
| score_3 | 17 | 23.400 |
| score_1 | 18 | 14.100 |
| score_2 | 18 | 15.500 |
| score_3 | 18 | 10.900 |
| score_1 | 19 | 23.800 |
| score_2 | 19 | 24.800 |
| score_3 | 19 | 21.800 |
| score_1 | 20 | 12.300 |
| score_2 | 20 | 14.500 |
| score_3 | 20 | 14.600 |
First 60 of 444 rows.
Assumptions
- Subjects and raters — 148 subjects and 3 raters.
- Systematic rater differences — Raters' means differ: F(2, 294) = 30.52, p < .001. A consistency ICC ignores these differences.
All ICC forms
| Form | ICC | 95% CI low | 95% CI high | F | df1 | df2 | p |
|---|---|---|---|---|---|---|---|
| ICC1 — ICC(1) one-way, single | 0.8814 | 0.8479 | 0.9092 | 23.303 | 147 | 296 | < .001 |
| ICC2 — ICC(A,1) absolute agreement, single | 0.8822 | 0.8252 | 0.9191 | 27.952 | 147 | 294 | < .001 |
| ICC3 — ICC(C,1) consistency, single | 0.8998 | 0.8710 | 0.9236 | 27.952 | 147 | 294 | < .001 |
| ICC1k — ICC(k) one-way, average | 0.9571 | 0.9436 | 0.9678 | 23.303 | 147 | 296 | < .001 |
| ICC2k — ICC(A,k) absolute agreement, average | 0.9574 | 0.9340 | 0.9715 | 27.952 | 147 | 294 | < .001 |
| ICC3k — ICC(C,k) consistency, average | 0.9642 | 0.9529 | 0.9732 | 27.952 | 147 | 294 | < .001 |
Shrout & Fleiss (1979) names with McGraw & Wong (1996) notation; intervals as in psych::ICC.
- 2 of 150 rows were left out because a value was missing.
- SEM = SD × √(1 − ICC) with SD of all ratings; smallest detectable change (95%) = 1.96 × √2 × SEM.
The exact R script · R R version 4.5.1 (2025-06-13)
# Intraclass correlation (ICC)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method agreement.icc 1.1.1 · spec 78c8e44270b0f6ef
# Dataset: ratings_sim (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
library(codesplashr)
# %% Data
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/ratings_sim.parquet", col_select = c("score_1", "score_2", "score_3")))
n_input <- nrow(df)
df <- df[stats::complete.cases(df[c("score_1", "score_2", "score_3")]), , drop = FALSE] # listwise deletion
df[] <- lapply(df, function(x) if (is.factor(x)) droplevels(x) else x)
n_dropped <- n_input - nrow(df)
warnings <- list()
if (n_dropped > 0) {
warnings <- c(warnings, cs_warning("CS_W_ROWS_DROPPED", dropped = n_dropped, total = n_input))
}
if (n_input > 0 && nrow(df) == 0) cs_error("CS_E_NO_ROWS")
cs_check_finite_columns(df, c("score_1", "score_2", "score_3")) # infinite values stop the run (registry/errors.yaml)
# %% Intraclass correlations
raters <- c("score_1", "score_2", "score_3")
Y <- as.matrix(df[raters])
n <- nrow(Y)
k <- ncol(Y)
cs_check_rows(n, 2, "The intraclass correlation") # needs at least two subjects with complete ratings
conf <- 0.95
model <- "twoway-mixed"
kind <- "consistency"
unit <- "single"
res <- cs_icc(Y, conf) # psych::ICC formulas (twin of codesplash.stats.agreement.icc)
if (model == "oneway") {
form <- if (unit == "average") "ICC1k" else "ICC1"
label <- if (unit == "average") "ICC(k)" else "ICC(1)"
f <- res$f1; df1 <- res$df1_1; df2 <- res$df1_2; p <- res$p1
} else {
form <- paste0(if (kind == "agreement") "ICC2" else "ICC3", if (unit == "average") "k" else "")
label <- sprintf("ICC(%s,%s)", if (kind == "agreement") "A" else "C", if (unit == "average") "k" else "1")
f <- res$f3; df1 <- res$df3_1; df2 <- res$df3_2; p <- res$p3
}
r0 <- 0 # H0: ICC = r0 (McGraw & Wong 1996, Table 8); 0 keeps the usual F tests
if (r0 != 0) {
tst <- cs_icc_null_test(res, form, r0) # twin of codesplash.stats.agreement_null.icc_null_test
f <- tst$f; df1 <- tst$df1; df2 <- tst$df2; p <- tst$p
}
model_label <- c(`twoway-random` = "two-way random effects", `twoway-mixed` = "two-way mixed effects", oneway = "one-way random effects")[[model]]
est <- res$forms[[form]]
icc <- est[1]; lo <- est[2]; hi <- est[3]
sem <- res$sd_total * sqrt(max(1 - icc, 0))
mdc <- stats::qnorm(0.975) * sqrt(2) * sem
rater_f <- res$msc / res$mse
rater_p <- stats::pf(rater_f, k - 1, (n - 1) * (k - 1), lower.tail = FALSE)
values <- list(icc = icc, icc_low = lo, icc_high = hi, f = f, df1 = df1, df2 = df2, p = p,
form_label = label, model_label = model_label, n_subjects = n, n_raters = k,
ms_rows = res$msr, ms_cols = res$msc, ms_error = res$mse, ms_within = res$msw,
rater_f = rater_f, rater_p = rater_p, sem = sem, mdc = mdc)
if (r0 != 0) values$null_value <- r0
names_long <- c(ICC1 = "ICC(1) one-way, single", ICC2 = "ICC(A,1) absolute agreement, single", ICC3 = "ICC(C,1) consistency, single",
ICC1k = "ICC(k) one-way, average", ICC2k = "ICC(A,k) absolute agreement, average", ICC3k = "ICC(C,k) consistency, average")
rows <- list()
for (nm in names(res$forms)) {
v <- res$forms[[nm]]
key <- tolower(nm)
values[[key]] <- v[1]
values[[paste0(key, "_low")]] <- v[2]
values[[paste0(key, "_high")]] <- v[3]
one <- startsWith(nm, "ICC1")
if (r0 != 0) {
tst <- cs_icc_null_test(res, nm, r0)
rows[[length(rows) + 1]] <- list(form = sprintf("%s — %s", nm, names_long[[nm]]), icc = v[1], lower = v[2], upper = v[3],
f = tst$f, df1 = tst$df1, df2 = tst$df2, p = tst$p)
next
}
rows[[length(rows) + 1]] <- list(form = sprintf("%s — %s", nm, names_long[[nm]]), icc = v[1], lower = v[2], upper = v[3],
f = if (one) res$f1 else res$f3, df1 = if (one) res$df1_1 else res$df3_1,
df2 = if (one) res$df1_2 else res$df3_2, p = if (one) res$p1 else res$p3)
}
# %% Assumptions
small <- n < 30 || k < 3
cons <- kind == "consistency" && model != "oneway"
assumptions <- list(
list(key = "sample_size", label = "Subjects and raters", status = if (small) "warn" else "pass",
detail = paste0(sprintf("%d subjects and %d raters", n, k),
if (small) " — fewer than the 30 subjects and 3 raters Koo & Li (2016) recommend; the interval is wide." else ".")),
list(key = "rater_bias", label = "Systematic rater differences", status = if (rater_p < 0.05 && cons) "warn" else "info",
statistic = rater_f, p = rater_p,
detail = paste0(sprintf("Raters' means differ: F(%d, %d) = %.2f, %s.", k - 1, (n - 1) * (k - 1), rater_f, cs_fmt_p(rater_p)),
if (cons) " A consistency ICC ignores these differences." else ""))
)
# %% Chart: each subject's ratings across raters
take <- if (n * k <= 5000) seq_len(n) else unique(round(seq(1, n, length.out = 5000 %/% k)))
subj <- rep(as.character(take), each = k)
cond <- rep(raters, times = length(take))
val <- as.vector(t(Y[take, , drop = FALSE]))
# %% Result
pct <- sprintf("%.0f%%", conf * 100)
cs_publish(list(
method = "agreement.icc",
methodVersion = "1.1.1",
title = paste("Intraclass correlation —", label),
engine = cs_engine_info("stats", "codesplashr"),
n = n,
summary = sprintf("%s (%s) = %.3f, %s CI [%.3f, %.3f] for %d raters and %d subjects.", label, model_label, icc, pct, lo, hi, k, n),
apa = if (r0 == 0) sprintf("%s = %s, %s CI [%s, %s], F(%s, %s) = %s, %s", label, cs_fmt_num(icc, 2, leading_zero = FALSE), pct, cs_fmt_num(lo),
cs_fmt_num(hi), format(df1), format(df2), cs_fmt_num(f), cs_fmt_p(p)) else
sprintf("%s = %s, %s CI [%s, %s], F(%s, %s) = %s, %s (H₀: ρ = %s)", label, cs_fmt_num(icc, 2, leading_zero = FALSE), pct, cs_fmt_num(lo),
cs_fmt_num(hi), cs_df_label(df1), cs_df_label(df2), cs_fmt_num(f), cs_fmt_p(p), cs_fmt_num(r0)),
statistics = list(list(key = "icc", label = label, value = icc), list(key = "ci", label = paste(pct, "CI"), value = c(lo, hi)),
list(key = "p", label = "p", value = p, format = "p"), list(key = "sem", label = "SEM", value = sem)),
tables = list(list(key = "forms", title = "All ICC forms", columns = list(
list(key = "form", label = "Form", type = "string"), list(key = "icc", label = "ICC", type = "number"),
list(key = "lower", label = paste(pct, "CI low"), type = "number"), list(key = "upper", label = paste(pct, "CI high"), type = "number"),
list(key = "f", label = "F", type = "number"), list(key = "df1", label = "df1", type = "number"),
list(key = "df2", label = "df2", type = "number"), list(key = "p", label = "p", type = "pvalue")
), rows = rows, note = "Shrout & Fleiss (1979) names with McGraw & Wong (1996) notation; intervals as in psych::ICC.")),
effectSizes = list(list(key = "icc", label = label, value = icc, ciLow = lo, ciHigh = hi, ciLevel = conf, method = "F-distribution interval")),
assumptions = assumptions,
warnings = warnings,
notes = c(list("SEM = SD × √(1 − ICC) with SD of all ratings; smallest detectable change (95%) = 1.96 × √2 × SEM."),
if (r0 != 0) list(sprintf("Tests are against a null value of %s (H₀: ρ = %s), McGraw & Wong's (1996) F tests as in irr::icc; the absolute-agreement forms use Satterthwaite degrees of freedom.", cs_fmt_num(r0), cs_fmt_num(r0)))),
charts = list(cs_chart("profiles", "paired-lines", "Ratings by subject", list(
subject = cs_col("Subject", subj, "categorical"), condition = cs_col("Rater", cond, "categorical", levels = raters),
value = cs_col("Rating", val, "numeric")
))),
values = values
))
ICC(C,1) = .90, 95% CI [0.87, 0.92], F(147, 294) = 27.95, p < .001
- ICC(C,1)
- 0.8998
- 95% CI
- [0.8710, 0.9236]
- p
- < .001
- SEM
- 1.839
Effect size
- ICC(C,1) 0.8998 95% CI [0.8710, 0.9236]
To keep this page light, the plots are shown once, under the R tab.
Assumptions
- Subjects and raters — 148 subjects and 3 raters.
- Systematic rater differences — Raters' means differ: F(2, 294) = 30.52, p < .001. A consistency ICC ignores these differences.
All ICC forms
| Form | ICC | 95% CI low | 95% CI high | F | df1 | df2 | p |
|---|---|---|---|---|---|---|---|
| ICC1 — ICC(1) one-way, single | 0.8814 | 0.8479 | 0.9092 | 23.303 | 147 | 296 | < .001 |
| ICC2 — ICC(A,1) absolute agreement, single | 0.8822 | 0.8252 | 0.9191 | 27.952 | 147 | 294 | < .001 |
| ICC3 — ICC(C,1) consistency, single | 0.8998 | 0.8710 | 0.9236 | 27.952 | 147 | 294 | < .001 |
| ICC1k — ICC(k) one-way, average | 0.9571 | 0.9436 | 0.9678 | 23.303 | 147 | 296 | < .001 |
| ICC2k — ICC(A,k) absolute agreement, average | 0.9574 | 0.9340 | 0.9715 | 27.952 | 147 | 294 | < .001 |
| ICC3k — ICC(C,k) consistency, average | 0.9642 | 0.9529 | 0.9732 | 27.952 | 147 | 294 | < .001 |
Shrout & Fleiss (1979) names with McGraw & Wong (1996) notation; intervals as in psych::ICC.
- 2 of 150 rows were left out because a value was missing.
- SEM = SD × √(1 − ICC) with SD of all ratings; smallest detectable change (95%) = 1.96 × √2 × SEM.
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Intraclass correlation (ICC)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method agreement.icc 1.1.1 · spec 78c8e44270b0f6ef
# Dataset: ratings_sim (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
import math
import numpy as np
import pandas as pd
from scipy import stats
import codesplash as cs
from codesplash.stats import agreement as ag # ICC kernel identical to R's cs_icc (psych::ICC formulas)
# %% Data
df = pd.read_parquet("tests/parity/fixtures/ratings_sim.parquet", columns=["score_1", "score_2", "score_3"])
n_input = len(df)
df = df.dropna(subset=["score_1", "score_2", "score_3"]) # listwise deletion over the analysis columns
n_dropped = n_input - len(df)
warnings = []
if n_dropped:
warnings.append(cs.cs_warning("CS_W_ROWS_DROPPED", dropped=n_dropped, total=n_input))
if n_input and not len(df):
cs.cs_error("CS_E_NO_ROWS")
cs.check_finite_columns(df, ["score_1", "score_2", "score_3"]) # infinite values stop the run (registry/errors.yaml)
# %% Intraclass correlations
raters = ["score_1", "score_2", "score_3"]
Y = df[raters].to_numpy(dtype=float)
n, k = Y.shape
cs.check_rows(n, 2, "The intraclass correlation") # needs at least two subjects with complete ratings
conf = 0.95
model, kind, unit = "twoway-mixed", "consistency", "single"
res = ag.icc(Y, conf)
if model == "oneway":
form = "ICC1k" if unit == "average" else "ICC1"
label = "ICC(k)" if unit == "average" else "ICC(1)"
f, df1, df2, p = res["f1"], res["df1_1"], res["df1_2"], res["p1"]
else:
form = {"agreement": "ICC2", "consistency": "ICC3"}[kind] + ("k" if unit == "average" else "")
label = f"ICC({'A' if kind == 'agreement' else 'C'},{'k' if unit == 'average' else '1'})"
f, df1, df2, p = res["f3"], res["df3_1"], res["df3_2"], res["p3"]
r0 = 0 # H0: ICC = r0 (McGraw & Wong 1996, Table 8); 0 keeps the usual F tests
if r0 != 0:
from codesplash.stats import agreement_null as agn # twin of R's cs_icc_null_test
f, df1, df2, p = agn.icc_null_test(res, form, r0)
model_label = {"twoway-random": "two-way random effects", "twoway-mixed": "two-way mixed effects", "oneway": "one-way random effects"}[model]
icc, lo, hi = res["forms"][form]
sem = res["sd_total"] * math.sqrt(max(1 - icc, 0.0))
mdc = stats.norm.ppf(0.975) * math.sqrt(2) * sem
rater_f = res["msc"] / res["mse"]
rater_p = float(stats.f.sf(rater_f, k - 1, (n - 1) * (k - 1)))
values = {"icc": icc, "icc_low": lo, "icc_high": hi, "f": f, "df1": float(df1), "df2": float(df2), "p": p,
"form_label": label, "model_label": model_label, "n_subjects": float(n), "n_raters": float(k),
"ms_rows": res["msr"], "ms_cols": res["msc"], "ms_error": res["mse"], "ms_within": res["msw"],
"rater_f": rater_f, "rater_p": rater_p, "sem": sem, "mdc": mdc}
if r0 != 0:
values["null_value"] = r0
NAMES = {"ICC1": "ICC(1) one-way, single", "ICC2": "ICC(A,1) absolute agreement, single", "ICC3": "ICC(C,1) consistency, single",
"ICC1k": "ICC(k) one-way, average", "ICC2k": "ICC(A,k) absolute agreement, average", "ICC3k": "ICC(C,k) consistency, average"}
rows = []
for name, (v, l, h) in res["forms"].items():
key = name.lower()
values[key], values[f"{key}_low"], values[f"{key}_high"] = v, l, h
one = name.startswith("ICC1")
if r0 != 0:
tf, tdf1, tdf2, tp = agn.icc_null_test(res, name, r0)
rows.append({"form": f"{name} — {NAMES[name]}", "icc": v, "lower": l, "upper": h, "f": tf, "df1": tdf1, "df2": tdf2, "p": tp})
continue
rows.append({"form": f"{name} — {NAMES[name]}", "icc": v, "lower": l, "upper": h,
"f": res["f1"] if one else res["f3"], "df1": float(res["df1_1"] if one else res["df3_1"]),
"df2": float(res["df1_2"] if one else res["df3_2"]), "p": res["p1"] if one else res["p3"]})
# %% Assumptions
assumptions = [
{"key": "sample_size", "label": "Subjects and raters", "status": "warn" if n < 30 or k < 3 else "pass",
"detail": f"{n} subjects and {k} raters" + (" — fewer than the 30 subjects and 3 raters Koo & Li (2016) recommend; the interval is wide." if n < 30 or k < 3 else ".")},
{"key": "rater_bias", "label": "Systematic rater differences", "status": "warn" if rater_p < 0.05 and kind == "consistency" and model != "oneway" else "info",
"statistic": rater_f, "p": rater_p,
"detail": f"Raters' means differ: F({k - 1}, {(n - 1) * (k - 1)}) = {rater_f:.2f}, {cs.fmt_p(rater_p)}."
+ (" A consistency ICC ignores these differences." if kind == "consistency" and model != "oneway" else "")},
]
# %% Chart: each subject's ratings across raters
take = np.arange(n) if n * k <= 5000 else np.unique(np.round(np.linspace(0, n - 1, 5000 // k)).astype(int))
subj = [str(i + 1) for i in take for _ in raters]
cond = [r for _ in take for r in raters]
val = Y[take].ravel().tolist()
# %% Result
pct = f"{conf:.0%}"
cs.publish({
"method": "agreement.icc",
"methodVersion": "1.1.1",
"title": f"Intraclass correlation — {label}",
"engine": cs.engine_info("numpy", "scipy", "codesplash"),
"n": int(n),
"summary": f"{label} ({model_label}) = {icc:.3f}, {pct} CI [{lo:.3f}, {hi:.3f}] for {k} raters and {n} subjects.",
"apa": f"{label} = {cs.fmt_num(icc, 2, leading_zero=False)}, {pct} CI [{cs.fmt_num(lo)}, {cs.fmt_num(hi)}], F({df1}, {df2}) = {cs.fmt_num(f)}, {cs.fmt_p(p)}"
if r0 == 0 else
f"{label} = {cs.fmt_num(icc, 2, leading_zero=False)}, {pct} CI [{cs.fmt_num(lo)}, {cs.fmt_num(hi)}], F({agn.df_label(df1)}, {agn.df_label(df2)}) = {cs.fmt_num(f)}, {cs.fmt_p(p)} (H₀: ρ = {cs.fmt_num(r0)})",
"statistics": [{"key": "icc", "label": label, "value": icc}, {"key": "ci", "label": f"{pct} CI", "value": [lo, hi]},
{"key": "p", "label": "p", "value": p, "format": "p"}, {"key": "sem", "label": "SEM", "value": sem}],
"tables": [{"key": "forms", "title": "All ICC forms", "columns": [
{"key": "form", "label": "Form", "type": "string"}, {"key": "icc", "label": "ICC", "type": "number"},
{"key": "lower", "label": f"{pct} CI low", "type": "number"}, {"key": "upper", "label": f"{pct} CI high", "type": "number"},
{"key": "f", "label": "F", "type": "number"}, {"key": "df1", "label": "df1", "type": "number"},
{"key": "df2", "label": "df2", "type": "number"}, {"key": "p", "label": "p", "type": "pvalue"},
], "rows": rows, "note": "Shrout & Fleiss (1979) names with McGraw & Wong (1996) notation; intervals as in psych::ICC."}],
"effectSizes": [{"key": "icc", "label": label, "value": icc, "ciLow": lo, "ciHigh": hi, "ciLevel": conf, "method": "F-distribution interval"}],
"assumptions": assumptions,
"warnings": warnings,
"notes": [f"SEM = SD × √(1 − ICC) with SD of all ratings; smallest detectable change (95%) = 1.96 × √2 × SEM."]
+ ([f"Tests are against a null value of {cs.fmt_num(r0)} (H₀: ρ = {cs.fmt_num(r0)}), McGraw & Wong's (1996) F tests as in irr::icc; the absolute-agreement forms use Satterthwaite degrees of freedom."] if r0 != 0 else []),
"charts": [cs.chart("profiles", "paired-lines", "Ratings by subject", {
"subject": cs.col("Subject", subj, "categorical"), "condition": cs.col("Rater", cond, "categorical", levels=raters),
"value": cs.col("Rating", val, "numeric"),
})],
"values": values,
})
The card also translates to the units you measure in. The standard error of measurementStandard error of measurementThe typical size of a single measurement's error, in the original units. It's the SD times the square root of 1 − reliability. here is 1.84, and the minimal detectable changeMinimal detectable changeThe smallest change in one person's score that exceeds measurement error, at a stated confidence level. is 5.1 points. A change smaller than that can't be told from noise.
Which ICC would you report?
ReflectThink of ratings or measurements you work with. Will the same raters be used in practice, or others like them? Do values need to match, or only their order? Will you act on one rating or an average? Write down the form your answers point to.
Same statistic, two dialects
ReadR's psych::ICC prints all six, under Shrout and Fleiss's names. Python's core libraries have no ICC, so here is the two-way form from the sums of squares.
import numpy as np
import pandas as pd
df = pd.read_csv("shrout_fleiss.csv")
Y = df[["j1", "j2", "j3", "judge 4"]].to_numpy(dtype=float)
n, k = Y.shape
grand = Y.mean()
ms_rows = k * ((Y.mean(axis=1) - grand) ** 2).sum() / (n - 1)
ms_cols = n * ((Y.mean(axis=0) - grand) ** 2).sum() / (k - 1)
resid = Y - Y.mean(axis=1, keepdims=True) - Y.mean(axis=0, keepdims=True) + grand
ms_err = (resid ** 2).sum() / ((n - 1) * (k - 1))
icc_a1 = (ms_rows - ms_err) / (ms_rows + (k - 1) * ms_err + k * (ms_cols - ms_err) / n)
icc_c1 = (ms_rows - ms_err) / (ms_rows + (k - 1) * ms_err)
print(icc_a1, icc_c1)library(psych)
df <- read.csv("shrout_fleiss.csv", check.names = FALSE)
ICC(df[, c("j1", "j2", "j3", "judge 4")])$results[, c("type", "ICC", "lower bound", "upper bound")]Check your understanding
CheckpointCheck yourself
Which report can a reader act on?
Show the answer
Answer: c
Name the model, type and unit, and give the interval, the design and something in the original units.
Check yourself
Two studies use the same rating scale. Study A has very mixed patients, Study B only mild cases. Which is likely to have the higher ICC, with equally careful raters?
Show the answer
Answer: a
ICC is the share of variance due to subjects. A narrow range lowers it even when raters are as careful. Report the sample's spread too.
Recap
Recap- Choose model, type and unit from the design, and name them in the report.
- Absolute agreement counts rater leniency as error; consistency ignores it.
- A significant F against zero doesn't show adequate reliability, so read the interval.
- SEM and minimal detectable change speak in your measurement's units.
Concepts in this lesson