LLM JUDGES // FIELD MAP
← Front Door ← the map
APPENDIX · THE MATHSagreement · validity · ranking · uncertainty

Appendix: the maths, worked

Every number on the site, derived and worked by hand on the shared casebook. The arithmetic is the same in every domain; only the nouns change. Turn on Technical in the top bar for exact definitions in the term boxes and a few extra derivations.
TL;DR — Three families. Agreement statistics (kappa, pi, Fleiss, alpha, weighted kappa) compare judges with each other, minus what chance would give. Validity statistics (sensitivity, specificity, precision, J, ROC, AUC) compare a judge with the truth. Uncertainty statistics (Wilson intervals, kappa's standard error, the bootstrap) say how far any of them would move on another sample. Each is a few lines of arithmetic on a small table, done here in full.

Each section states a formula, its source, and works it on the casebook numbers, computed by script and re-derived by hand (unrounded value first). Notation: n items, p a proportion, and a 2×2 table with cells a, b, c, d left to right, top to bottom.

The casebook has three groups of numbers. A two-judge table of 100 items for agreement, rated by interviewers Ana and Benmanagers Carla and Devjudges Elodie and FemiDr Gale and Dr Hart, double readingumpires Ivo and June, calling the same pitches on video; a three-judge version of 100 items; and a judge-versus-truth table of 200 items, 60 of them truly YES, where the truth is how the hire did a year later (an idealised study: only hires get an outcome)a calibration committee's consensus rating, since reviews have no outside trutha reference panel's verdict, since wine quality has no outside truthbiopsy or a year of clean follow-upthe pitch-tracking camera and the rulebook zone. The YES label is “hire”“exceeds expectations”“medal”“recall the patient”“strike”; for an LLM judge it is “passes the policy”.

Agreement beyond chance: percent agreement, Cohen's kappa, Scott's pi

Each of 100 items is judged by both judges; the table counts the four pairs of verdicts.

Judge B says YESJudge B says NORow total
Judge A says YES45 (a)15 (b)60
Judge A says NO10 (c)30 (d)40
Column total5545100

Here judge A is AnaCarlaElodieDr GaleIvo and judge B is BenDevFemiDr HartJune. For an LLM judge, A and B are two human labelers, or one labeler and the model.

Percent agreement is the share on the diagonal:

po = (a + d) / n
Worked

po = (45 + 30) / 100 = 0.75.

But judges who never looked would still agree sometimes. If A says YES 60% of the time and B 55%, independently, both say YES on 0.60 × 0.55 of items and both NO on 0.40 × 0.45. The sum is chance agreement, built from the marginal totals:

pe = pA,yes · pB,yes + pA,no · pB,no
Worked

pA,yes = 60/100 = 0.60, pB,yes = 55/100 = 0.55.

pe = 0.60 × 0.55 + 0.40 × 0.45 = 0.33 + 0.18 = 0.51.

Cohen's kappa (Cohen 1960) is the share of the room above chance the judges used: agreement beyond chance over the most that was possible.

κ = (po − pe) / (1 − pe)
Worked

κ = (0.75 − 0.51) / (1 − 0.51) = 0.24 / 0.49 = 0.4898 ≈ 0.49.

The judges closed about half the gap between chance and perfect agreement: “moderate” on the widely quoted, admittedly arbitrary Landis and Koch bands (0.41–0.60; Landis and Koch 1977).

Kappa is 1 for perfect agreement, 0 at chance, negative below it. It is not a percentage: 0.49 does not mean “they agree 49% of the time”.

Scott's pi (Scott 1955) uses the same formula but takes chance from the pooled YES rate, as if both judges drew from one distribution; kappa lets each keep their own.

p̄ = (pA,yes + pB,yes) / 2    pe,π = p̄² + (1 − p̄)²    π = (po − pe,π) / (1 − pe,π)
Worked

p̄ = (0.60 + 0.55) / 2 = 0.575. pe,π = 0.575² + 0.425² = 0.330625 + 0.180625 = 0.51125.

π = (0.75 − 0.51125) / (1 − 0.51125) = 0.23875 / 0.48875 = 0.4885 ≈ 0.489.

Pi is never larger than kappa, since pooling can only raise chance agreement; 60% against 55% moves only the third decimal. The choice is what “chance” means: kappa credits different thresholds to the judges, pi counts them as disagreement.

Why pi ≤ kappa: pe,π − pe = (pA,yes − pB,yes)² / 2 ≥ 0. Here (0.05)² / 2 = 0.00125 = 0.51125 − 0.51.

What the 0.49 means at a hiring panel

Ana says hire on 60 of 100 and Ben on 55. Weighted coins would agree on 51; they agree on 75, capturing 24 of the 49 agreements chance left open. Usable, but neither can stand in for the other.

What the 0.49 means in calibration

Carla rates 60 of 100 “exceeds” and Dev 55. Rating blind at those rates would match on 51; they match on 75. Half the possible agreement above chance, so calibration still has plenty to argue about.

What the 0.49 means at the tasting table

Elodie medals 60 of 100 wines and Femi 55. Random medals at those rates would agree on 51; they agree on 75. Something real is tasted, but swapping judges changes about one verdict in four.

What the 0.49 means in double reading

Dr Gale recalls 60 of 100 and Dr Hart 55 (an enriched test set). Independent readers at those rates would agree on 51; they agree on 75. Double reading exploits the gap: each catches what the other misses.

What the 0.49 means behind the plate

Ivo calls 60 of 100 borderline pitches strikes and June 55. Blind calls at those rates would agree on 51; they agree on 75. Moderate agreement on borderline pitches is why the camera exists.

The kappa paradoxes: high agreement, low kappa

Now make YES rare: both say NO on 90 of 100 items, both YES on 2, and they split 4 and 4.

B YESB NOTotal
A YES246
A NO49094
Total694100
Worked

po = (2 + 90) / 100 = 0.92.

Each judge says YES on 6%. pe = 0.06 × 0.06 + 0.94 × 0.94 = 0.0036 + 0.8836 = 0.8872.

κ = (0.92 − 0.8872) / (1 − 0.8872) = 0.0328 / 0.1128 = 0.2908 ≈ 0.29.

92% agreement, poor-looking kappa, and nothing broken. When nearly everything is NO, chance agreement is already 0.887, leaving 0.113 to earn; of the 10 items where either judge said YES, they agreed on 2. Kappa reports that correctly.

Feinstein and Cicchetti named two kappa paradoxes (Feinstein and Cicchetti 1990). First, the one above: unbalanced marginals drag a high po down. Second, kappa comes out higher when the judges' marginals are unbalanced in opposite directions. On the casebook: keep po = 0.75 but put all 25 disagreements in one cell (A YES, B NO), so YES rates become 70% and 45%. Chance falls to 0.70 × 0.45 + 0.30 × 0.55 = 0.48 and kappa rises to (0.75 − 0.48) / 0.52 = 0.519, though the judges now disagree more systematically.

Try thisCasebook, then one-sided disagreement: agreement stays at 75% while kappa rises from 0.49 to 0.52. Then the kappa paradox: 92% agreement, kappa 0.29. Drag prevalence toward 0% to watch the chance bar swallow the room.

Byrt, Bishop and Carlin made it bookkeeping (Byrt et al. 1993): a prevalence index, a bias index and PABAK, with kappa a function of the three:

PI = (a − d) / n    BI = (b − c) / n    PABAK = 2po − 1    κ = (PABAK − PI² + BI²) / (1 − PI² + BI²)
TablepoPIBIPABAKκ from the identity
Casebook two judges (45, 15, 10, 30)0.750.150.050.50(0.50 − 0.0225 + 0.0025) / (1 − 0.0225 + 0.0025) = 0.49
Rare YES (2, 4, 4, 90)0.92−0.8800.84(0.84 − 0.7744) / (1 − 0.7744) = 0.29
Lopsided disagreement (45, 25, 0, 30)0.750.150.250.50(0.50 − 0.0225 + 0.0625) / (1 − 0.0225 + 0.0625) = 0.519

The identity makes both paradoxes mechanical: a large prevalence index is squared and subtracted, dragging kappa down; a bias index is squared and added, so one-directional disagreement gets a bump. The companion paper says always report agreement on positives and on negatives beside kappa (Cicchetti and Feinstein 1990).

ppos = 2a / (2a + b + c)    pneg = 2d / (2d + b + c)
Worked

Rare YES: ppos = 4 / 12 = 0.333; pneg = 180 / 188 = 0.957. They agree on NO and barely on YES, which explains the 0.29 better than the 0.29 does.

Casebook two judges: ppos = 90 / 115 = 0.783; pneg = 60 / 85 = 0.706.

Rare YES in hiring

A senior role with 6 hires per 100. Ana and Ben agree on 92 verdicts, but of the 10 people either wanted, they agreed on 2. The 92% is mostly agreeing who is not a fit.

Rare YES in reviews

“Exceeds” goes to about 6%. Carla and Dev match on 92 of 100 ratings but on only 2 of the 10 either put forward: calibrated-looking, split on almost everyone who matters.

Rare YES in wine

A strict show medals about 6%. Elodie and Femi agree on 92 of 100 glasses, nearly all “no medal”, and on 2 of the 10 either wanted to medal: weakest where people read.

Rare YES in screening

The textbook case. Dr Gale and Dr Hart agree on 92 of 100 reads, nearly all “clear”, but on 2 of the 10 patients either wanted recalled.

Rare YES behind the plate

On pitches well outside the zone, Ivo and June agree on 92 of 100, mostly obvious balls, but on 2 of the 10 either called a strike. Pitches nobody would miss inflate the number.

For LLM judges this is the common case: a safety or hallucination judge hunts a failure in a few percent of outputs, so “95% agreement with humans” can sit beside kappa 0.3. Report ppos and pneg, or use the confusion matrix below. See Igor's notes on agreement, kappa and friends.

Fleiss' kappa: three or more judges

With three judges there is no single 2×2 table. Fleiss' kappa (Fleiss 1971) asks, item by item, what fraction of judge pairs agree, and compares the average with chance from pooled category rates; pooling makes it a generalised Scott's pi, not Cohen's kappa. The casebook's 100 items, by YES votes:

YES votes on the itemItemsAgreeing pairs of 3PiYES votes cast
3 (unanimous YES)3531105
21511/330
11211/312
0 (unanimous NO)38310
Total100246 of 300147 of 300

With m judges and nij votes for category j, item agreement is the matching share of the m(m − 1) ordered pairs:

Pi = Σj nij(nij − 1) / (m(m − 1))    P̄ = mean of Pi    pj = share of all votes in category j    Pe = Σj pj²    κF = (P̄ − Pe) / (1 − Pe)
Worked

Unanimous item: (3·2 + 0) / 6 = 1. Split item (2 YES, 1 NO): (2·1 + 1·0) / 6 = 1/3.

P̄ = (73 × 1 + 27 × 1/3) / 100 = (73 + 9) / 100 = 0.82. That is the mean pairwise agreement: 246 of the 300 judge pairs agree.

pyes = 147 / 300 = 0.49. Pe = 0.49² + 0.51² = 0.2401 + 0.2601 = 0.5002.

κF = (0.82 − 0.5002) / (1 − 0.5002) = 0.3198 / 0.4998 = 0.6399 ≈ 0.64.

73 items are unanimous; the 27 others split 2–1, the only split three judges and two labels allow. The single number hides which items split, and those are the useful output: the ones worth a human read.

Three interviewers

Three interviewers per candidate: 35 unanimous hires, 38 unanimous no-hires, 27 splits. The debrief belongs to the 27; the 0.64 says unanimity means something.

Three managers

Three managers per employee: 73 unanimous, 27 split. Equal time on all 100 wastes most of the meeting; the 27 show where the definitions fail.

A panel of three

Three judges per wine: 35 unanimous medals, 38 unanimous no-medals, 27 splits, which go to discussion or a fourth taster.

Three readers

Three readers per image: 73 unanimous, 27 split. Arbitration exists for the 27; at 0.64 the unanimous reads can mostly be trusted.

Three umpires on video

Three umpires on the same video: 73 unanimous, 27 split 2–1, near the edge of the zone, where the camera decides anyway.

Krippendorff's alpha: the coincidence matrix

Krippendorff's alpha (Hayes and Krippendorff 2007) is written in disagreement and handles any number of judges, missing ratings and ordered or numeric scales in one formula:

α = 1 − Do / De    (observed disagreement over expected disagreement)

The device is the coincidence matrix. Forget which judge said what. For each item, add every ordered pair of values from different judges to a values-by-values table, weighted 1/(mu − 1), where mu judges rated the item. Each rating then contributes one unit, so the table sums to the n ratings; it is symmetric, matches sit on the diagonal, and row totals nv count each value's use. For any distance δ:

α = 1 − (n − 1) · Σ ovv' δ(v, v') / Σ nv nv' δ(v, v')

