Agreement is not correlation
Two instruments can correlate almost perfectly and still disagree by amounts that matter. Learn the question agreement methods ask, and which one fits your data.
What runs in CodeSplash
- Concordance correlation (Lin's CCC) Verified in Python and R
You will be able to
- Explain why a high correlation doesn't show that two measures agree
- Distinguish agreement, consistency and reliability
- Choose an agreement method from the data type and the number of raters
Do these two agree?
ReadSay a new thermometer always reads exactly 5 degrees higher than the old one. Their correlation is a perfect 1. Yet no nurse could swap one for the other.
CorrelationCorrelation coefficientA number from −1 to 1 for how closely two variables move together; Pearson measures straight-line association. asks whether two measures move together. Agreement asks whether they give the same value. These are different questions, and most agreement mistakes come from answering the first when you meant the second.
Make a guess
PredictPredict first
Two peak-flow meters, the Wright and the Mini Wright, were used on the same 17 people. Their correlation is very high, close to 0.94.
For one person, how close would you expect the two readings to be?
Reveal
Far apart. Correlation is 0.943, but 95% of differences fall between −78 and 74 liters per minute. People here vary so widely in lung function that correlation looks excellent even when individual readings disagree.
Try to fool the correlation
ExploreWiden the spread of the true values and watch the correlation climb while the disagreement stays the same. Then find a setting with a correlation above 0.95 and limits more than 15 units wide.
GExplorable · Building a Bland–Altman plot
Why can two methods correlate highly and still disagree?
What is the correlation between the two methods?
Method A against method B: r = 0.999
Difference against mean
Commit your prediction above to see the result
Make your prediction to see the result.
Concordance: correlation with a penalty
ReadLin's concordance correlationConcordance correlationMeasures how close paired values fall to the identity line, so it penalizes bias as well as scatter. starts from Pearson's and penalizes any shift from the 45° line:
falls below 1 when the two measures differ in mean or spread.
Here = 0.943 and = 0.999, giving = 0.943. The meters have almost no average bias, so stays high. It is still a single number that depends on how spread out your subjects are, so report it beside limits of agreement rather than instead of them.
ρc = .94, 95% CI [.85, .98]
- CCC
- 0.9427
- 95% CI
- [0.8505, 0.9787]
- Precision (r)
- 0.9433
- Accuracy (C_b)
- 0.9994
Effect size
- Lin's CCC 0.9427 95% CI [0.8505, 0.9787]
Plots
View data
| wright | mini wright |
|---|---|
| 494 | 512 |
| 395 | 430 |
| 516 | 520 |
| 434 | 428 |
| 476 | 500 |
| 557 | 600 |
| 413 | 364 |
| 442 | 380 |
| 650 | 658 |
| 433 | 445 |
| 417 | 432 |
| 656 | 626 |
| 267 | 260 |
| 478 | 477 |
| 178 | 259 |
| 423 | 350 |
| 427 | 451 |
Assumptions
- Sample size — 17 pairs.
- Location and scale shifts — C_b = 0.999 (location shift u = -0.019, scale shift v = 1.028).
Descriptives
| Method | Mean | SD (n denominator) |
|---|---|---|
| wright | 450.35 | 112.84 |
| mini wright | 452.47 | 109.74 |
- Moments use n in the denominator (Lin 1989). u = (mean A − mean B)/√(sd A · sd B); v = sd A / sd B.
The exact R script · R R version 4.5.1 (2025-06-13)
# Concordance correlation (Lin's CCC)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method agreement.ccc 1.0.1 · spec 8ea0553bd6ed8b95
# Dataset: pefr (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/pefr.parquet", col_select = c("wright", "mini wright")))
n_input <- nrow(df)
df <- df[stats::complete.cases(df[c("wright", "mini wright")]), , 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("wright", "mini wright")) # infinite values stop the run (registry/errors.yaml)
# %% Concordance correlation
a_name <- "wright"
b_name <- "mini wright"
a <- as.numeric(df[[a_name]])
b <- as.numeric(df[[b_name]])
n <- length(a)
cs_check_rows(n, 3, "Lin's concordance correlation") # needs at least three pairs
# A method with one reading for every subject has no variance: the correlation r and C_b are undefined.
cs_check_not_constant(a, a_name)
cs_check_not_constant(b, b_name)
conf <- 0.95
res <- cs_ccc(a, b, conf) # twin of codesplash.stats.agreement.ccc (DescTools::CCC conventions)
values <- list(ccc = res$ccc, ccc_low = res$ci_low, ccc_high = res$ci_high, r = res$r, cb = res$cb, u = res$u, v = res$v,
n = n, mean_a = res$mean_a, mean_b = res$mean_b, sd_a = res$sd_a, sd_b = res$sd_b)
# %% Assumptions
assumptions <- list(
list(key = "sample_size", label = "Sample size", status = if (n < 10) "warn" else "pass",
detail = paste0(sprintf("%d pairs", n), if (n < 10) " — the interval is unreliable." else ".")),
list(key = "accuracy", label = "Location and scale shifts", status = if (res$cb < 0.9) "warn" else "pass",
detail = paste0(sprintf("C_b = %.3f (location shift u = %.3f, scale shift v = %.3f)", res$cb, res$u, res$v),
if (res$cb < 0.9) " — systematic differences between the methods lower the concordance." else "."))
)
# %% Result
pct <- sprintf("%.0f%%", conf * 100)
take <- if (n <= 5000) seq_len(n) else unique(round(seq(1, n, length.out = 5000)))
cs_publish(list(
method = "agreement.ccc",
methodVersion = "1.0.1",
title = sprintf("Concordance: %s vs %s", a_name, b_name),
engine = cs_engine_info("stats", "codesplashr"),
n = n,
summary = sprintf("Lin's CCC = %.3f, %s CI [%.3f, %.3f] (precision r = %.3f, accuracy C_b = %.3f).", res$ccc, pct, res$ci_low, res$ci_high, res$r, res$cb),
apa = sprintf("ρc = %s, %s CI [%s, %s]", cs_fmt_num(res$ccc, 2, leading_zero = FALSE), pct, cs_fmt_num(res$ci_low, 2, leading_zero = FALSE),
cs_fmt_num(res$ci_high, 2, leading_zero = FALSE)),
statistics = list(list(key = "ccc", label = "CCC", value = res$ccc), list(key = "ci", label = paste(pct, "CI"), value = c(res$ci_low, res$ci_high)),
list(key = "r", label = "Precision (r)", value = res$r), list(key = "cb", label = "Accuracy (C_b)", value = res$cb)),
tables = list(list(key = "descriptives", title = "Descriptives", columns = list(
list(key = "method", label = "Method", type = "string"), list(key = "mean", label = "Mean", type = "number"),
list(key = "sd", label = "SD (n denominator)", type = "number")
), rows = list(list(method = a_name, mean = res$mean_a, sd = res$sd_a), list(method = b_name, mean = res$mean_b, sd = res$sd_b)))),
effectSizes = list(list(key = "ccc", label = "Lin's CCC", value = res$ccc, ciLow = res$ci_low, ciHigh = res$ci_high,
ciLevel = conf, method = "Fisher z-transform interval (Lin 2000)")),
assumptions = assumptions,
warnings = warnings,
notes = list("Moments use n in the denominator (Lin 1989). u = (mean A − mean B)/√(sd A · sd B); v = sd A / sd B."),
charts = list(cs_chart("scatter", "scatter", sprintf("%s against %s", b_name, a_name), list(
x = cs_col(a_name, a[take], "numeric"), y = cs_col(b_name, b[take], "numeric")
), controls = list(fit = "none"))),
values = values
))
ρc = .94, 95% CI [.85, .98]
- CCC
- 0.9427
- 95% CI
- [0.8505, 0.9787]
- Precision (r)
- 0.9433
- Accuracy (C_b)
- 0.9994
Effect size
- Lin's CCC 0.9427 95% CI [0.8505, 0.9787]
To keep this page light, the plots are shown once, under the R tab.
Assumptions
- Sample size — 17 pairs.
- Location and scale shifts — C_b = 0.999 (location shift u = -0.019, scale shift v = 1.028).
Descriptives
| Method | Mean | SD (n denominator) |
|---|---|---|
| wright | 450.35 | 112.84 |
| mini wright | 452.47 | 109.74 |
- Moments use n in the denominator (Lin 1989). u = (mean A − mean B)/√(sd A · sd B); v = sd A / sd B.
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Concordance correlation (Lin's CCC)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method agreement.ccc 1.0.1 · spec 8ea0553bd6ed8b95
# Dataset: pefr (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
import numpy as np
import pandas as pd
import codesplash as cs
from codesplash.errors import check_not_constant
from codesplash.stats import agreement as ag # Lin's CCC (twin of R's cs_ccc, DescTools::CCC conventions)
# %% Data
df = pd.read_parquet("tests/parity/fixtures/pefr.parquet", columns=["wright", "mini wright"])
n_input = len(df)
df = df.dropna(subset=["wright", "mini wright"]) # 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, ["wright", "mini wright"]) # infinite values stop the run (registry/errors.yaml)
# %% Concordance correlation
a_name, b_name = "wright", "mini wright"
a = df[a_name].to_numpy(dtype=float)
b = df[b_name].to_numpy(dtype=float)
n = len(a)
cs.check_rows(n, 3, "Lin's concordance correlation") # needs at least three pairs
# A method with one reading for every subject has no variance: the correlation r and C_b are undefined.
check_not_constant(a, a_name)
check_not_constant(b, b_name)
conf = 0.95
res = ag.ccc(a, b, conf)
values = {key: float(res[key]) for key in ("ccc", "ci_low", "ci_high", "r", "cb", "u", "v", "mean_a", "mean_b", "sd_a", "sd_b")}
values["ccc_low"], values["ccc_high"] = values.pop("ci_low"), values.pop("ci_high")
values["n"] = float(n)
# %% Assumptions
assumptions = [
{"key": "sample_size", "label": "Sample size", "status": "warn" if n < 10 else "pass",
"detail": f"{n} pairs" + (" — the interval is unreliable." if n < 10 else ".")},
{"key": "accuracy", "label": "Location and scale shifts", "status": "warn" if res["cb"] < 0.9 else "pass",
"detail": f"C_b = {res['cb']:.3f} (location shift u = {res['u']:.3f}, scale shift v = {res['v']:.3f})"
+ (" — systematic differences between the methods lower the concordance." if res["cb"] < 0.9 else ".")},
]
# %% Result
pct = f"{conf:.0%}"
take = np.arange(n) if n <= 5000 else np.unique(np.round(np.linspace(0, n - 1, 5000)).astype(int))
cs.publish({
"method": "agreement.ccc",
"methodVersion": "1.0.1",
"title": f"Concordance: {a_name} vs {b_name}",
"engine": cs.engine_info("numpy", "scipy", "codesplash"),
"n": int(n),
"summary": f"Lin's CCC = {res['ccc']:.3f}, {pct} CI [{res['ci_low']:.3f}, {res['ci_high']:.3f}] (precision r = {res['r']:.3f}, accuracy C_b = {res['cb']:.3f}).",
"apa": f"ρc = {cs.fmt_num(res['ccc'], 2, leading_zero=False)}, {pct} CI [{cs.fmt_num(res['ci_low'], 2, leading_zero=False)}, {cs.fmt_num(res['ci_high'], 2, leading_zero=False)}]",
"statistics": [{"key": "ccc", "label": "CCC", "value": res["ccc"]}, {"key": "ci", "label": f"{pct} CI", "value": [res["ci_low"], res["ci_high"]]},
{"key": "r", "label": "Precision (r)", "value": res["r"]}, {"key": "cb", "label": "Accuracy (C_b)", "value": res["cb"]}],
"tables": [{"key": "descriptives", "title": "Descriptives", "columns": [
{"key": "method", "label": "Method", "type": "string"}, {"key": "mean", "label": "Mean", "type": "number"},
{"key": "sd", "label": "SD (n denominator)", "type": "number"},
], "rows": [{"method": a_name, "mean": res["mean_a"], "sd": res["sd_a"]}, {"method": b_name, "mean": res["mean_b"], "sd": res["sd_b"]}]}],
"effectSizes": [{"key": "ccc", "label": "Lin's CCC", "value": res["ccc"], "ciLow": res["ci_low"], "ciHigh": res["ci_high"],
"ciLevel": conf, "method": "Fisher z-transform interval (Lin 2000)"}],
"assumptions": assumptions,
"warnings": warnings,
"notes": ["Moments use n in the denominator (Lin 1989). u = (mean A − mean B)/√(sd A · sd B); v = sd A / sd B."],
"charts": [cs.chart("scatter", "scatter", f"{b_name} against {a_name}", {
"x": cs.col(a_name, a[take], "numeric"), "y": cs.col(b_name, b[take], "numeric"),
}, controls={"fit": "none"})],
"values": values,
})
Pick the right tool
CheckpointCheck yourself
Three pathologists each grade 100 slides as low, medium or high, and some grades are missing. Which family fits?
Show the answer
Answer: c
Ordered categories, more than two raters and missing ratings all point to Krippendorff's α or Gwet's AC2. Limits of agreement need numeric measurements.
Check yourself
A new device correlates at r = 0.99 with the reference. A manager says this shows the devices are interchangeable. What do you answer?
Show the answer
Answer: b
Correlation ignores offsets and scale changes. Agreement is judged on the differences, against what's acceptable in practice.
Check yourself
Lin's coefficient is times the bias correction . With = 0.943 and = 0.999, what's ? Give three decimals.
Show the answer
Answer: 0.942742431427485
Multiply them. is close to 1 because these meters have almost no average bias, so stays close to .
Find the methods
In the appAgreement methods are in the Agreement family of the Analyze rail. Open the concordance example, then look at what else sits beside it: Cohen's κ, Fleiss' κ, ICC, Bland–Altman and more.
| Your data | Two raters | Several raters |
|---|---|---|
| Categories | Cohen's κ | Fleiss' κ, Krippendorff's α, Gwet's AC1 |
| Ordered categories | Weighted κ | Krippendorff's α, Gwet's AC2 |
| Numbers | Bland–Altman, CCC, method comparison | ICC |
Recap
Recap- Correlation asks whether values move together; agreement asks whether they are the same.
- A wide range of subjects inflates correlation without improving agreement.
- Judge agreement in the original units, against a limit you chose in advance.
Concepts in this lesson