GAgreement & reliability · agreement.ccc
Concordance correlation (Lin's CCC)
How closely do paired measurements fall on the line of perfect agreement?
Lin's concordance correlation coefficient combines precision (how tightly points follow a line, Pearson's r) and accuracy (how close that line is to y = x, the bias correction factor C_b). Reports the CCC with the Fisher-z interval of Lin (2000) and the location and scale shifts.
A real result
Example “Pefr”, recorded in both engines. In the app, “Try this example” loads it into Analyze.
ρ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.
ρ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.
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
- Pefrpefr · method_a: wright · method_b: mini wright
- Scores missingratings_sim · method_a: score_1 · method_b: score_3
- Attitude shiftattitude · method_a: rating · method_b: complaints
- Degenerate constantpefr · method_a: wright · method_b: mini wright
- Degenerate n2pefr · method_a: wright · method_b: mini wright
In the guides
Where it sits in the decision guides
- Concordance: CCC, Deming, Passing–Bablok · Statistics Guide · G — Agreement / reliability
What you need
- Method Anumeric · 1 column
- Readings by the first method (or rater).
- Method Bnumeric · 1 column
- Readings by the second method on the same subjects.
Choices you make
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.
Sample size
The z-transform interval needs a reasonable number of pairs (≥ 10).
Location and scale shifts
C_b below 1 shows systematic bias (location shift u) or unequal spread (scale shift v).
What it reports
- ccc
- Measures how close paired values fall to the identity line, so it penalizes bias as well as scatter.
- ccc_low
- A range of effect values compatible with your data at the chosen confidence level.
- ccc_high
- A range of effect values compatible with your data at the chosen confidence level.
- r
- A number from −1 to 1 for how closely two variables move together; Pearson measures straight-line association.
- cb
- Measures how close paired values fall to the identity line, so it penalizes bias as well as scatter.
- u
- Measures how close paired values fall to the identity line, so it penalizes bias as well as scatter.
- v
- Measures how close paired values fall to the identity line, so it penalizes bias as well as scatter.
- n
- How many independent units the analysis used; it sets precision and power.
- mean_a
- The sum divided by the count; the balance point of the data, pulled by extreme values.
- mean_b
- The sum divided by the count; the balance point of the data, pulled by extreme values.
- sd_a
- The typical distance of values from their mean, in the data's own units.
- sd_b
- The typical distance of values from their mean, in the data's own units.
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 (codesplash.stats.agreement.ccc ↔ cs_ccc): biased moments as Lin (1989), interval as DescTools::CCC(ci = "z-transform").
The exact script CodeSplash ran for example “Pefr” · 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,
})
The exact script CodeSplash ran for example “Pefr” · 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
))
Sources
- Lin, L. I.-K. (1989). A concordance correlation coefficient to evaluate reproducibility. Biometrics, 45, 255–268.
- Lin, L. I.-K. (2000). A note on the concordance correlation coefficient. Biometrics, 56, 324–325.
- McBride, G. B. (2005). A proposal for strength-of-agreement criteria for Lin's concordance correlation coefficient. NIWA Client Report HAM2005-062.
From the CodeSplash method registry · agreement.ccc v1.0.1.