This is the form in the Krippendorff's alpha article's worked example; (n − 1) is the small-sample correction for drawing two values without replacement.

Values, not judges: green cells match, red cells mismatch, margins count each value's use. Which interviewer said hire no longer matters, only how often hire met no hire on the same candidate.Which manager said exceeds no longer matters, only how often exceeds met meets on the same employee.Which judge medalled the wine no longer matters, only how often medal met no medal on the same glass.Which reader recalled the patient no longer matters, only how often recall met clear on the same image.Which umpire called the strike no longer matters, only how often strike met ball on the same pitch.
Worked · two judges

Each item has m = 2 ratings, so each item contributes its two ordered pairs with weight 1/(2 − 1) = 1. The 45 both-YES items give 90 YES-YES entries; the 30 both-NO items give 60 NO-NO; the 15 + 10 = 25 split items give 25 YES-NO and 25 NO-YES. Totals: nyes = 90 + 25 = 115, nno = 60 + 25 = 85, n = 200.

Nominal distance: δ = 1 for different values, 0 for the same. Σ o δ = 25 + 25 = 50. Σ nvnv'δ = 115·85 + 85·115 = 19,550.

α = 1 − 199 × 50 / 19,550 = 1 − 9,950 / 19,550 = 1 − 0.5090 = 0.4910 ≈ 0.491.

