Skip to content

GAgreement & reliability · agreement.icc

Intraclass correlation (ICC)

How consistently do raters (or repeated measurements) score the same subjects?

Computes all six Shrout–Fleiss / McGraw–Wong intraclass correlations from a two-way ANOVA of subjects × raters, with F-based confidence intervals and tests, and highlights the form that matches your design: one-way or two-way, absolute agreement or consistency, single or averaged ratings. Adds the standard error of measurement and the smallest detectable change.

Verified in Python and R Python and R agree to 10 decimals

A real result

Example “Shrout fleiss”, recorded in both engines. In the app, “Try this example” loads it into Analyze.

Intraclass correlation — ICC(A,1)Recorded · Python and R agreeRecorded 2026-11-21 · 37 values compared
R

ICC(A,1) = .29, 95% CI [0.02, 0.76], F(5, 15) = 11.03, p < .001

ICC(A,1)
0.2898
95% CI
[0.0188, 0.7611]
p
< .001
SEM
2.284

Effect size

  • ICC(A,1) 0.2898 95% CI [0.0188, 0.7611]

Plots

Ratings by subjectHow did each subject change across conditions or time points?
View data
RaterSubjectRating
j119
j212
j315
judge 418
j126
j221
j323
judge 422
j138
j234
j336
judge 438
j147
j241
j342
judge 446
j1510
j255
j356
judge 459
j166
j262
j364
judge 467

Assumptions

  • Subjects and raters — 6 subjects and 4 raters — fewer than the 30 subjects and 3 raters Koo & Li (2016) recommend; the interval is wide.
  • Systematic rater differences — Raters' means differ: F(3, 15) = 31.87, p < .001.

All ICC forms

FormICC95% CI low95% CI highFdf1df2p
ICC1 — ICC(1) one-way, single0.1657−0.13290.72261.795518.165
ICC2 — ICC(A,1) absolute agreement, single0.28980.01880.761111.027515< .001
ICC3 — ICC(C,1) consistency, single0.71480.34250.945911.027515< .001
ICC1k — ICC(k) one-way, average0.4428−0.88440.91241.795518.165
ICC2k — ICC(A,k) absolute agreement, average0.62010.07110.927211.027515< .001
ICC3k — ICC(C,k) consistency, average0.90930.67570.985911.027515< .001

Shrout & Fleiss (1979) names with McGraw & Wong (1996) notation; intervals as in psych::ICC.

  • SEM = SD × √(1 − ICC) with SD of all ratings; smallest detectable change (95%) = 1.96 × √2 × SEM.
Python

ICC(A,1) = .29, 95% CI [0.02, 0.76], F(5, 15) = 11.03, p < .001

ICC(A,1)
0.2898
95% CI
[0.0188, 0.7611]
p
< .001
SEM
2.284

Effect size

  • ICC(A,1) 0.2898 95% CI [0.0188, 0.7611]

To keep this page light, the plots are shown once, under the R tab.

Assumptions

  • Subjects and raters — 6 subjects and 4 raters — fewer than the 30 subjects and 3 raters Koo & Li (2016) recommend; the interval is wide.
  • Systematic rater differences — Raters' means differ: F(3, 15) = 31.87, p < .001.

All ICC forms

FormICC95% CI low95% CI highFdf1df2p
ICC1 — ICC(1) one-way, single0.1657−0.13290.72261.795518.165
ICC2 — ICC(A,1) absolute agreement, single0.28980.01880.761111.027515< .001
ICC3 — ICC(C,1) consistency, single0.71480.34250.945911.027515< .001
ICC1k — ICC(k) one-way, average0.4428−0.88440.91241.795518.165
ICC2k — ICC(A,k) absolute agreement, average0.62010.07110.927211.027515< .001
ICC3k — ICC(C,k) consistency, average0.90930.67570.985911.027515< .001

Shrout & Fleiss (1979) names with McGraw & Wong (1996) notation; intervals as in psych::ICC.

  • SEM = SD × √(1 − ICC) with SD of all ratings; smallest detectable change (95%) = 1.96 × √2 × SEM.

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

  • Shrout fleissshrout_fleiss · raters: j1, j2, j3, judge 4
  • Shrout fleiss oneway averageshrout_fleiss · raters: j1, j2, j3, judge 4
  • Scores mixed consistencyratings_sim · raters: score_1, score_2, score_3
  • Null value agreementshrout_fleiss · raters: j1, j2, j3, judge 4
  • Null value consistency averageratings_sim · raters: score_1, score_2, score_3
  • Null value onewayratings_sim · raters: score_1, score_2, score_3
  • Degenerate n1shrout_fleiss · raters: j1, j2, j3, judge 4
  • Regress icc perfect agreementicc_perfect · raters: r1, r2, r3

In the guides

Tests from the statistics guide this method runs

Where it sits in the decision guides

  • Continuous: mean, median, SD, IQR · Statistics Guide · A — Describe data
  • Continuous (2+ raters): ICC · Statistics Guide · G — Agreement / reliability

What you need

Ratersnumeric · 2–50 columns
One column per rater (or occasion); each row is a subject. Rows with a missing rating are left out.

Choices you make

hypothesis

Modeldefault twoway-random

Two-way random and mixed models give the same numbers; they differ in how far the result generalizes.

  • Two-way random (raters are a sample)(default) — Treats raters as a sample from a larger pool; pick it to generalize to other raters.
  • Two-way mixed (these raters only) — Treats these raters as the only ones of interest; pick it when the same raters will carry on.
  • One-way random (different raters per subject) — Each subject has its own raters; pick it when raters differ from subject to subject.
Typedefault agreement

Absolute agreement counts systematic rater differences as disagreement; consistency ignores them.

  • Absolute agreement(default) — Counts systematic differences between raters against agreement; pick it when scores must match.
  • Consistency (ignores systematic rater differences) — Ignores systematic rater shifts; pick it when only the pattern of scores matters.
Unitdefault single

Single-rater reliability, or the reliability of the mean of all raters.

  • Single rater(default) — Reliability of one rater's score; pick it when one rater will be used in practice.
  • Average of the raters — Reliability of the mean over raters; pick it when you'll average them in practice.
Confidence leveldefault 0.95

How sure the intervals should be: 0.95 gives 95% confidence intervals. Higher confidence means wider intervals.

Advanced

Null value (r₀)default 0

The ICC under the null hypothesis. 0 tests for any reliability; 0.75 tests whether reliability exceeds 'good' (Koo & Li).

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.

  • Subjects and raters

    Koo & Li (2016) recommend at least 30 subjects and 3 raters.

  • Systematic rater differences

    Raters' means differ (F test of raters); absolute-agreement ICCs penalize this, consistency ICCs do not.

What it reports

  • Tests: ICC greater than the null value (zero unless set)