Equivalently Do = 50/200 = 0.25 and De = 19,550 / (200 × 199) = 0.4912, so α = 1 − 0.25/0.4912.

Worked · three judges

Now m = 3, so each item has 3 × 2 = 6 ordered pairs, each weighted 1/2. A unanimous YES item puts 6 × ½ = 3 into YES-YES; 35 of them give 105. A 2–1 YES item has 2 YES-YES pairs (1 entry), and 4 mixed pairs (2 entries, split 1 YES-NO and 1 NO-YES); 15 of them give 15 YES-YES and 15 in each mixed cell. A 1–2 item gives 1 NO-NO entry and 1 in each mixed cell; 12 of them give 12 NO-NO and 12 per mixed cell. Unanimous NO: 38 × 3 = 114 NO-NO.

oyes,yes = 105 + 15 = 120; ono,no = 114 + 12 = 126; oyes,no = ono,yes = 15 + 12 = 27. nyes = 147, nno = 153, n = 300.

α = 1 − 299 × 54 / (2 × 147 × 153) = 1 − 16,146 / 44,982 = 1 − 0.3589 = 0.6411 ≈ 0.641.

Alpha lands just above pi and Fleiss (0.491 against 0.489; 0.641 against 0.640): the (n − 1) correction, negligible at 200 ratings, real at 20. All three pool value frequencies for chance, so on complete binary data they nearly coincide; alpha earns its keep on missing ratings (a skipped item just contributes fewer pairs) and ordered scales.