icc
The share of variance due to differences between groups (or raters' agreement on the same subjects).
icc_low
A range of effect values compatible with your data at the chosen confidence level.
icc_high
A range of effect values compatible with your data at the chosen confidence level.
f
The ratio of explained to unexplained variance, used by ANOVA and regression tests.
df1
How much independent information is left to estimate variability after fitting the model.
df2
How much independent information is left to estimate variability after fitting the model.
p
How surprising your data would be if the null hypothesis were true, as a probability.
form_label
Which ICC form was reported, such as ICC(A,1): A or C for agreement or consistency, 1 or k for single or averaged ratings.
model_label
The exact variant that ran (for example Welch vs classic F), shown so the result can be reported and reproduced.
n_subjects
How many independent units the analysis used; it sets precision and power.
n_raters
How many independent units the analysis used; it sets precision and power.
ms_rows
A sum of squares divided by its degrees of freedom. The F statistic is a ratio of two of them.
ms_cols
A sum of squares divided by its degrees of freedom. The F statistic is a ratio of two of them.
ms_error
A sum of squares divided by its degrees of freedom. The F statistic is a ratio of two of them.
ms_within
A sum of squares divided by its degrees of freedom. The F statistic is a ratio of two of them.
rater_f
The ratio of explained to unexplained variance, used by ANOVA and regression tests.
rater_p
How surprising your data would be if the null hypothesis were true, as a probability.
sem
The typical size of a single measurement's error, in the original units. It's the SD times the square root of 1 − reliability.
mdc
The smallest change in one person's score that exceeds measurement error, at a stated confidence level.
icc1
The share of variance due to differences between groups (or raters' agreement on the same subjects).
icc1_low
A range of effect values compatible with your data at the chosen confidence level.
icc1_high
A range of effect values compatible with your data at the chosen confidence level.
icc2
The share of variance due to differences between groups (or raters' agreement on the same subjects).
icc2_low
A range of effect values compatible with your data at the chosen confidence level.
icc2_high
A range of effect values compatible with your data at the chosen confidence level.
icc3
The share of variance due to differences between groups (or raters' agreement on the same subjects).
icc3_low
A range of effect values compatible with your data at the chosen confidence level.
icc3_high
A range of effect values compatible with your data at the chosen confidence level.
icc1k
The share of variance due to differences between groups (or raters' agreement on the same subjects).
icc1k_low
A range of effect values compatible with your data at the chosen confidence level.
icc1k_high
A range of effect values compatible with your data at the chosen confidence level.
icc2k
The share of variance due to differences between groups (or raters' agreement on the same subjects).
icc2k_low
A range of effect values compatible with your data at the chosen confidence level.
icc2k_high
A range of effect values compatible with your data at the chosen confidence level.
icc3k
The share of variance due to differences between groups (or raters' agreement on the same subjects).
icc3k_low
A range of effect values compatible with your data at the chosen confidence level.
icc3k_high
A range of effect values compatible with your data at the chosen confidence level.

Per group, level or term: null_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 closed-form kernel (codesplash.stats.agreement.icc ↔ cs_icc, psych::ICC formulas); intervals invert F quantiles (scipy ↔ qf), including a non-integer df for ICC(A,1).
Python

The exact script CodeSplash ran for example “Shrout fleiss” · 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 c101d4542ff88d44
# Dataset: shrout_fleiss (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/shrout_fleiss.parquet", columns=["j1", "j2", "j3", "judge 4"])
n_input = len(df)
df = df.dropna(subset=["j1", "j2", "j3", "judge 4"])  # 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, ["j1", "j2", "j3", "judge 4"])  # infinite values stop the run (registry/errors.yaml)

# %% Intraclass correlations
raters = ["j1", "j2", "j3", "judge 4"]
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-random", "agreement", "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,
})
R

The exact script CodeSplash ran for example “Shrout fleiss” · 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 c101d4542ff88d44
# Dataset: shrout_fleiss (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/shrout_fleiss.parquet", col_select = c("j1", "j2", "j3", "judge 4")))
n_input <- nrow(df)
df <- df[stats::complete.cases(df[c("j1", "j2", "j3", "judge 4")]), , 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("j1", "j2", "j3", "judge 4"))  # infinite values stop the run (registry/errors.yaml)

# %% Intraclass correlations
raters <- c("j1", "j2", "j3", "judge 4")
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-random"
kind <- "agreement"
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
))

Sources

  • Shrout, P. E., & Fleiss, J. L. (1979). Intraclass correlations: uses in assessing rater reliability. Psychological Bulletin, 86, 420–428.
  • McGraw, K. O., & Wong, S. P. (1996). Forming inferences about some intraclass correlation coefficients. Psychological Methods, 1, 30–46.
  • Koo, T. K., & Li, M. Y. (2016). A guideline of selecting and reporting intraclass correlation coefficients for reliability research. Journal of Chiropractic Medicine, 15, 155–163.

From the CodeSplash method registry · agreement.icc v1.1.1.