For ordered scales only δ changes. Nominal: 1 if the values differ. Interval: (v − v')², so two points off costs four times one. Ordinal: a rank distance based on how many ratings fall between the values, respecting order without equal steps. On the next section's 3×3 table, nominal alpha is 0.535 and interval alpha 0.657 (from that table's coincidence matrix), close to unweighted and quadratic-weighted kappa.

Weighted kappa: partial credit for near misses

Plain kappa treats every disagreement alike, but “partial” against “pass” is smaller than “fail” against “pass”. Weighted kappa (Cohen 1968) weights each cell. In agreement-weight form, categories 1 to k:

linear: wij = 1 − |i − j| / (k − 1)    quadratic: wij = 1 − (i − j)² / (k − 1)²
po,w = Σ wij pij    pe,w = Σ wij pi· p·j    κw = (po,w − pe,w) / (1 − pe,w)

Off-diagonal weights of 0 give plain kappa. Quadratic-weighted kappa is equivalent to an intraclass correlation, so it behaves like a correlation on numeric scores (Fleiss and Cohen 1973).

An example built for this page, not the casebook: two judges grade 100 outputs on three levels: no hire / lean hire / hirebelow / meets / exceedsno medal / bronze / goldclear / short follow-up / recallball / too close / strike; for the LLM judge, fail / partial / pass.

A \ B1 (low)2 (mid)3 (high)Row
1 (low)208230
2 (mid)624636
3 (high)272534
Column283933100
Worked · weights for k = 3

Linear: diagonal 1, one step off 1 − 1/2 = 0.5, two steps off 0. Quadratic: diagonal 1, one step off 1 − 1/4 = 0.75, two steps off 1 − 4/4 = 0.

Observed. Diagonal = 20 + 24 + 25 = 69. One step off = 8 + 6 + 6 + 7 = 27. Two steps off = 2 + 2 = 4.

Unweighted po = 0.69. Linear po,w = (69 + 0.5 × 27) / 100 = 0.825. Quadratic po,w = (69 + 0.75 × 27) / 100 = 0.8925.

Chance. Expected counts are row × column / 100. Diagonal: 30·28 + 36·39 + 34·33 = 840 + 1,404 + 1,122 = 3,366, so 0.3366. One step off: 30·39 + 36·28 + 36·33 + 34·39 = 1,170 + 1,008 + 1,188 + 1,326 = 4,692, so 0.4692. Two steps off: 30·33 + 34·28 = 990 + 952 = 1,942, so 0.1942.

Unweighted pe = 0.3366. Linear pe,w = 0.3366 + 0.5 × 0.4692 = 0.5712. Quadratic pe,w = 0.3366 + 0.75 × 0.4692 = 0.6885.

Kappas. Unweighted: (0.69 − 0.3366) / 0.6634 = 0.533. Linear: (0.825 − 0.5712) / 0.4288 = 0.592. Quadratic: (0.8925 − 0.6885) / 0.3115 = 0.655.

One table, three kappas from 0.53 to 0.65, none wrong: most misses are one step, so more partial credit scores higher. The weighting is a policy choice to state up front, not a knob to turn after seeing results, and quadratic and unweighted kappas from different studies are not comparable.

The confusion matrix: judge against truth

Validity statistics compare a judge with the truth, starting from the confusion matrix. The casebook: 200 items, 60 truly YES.

Rows: how the judge treats each kind of item. Columns: how far to trust each verdict. Truth here is later job performance, an idealised study: in real hiring the no-hire column never gets an outcome.Truth here is the calibration committee's rating, not an outside fact; the matrix measures agreement with the committee.Truth here is a reference panel's verdict, not an outside fact; the matrix measures agreement with that panel.Truth here is biopsy or a clean year of follow-up, the strongest reference of the five.Truth here is the tracked pitch location against the rulebook zone.

TP = 48 truly YES, called YES; FN = 12 truly YES, called NO; FP = 21 truly NO, called YES; TN = 119 truly NO, called NO. Every validity statistic is a ratio of these.

StatisticFormulaWorkedValue
Sensitivity (recall, TPR)TP / (TP + FN)48 / 600.80
Specificity (TNR)TN / (TN + FP)119 / 1400.85
Precision (PPV)TP / (TP + FP)48 / 690.696
Negative predictive valueTN / (TN + FN)119 / 1310.908
Accuracy(TP + TN) / n167 / 2000.835
F12·P·R / (P + R) = 2TP / (2TP + FP + FN)96 / 1290.744
Judge's YES rate(TP + FP) / n69 / 2000.345
Prevalence(TP + FN) / n60 / 2000.30

Sensitivity and specificity divide by the truth (rows): they describe the judge and ignore prevalence. Precision and NPV divide by the verdict (columns): they describe a verdict's worth in this population and move with prevalence (base rates). Accuracy mixes both, so it is easy to game: always-NO scores 140/200 = 0.70 here with sensitivity 0. F1 ignores true negatives, so it suits tasks where only YES matters.

Treat the truth as a second judge and kappa follows from the same table: po = 0.835, pe = 0.345 × 0.30 + 0.655 × 0.70 = 0.1035 + 0.4585 = 0.562, κ = (0.835 − 0.562) / 0.438 = 0.623. Igor's notes on the confusion matrix walk the same cells from the testing side.

sensitivity
0.80
48 of 60 caught
specificity
0.85
119 of 140 cleared
precision
0.696
48 of 69 YES right
Youden's J
0.65
0.80 + 0.85 − 1

Youden's J: one number for a yes/no judge

Youden's single index for a diagnostic test (Youden 1950):

J = sensitivity + specificity − 1 = TPR − FPR
Worked

J = 0.80 + 0.85 − 1 = 0.65. Equivalently TPR − FPR = 0.80 − 0.15 = 0.65, since FPR = 1 − specificity = 21/140 = 0.15.

Always-YES judge: 1 + 0 − 1 = 0. Always-NO judge: 0 + 1 − 1 = 0. A coin flip at any bias: TPR = FPR, so J = 0.

The second form is the useful one: how much more often the judge says YES to truly-YES items than to truly-NO ones. A judge that ignores the item, however biased, scores 0; a perfect one 1; below 0 is informative but inverted. J does not reward matching the majority class and, being two row ratios, ignores prevalence.

Geometry. As a point (FPR, TPR) in ROC space, J is the height above the chance diagonal TPR = FPR: (0.15, 0.80) sits 0.65 above it. With a threshold to choose, J's best cut is the curve point farthest above the diagonal; Peirce published the same formula in 1884 (Youden's J).

Balanced accuracy is J in other units:

balanced accuracy = (sensitivity + specificity) / 2 = (J + 1) / 2
Worked

(0.80 + 0.85) / 2 = 0.825 = (0.65 + 1) / 2. Chance is 0.5 on this scale and 0 on J's.

J weighs a missed YES and a false YES equally per item of each class. With unequal costs, as in most domains, the best cut is the cost-weighted one, not J's maximum. J is a summary, not a decision rule.

Base rates: precision from sensitivity, specificity and prevalence

Precision is what people ask of a verdict: “it said YES; how likely is that right?” Bayes' rule gives it from the two row rates and the base rate π of truly-YES items:

precision = sens·π / (sens·π + (1 − spec)·(1 − π))    NPV = spec·(1 − π) / (spec·(1 − π) + (1 − sens)·π)
Worked · casebook, π = 30%

Numerator 0.80 × 0.30 = 0.24. False-YES mass 0.15 × 0.70 = 0.105.

precision = 0.24 / (0.24 + 0.105) = 0.24 / 0.345 = 0.696, matching 48/69 from the table. NPV = 0.595 / (0.595 + 0.06) = 0.908.

Worked · same judge, π = 5%, 1,000 items

50 truly YES, 950 truly NO. TP = 0.80 × 50 = 40. FP = 0.15 × 950 = 142.5.

precision = 40 / (40 + 142.5) = 40 / 182.5 = 0.219. NPV = 807.5 / (807.5 + 10) = 0.988.

For comparison (same formula): at π = 1%, precision = 0.008 / (0.008 + 0.1485) = 0.051; at π = 50%, 0.40 / 0.475 = 0.842.

Odds form: posterior odds = prior odds × LR+, with LR+ = sens / (1 − spec) = 0.80 / 0.15 = 5.33. At π = 30%: (0.3/0.7) × 5.33 = 2.29, so precision = 2.29 / 3.29 = 0.696. At 5%: (0.05/0.95) × 5.33 = 0.281, precision 0.219.

YES verdicts per 1,000 items, same judge in both rows. Lower prevalence shrinks green and grows red, because false YES calls come from the much larger truly-NO pool.

Only the mix of items changed, and precision fell from 0.70 to 0.22: nearly four YES verdicts in five wrong. That is why a judge validated on a balanced set disappoints on production traffic, where its target is rare.

Base rates in hiring

In a pool where 30% would do well, this interviewer's hires are right 70% of the time. In an open pool where 5% would, most people they pass are false positives, which is why a cheap screen comes before costlier rounds.

Base rates in reviews

If 30% truly exceed, this manager's “exceeds” is right about 70% of the time; if 5% do, it is wrong four times in five. One reason to calibrate against a distribution.

Base rates in wine

In a strong flight where 30% merit a medal, this judge's medals are right about 70% of the time. In an open show where 5% do, most go to wines the panel would not medal.

Base rates in screening

The screening problem in miniature: a reader good on a 30%-cancer study set sees precision collapse in screening, where cancer is far rarer than 5%. Most recalls are false alarms, accepted as the price of catches, which is why recall leads to more imaging, not treatment.

Base rates behind the plate

On borderline pitches, 30% in the zone, this umpire's strike calls are right 70% of the time; where 5% are strikes, most are wrong. The pitch mix matters as much as the umpire.

Building the ROC curve, threshold by threshold

Many judges emit a score (a 1–5 rating, a probability, a log-prob), and a threshold turns it into a verdict, each with its own confusion matrix. The ROC curve plots all of them (the “rating method” of Hanley and McNeil 1982). The casebook judge scores each of the 200 items 1 to 5, read as the interviewer's 1–5 scorecard ratingthe manager's 1–5 ratingthe judge's score sheet collapsed into five bandsthe radiologist's 1–5 suspicion rating, the classic reader-study designthe umpire's 1–5 confidence that it was a strike, in a video study:

Score12345Total
Truly YES items246202860
Truly NO items503831147140

Sweep from strict to lenient. At “YES if score ≥ t”, TP and FP count YES and NO items at or above t; divide by 60 and 140.

RuleTPFPTPR = TP/60FPR = FP/140J
never YES00000
score ≥ 52870.4670.0500.417
score ≥ 428 + 20 = 487 + 14 = 210.8000.1500.650
score ≥ 354520.9000.3710.529
score ≥ 258900.9670.6430.324
score ≥ 1 (always YES)60140110

The ≥ 4 row is the earlier confusion matrix (TP 48, FP 21) and maximises J: the Youden-optimal threshold. Joining the six points from (0, 0) to (1, 1) gives the empirical ROC curve.

Each corner is a threshold, each shaded strip a trapezoid of area. The red line is J at the best cut, the gap to the diagonal at FPR 0.15. Moving left along the curve means a stricter interviewer: fewer bad hires, more good candidates turned away.Moving left along the curve means a stingier manager: fewer undeserved exceeds, more deserved ones missed.Moving left along the curve means a stingier judge: fewer unearned medals, more good wines passed over.Moving left along the curve means a reader who recalls less: fewer false alarms, more cancers missed.Moving left along the curve means a tighter zone: fewer balls rung up, more strikes called balls.

Five score levels give straight segments, and ties make them diagonal rather than steps: items sharing a score fall on the same side of every threshold, and the line averages breaking the tie either way.

AUC: the trapezoids, and the Mann–Whitney reading

The area under the curve sums the trapezoids between consecutive points:

AUC = Σ (FPRk+1 − FPRk) · (TPRk + TPRk+1) / 2
Worked · five trapezoids

(0 → 0.05): 0.05 × (0 + 0.4667) / 2 = 0.0117

(0.05 → 0.15): 0.10 × (0.4667 + 0.80) / 2 = 0.0633

(0.15 → 0.3714): 0.2214 × (0.80 + 0.90) / 2 = 0.1882

(0.3714 → 0.6429): 0.2714 × (0.90 + 0.9667) / 2 = 0.2533

(0.6429 → 1): 0.3571 × (0.9667 + 1) / 2 = 0.3512

Sum = 0.8677, exactly 7,289 / 8,400, so AUC ≈ 0.868.

Hanley and McNeil's point: the area is a probability, that a random truly-YES item outscores a random truly-NO one, ties half (Hanley and McNeil 1982), which is what the Wilcoxon–Mann–Whitney statistic estimates. Check by counting all 60 × 140 = 8,400 (YES, NO) pairs.

Worked · counting pairs

For each YES score, count NO items strictly below it (wins) and at the same score (ties):

score 1: 2 YES × (0 below, 50 tied) → 0 wins, 100 ties

score 2: 4 × (50 below, 38 tied) → 200 wins, 152 ties

score 3: 6 × (88 below, 31 tied) → 528 wins, 186 ties

score 4: 20 × (119 below, 14 tied) → 2,380 wins, 280 ties

score 5: 28 × (133 below, 7 tied) → 3,724 wins, 196 ties

Wins = 6,832; ties = 914. AUC = (6,832 + 914 / 2) / 8,400 = 7,289 / 8,400 = 0.8677. Same number, to the last digit.

Keep the pair reading: shown one truly-YES and one truly-NO item, the judge ranks them right about 87% of the time. AUC is threshold-free, a strength (ranking quality before any cut) and a weakness (you deploy a cut, and equal-AUC judges can differ sharply there). It is blind to calibration: multiply every score by ten and nothing changes.

Hanley and McNeil also gave a closed-form standard error, using Q1 = A/(2 − A) and Q2 = 2A²/(1 + A) (form as given in GraphPad's calculation notes):

SE(A) = √[ (A(1 − A) + (n1 − 1)(Q1 − A²) + (n2 − 1)(Q2 − A²)) / (n1 n2) ]
Worked

A = 0.8677, n1 = 60 YES, n2 = 140 NO. Q1 = 0.8677 / 1.1323 = 0.7664. Q2 = 2 × 0.7530 / 1.8677 = 0.8063.

Numerator = 0.1148 + 59 × (0.7664 − 0.7530) + 139 × (0.8063 − 0.7530) = 0.1148 + 0.791 + 7.412 ≈ 8.32. SE = √(8.32 / 8,400) = 0.031.

Approximate 95% interval: 0.868 ± 1.96 × 0.031 = 0.81 to 0.93. (This SE is not in the shared casebook; it is computed for this page.)

Confidence intervals: Wilson, kappa's standard error, the bootstrap

Another 60 truly-YES items would give another sensitivity; a confidence interval says how far it could plausibly move. The textbook Wald interval, p̂ ± z√(p̂(1 − p̂)/n), has erratic coverage even at large n; Brown, Cai and DasGupta recommend Wilson (or Jeffreys) for small samples (Brown et al. 2001). The Wilson score interval (Wilson 1927) inverts the score test:

centre = (p̂ + z²/2n) / (1 + z²/n)    half-width = z √(p̂(1 − p̂)/n + z²/4n²) / (1 + z²/n)    z = 1.96 for 95%
Worked · sensitivity 48/60

p̂ = 0.80, n = 60, z² = 3.8416. Denominator 1 + 3.8416/60 = 1.06403.

Centre = (0.80 + 3.8416/120) / 1.06403 = (0.80 + 0.03201) / 1.06403 = 0.78195.

Inside the root: 0.80 × 0.20 / 60 + 3.8416 / 14,400 = 0.0026667 + 0.0002668 = 0.0029334; root 0.054161. Half-width = 1.96 × 0.054161 / 1.06403 = 0.09977.

Interval 0.78195 ± 0.09977 = 0.682 to 0.882. (Wald would give 0.699 to 0.901, centred on 0.80; Wilson pulls the centre toward 0.5.) Specificity 119/140 by the same steps: 0.782 to 0.900.

Worked · two-judge agreement 75/100

p̂ = 0.75, n = 100. Denominator 1.038416. Centre = (0.75 + 0.019208) / 1.038416 = 0.74075.

Root of 0.001875 + 0.00009604 = 0.0019710 → 0.044397. Half-width = 1.96 × 0.044397 / 1.038416 = 0.08380.

Interval = 0.657 to 0.825, so “0.66–0.83”.

Where Wilson comes from: keep every p with |p̂ − p| ≤ z√(p(1 − p)/n). Squaring gives (1 + z²/n)p² − (2p̂ + z²/n)p + p̂² ≤ 0, a quadratic whose two roots are the centre ± half-width above. The standard error uses the unknown p, not p̂, which is why the interval never leaves [0, 1].

Try thisThe first three presets are the worked examples above. Then drag items down to 20 and the rate toward 95%: the normal approximation runs past 1 while Wilson stays inside and pulls its centre toward 0.5.

Kappa's standard error. A common large-sample approximation, from Cohen's paper and written out in McHugh 2012, treats the chance term as fixed:

SE(κ) ≈ √( po(1 − po) / (n (1 − pe)²) )    95% CI: κ ± 1.96 · SE
Worked · casebook kappa 0.49

po(1 − po) = 0.75 × 0.25 = 0.1875. (1 − pe)² = 0.49² = 0.2401. SE = √(0.1875 / 24.01) = √0.0078093 = 0.0884.

Interval = 0.4898 ± 1.96 × 0.0884 = 0.4898 ± 0.1732 = 0.32 to 0.66.

It ignores the noise in pe; Fleiss, Cohen and Everitt derived the fuller variance (Fleiss, Cohen and Everitt 1969). The formula-free route is the bootstrap (Efron 1979): resample the 100 items with replacement, recompute kappa thousands of times, keep the middle 95%.

Worked · bootstrap

The casebook script draws 5,000 resamples of the 100 (A, B) pairs (random seed 1), computes kappa on each, sorts them, and takes the 126th and 4,875th values: 0.31 to 0.66. It matches the formula within 0.01 because n = 100 and kappa is mid-range; near 0 or 1, or with rare categories, trust the bootstrap.

So on another 100 items the same judges could plausibly score anywhere from 0.32 (“fair”) to 0.66 (“substantial”), and kappas of 0.49 and 0.58 on 100 items each cannot be told apart. A comparison without an interval cannot be acted on: Igor's error bars step.

Intervals in hiring

“Ana's hires do well 80% of the time” on 60 hires means 68% to 88%; against a 75% interviewer on a similar sample, the intervals almost coincide.

Intervals in calibration

75% manager agreement on 100 employees means 66% to 83%; a new rating definition must move it more than that to show.

Intervals at a competition

Agreeing with the reference panel on 75 of 100 wines fits a 66% judge or an 83% one; telling judges apart takes many wines each.

Intervals in reader studies

48 of 60 cancers caught means sensitivity 68% to 88%. Reader studies use enriched sets because a narrow interval needs many cancers, and screening has few.

Intervals behind the plate

75 of 100 borderline pitches right means 66% to 83%. Tracking settles it by volume: thousands of pitches a season shrink the interval to a point or two.

Sample size: how many items to label

Turn it around: choose the half-width h you can live with and solve for n. For a proportion, by the normal approximation (Wilson agrees once n is in the hundreds):

n ≈ z² p(1 − p) / h²
Worked · a proportion near 0.8

±0.10: 3.8416 × 0.16 / 0.01 = 61.5, so about 62 items (the casebook's 60 YES items give roughly this).

±0.05: 3.8416 × 0.16 / 0.0025 = 246. ±0.03: 683.

Worst case, p = 0.5, ±0.05: 3.8416 × 0.25 / 0.0025 = 385.

For a sensitivity, n counts only the truly-YES items. At 5% prevalence, 246 YES items means about 4,900 items labelled.

For kappa, solve the approximate SE for n, with po and pe from a pilot:

n ≈ z² po(1 − po) / (h² (1 − pe)²)
Worked · casebook-like judges (po = 0.75, pe = 0.51)

±0.17 (what the casebook has): 3.8416 × 0.1875 / (0.0289 × 0.2401) = 104, about the 100 items it used.

±0.10: 0.72030 / (0.01 × 0.2401) = 300. ±0.05: 1,200.

This is rough: it inherits the approximate SE, and with rare YES (large pe) the factor 1/(1 − pe)² blows up, so a rare-event judge needs far more items for the same kappa precision.

Half-widths from the formulas above, for a proportion near 0.8 and casebook-like kappa. Halving the uncertainty about an interviewer costs four times as many scored candidates.Halving the uncertainty about a manager's ratings costs four times as many reviewed employees.Halving the uncertainty about a judge costs four times as many wines poured.Halving the uncertainty about a reader costs four times as many read images.Halving the uncertainty about an umpire costs four times as many tracked pitches.

The 1/√n intuition. Every width here has n under a square root, so quadrupling the items halves it: 25 → 100 → 400 → 1,600 items take a proportion near 0.8 from ±0.16 to ±0.078 to ±0.039 to ±0.020. The first hundred labels buy most of the certainty; ±0.04 to ±0.02 costs another 1,200. Label enough to separate the decisions you face, then stop.

Carry this away. Every judging statistic is a ratio of counts from a small table. Agreement statistics divide by chance, so they swing with prevalence and bias (report ppos and pneg beside kappa). Validity statistics divide by the truth (sensitivity, specificity, J, AUC) or by the verdict (precision, NPV); only the second moves with the base rate. None is worth reporting without an interval, and intervals shrink only as 1/√n.

What you can say now

Sources

Next: back to the map.