Appendix E — Statistics for Chess Analytics
A chess database answers every question you ask it. Ask "how does White score with the Alapin?" and you get a number to one decimal place; ask "is my Najdorf worse than my Italian?" and you get two numbers that differ. The hard part is not getting numbers. It is knowing which differences are real, which are noise, and which are real but caused by something other than the thing you asked about.
This appendix collects the statistics the book uses to make that judgement, in the order you need them: how uncertain a score is (E.1), how many games it takes to see a difference (E.2), how to take the rating gap out of a comparison (E.3), how selection and confounding fake effects (E.4–E.5), why extreme opening statistics shrink when you look again (E.6), how to put an interval on almost anything (E.7), what a correlation can and cannot tell you (E.8), why testing thirty lines guarantees a false alarm (E.9), how to model results with logistic regression (E.10), and how to check whether clusters of players are real (E.11).
Every number below comes from code run on the book's data snapshot — appendices/code/e01_statistics.py,
e02_clustering.py and e03_alapin_bands.py, with their outputs in the same folder — or from results the
chapters established, which are cited with a link. The definitions of the metrics themselves (win %, accuracy,
expected score) are in Appendix D.
📊 Analyst Track: read straight through; each section ends with the function that implements it.
🏆 Competitor Track: E.1, E.2, E.6 and E.9 are the four ideas that stop you from preparing against noise.
💻 Developer Track: E.5, E.7, E.10 and E.11 are the techniques behind the Outpost modules of Part VI.
E.1 Proportions, scores and the Wilson interval
A score — (wins + ½ draws) / games — is a proportion, and a proportion from n games is uncertain. The
textbook interval, p ± 1.96 · √(p(1−p)/n) (the Wald interval), behaves badly exactly where chess players
use it most: few games, and scores near 0% or 100%. The book uses the Wilson interval instead.
📐 Definition — Wilson 95% interval. For a score p from n games and z = 1.96: centre =
(p + z²/2n) / (1 + z²/n), half-width =z · √(p(1−p)/n + z²/4n²) / (1 + z²/n). It never leaves [0, 1], it is not centred on p (it leans towards 50% when n is small), and its coverage stays close to 95% for small samples. With draws, p includes half-points — the formula is then an approximation, slightly conservative because draws reduce the variance (E.2).
def wilson(points, n, z=1.959964):
p = points / n
den = 1 + z * z / n
c = (p + z * z / (2 * n)) / den
h = z * sqrt(p * (1 - p) / n + z * z / (4 * n * n)) / den
return c - h, c + h
54/80 p= 67.5% Wilson [ 56.6, 76.8] Wald [ 57.2, 77.8]
18/50 p= 36.0% Wilson [ 24.1, 49.9] Wald [ 22.7, 49.3]
9/10 p= 90.0% Wilson [ 59.6, 98.2] Wald [ 71.4, 108.6]
10/10 p=100.0% Wilson [ 72.2, 100.0] Wald [ 100.0, 100.0]
1/20 p= 5.0% Wilson [ 0.9, 23.6] Wald [ -4.6, 14.6]
98/129 p= 76.0% Wilson [ 67.9, 82.5] Wald [ 68.6, 83.3]
2400/5000 p= 48.0% Wilson [ 46.6, 49.4] Wald [ 46.6, 49.4]
Read the table from the bottom up. With 5,000 games the two intervals agree to the decimal: at large n it does not matter which you use. At 80 or 129 games they differ by about a point. At ten games the Wald interval says a 9/10 score is somewhere between 71.4% and 108.6% — an impossible upper limit — and after 10/10 it claims certainty (a zero-width interval at 100%). The Wilson interval says what you should believe: 10/10 is compatible with a true score as low as 72.2%.
The first two rows are the book's Anchor C (Chapter 20):
🎭 Composite data: Dev's games are real Lichess games played by anonymous players at his rating, assembled into one "player" so we can demonstrate the method on your own games.
Dev's Italian, 54 points from 80 games, is 67.5% [56.6–76.8] against a database expectation of 51.6% for his band: the whole interval sits above the expectation, so it is a real strength. His Najdorf 6.Be3, 18 points from 50, is 36.0% [24.1–49.9] against 44.3% for his band — and 44.3% is inside the interval. Two numbers that look alarming side by side (67.5% vs 36.0%) lead to different verdicts once the uncertainty is drawn: one is a strength, the other cannot be told apart from noise. (Because the band's 97-game census includes Dev's own 50 games, Chapter 20 also runs the fairer two-sample comparison against the other 47: −17.2 points, interval [−36.7, +2.3] — still "cannot tell".) The 98/129 row is Anchor D's opponent and the French: 76.0% [67.9–82.5] (Chapter 24).
Weighted data. When rows carry weights — Lichess games in game_features, where un-analysed games count eight
times — the interval must use the Kish effective sample size, n_eff = (Σw)² / Σw², not the number of rows.
Chapter 31 gives the scale of the difference:
the 853,303-row weighted Lichess subset is worth n_eff = 542,092, and a 30,375-game Italian query is worth
18,428.
Code: outpost.repertoire.wilson_interval(points, n), outpost.database.wilson, outpost.database.kish_n(w);
every Outpost module that reports a score has its own small wilson helper with the same formula.
⚠️ Common pitfall: reading a non-overlap of two separate intervals as the test of a difference. Two 95% intervals can overlap a little while the difference is still clearly non-zero, and a reference value is itself uncertain when it rests on few games. When both sides are small, compute an interval for the difference (
outpost.repertoire.gap_interval), as Chapter 20 does.
E.2 How many games? Variance with draws, and sample size
Draws make scores less noisy
A game's score is 1, ½ or 0. If the two sides are evenly matched (expected score ½) and a fraction d of games
are drawn, the variance of one game's score is (1 − d)/4, so its standard deviation is √((1 − d)/4): 0.5 with
no draws, less with many. The data confirm the formula to three decimals:
Lichess blitz balanced: n=1,583,555, draw rate 4.2%, score SD 0.489, sqrt((1-d)/4) = 0.489
OTB classical balanced: n=67,648, draw rate 38.6%, score SD 0.390, sqrt((1-d)/4) = 0.392
A balanced OTB classical game, with almost two draws in five, carries noticeably less noise than a Lichess blitz game. That changes how many games you need.
Games for a given precision
For a 95% interval of half-width h around one score, n ≈ (1.96 · SD / h)². To detect a difference of δ
between two groups of equal size with 80% power at the 5% level, each group needs
n ≈ 2 · ((1.96 + 0.84) · SD / δ)².
no draws SD 0.500: games for +/-10/5/3 pts = [97, 385, 1068]; per group to detect a 10/5-pt gap (80% power) = [393, 1570]
Lichess blitz SD 0.489: games for +/-10/5/3 pts = [92, 368, 1021]; per group to detect a 10/5-pt gap (80% power) = [376, 1502]
OTB classical SD 0.390: games for +/-10/5/3 pts = [59, 234, 649]; per group to detect a 10/5-pt gap (80% power) = [239, 954]
| Question | Games needed (blitz-like draw rate) | Games needed (OTB classical draw rate) |
|---|---|---|
| Know my score in one line to ±10 points | about 92 | about 59 |
| … to ±5 points | about 368 | about 234 |
| Tell two lines apart if they differ by 10 points | about 376 per line | about 239 per line |
| … if they differ by 5 points | about 1,500 per line | about 950 per line |
Those are sobering numbers for a club player. Most people play their sharpest line a few dozen times a year. The
chapters reach the same conclusion from their own angles: 100 games give roughly a ±10-point interval
(Chapter 23); with a per-game SD of 0.367 (a
55/30/15 win/draw/loss split), telling two lines apart by 10 points takes 212 games per line — the same formula
as above (Chapter 24); and
outpost.repertoire.games_needed(0.10) returns 97 games for a ±10-point half-width at p = 0.5 without draws, 385
for ±5.
Code: outpost.repertoire.games_needed(half_width, p=0.5), outpost.training.games_needed(halfwidth_pts),
outpost.accuracy.games_needed(sd, margin) (for averages such as ACPL), outpost.accuracy.margin_of_error(sd, n).
🔍 Why this works: the interval narrows with √n, not n. Halving the uncertainty takes four times as many games; going from ±10 to ±3 points takes eleven times as many. That is why "play it more and see" so rarely settles an opening question — and why the book leans on large databases for population questions and keeps personal-repertoire verdicts deliberately humble.
🔄 Check your understanding 1. Why does an OTB classical score need fewer games than a Lichess blitz score for the same precision? 2. You scored 7/10 with a new line. Is that evidence it suits you better than your old line, where you score 55% over 200 games?
Answer
- Draws pull each game's score towards ½, so the per-game standard deviation is smaller (0.390 vs 0.489).
- Hardly. The Wilson interval for 7/10 is roughly 40% to 89% — it comfortably contains 55%. Ten games cannot distinguish the lines unless the difference is enormous.
E.3 Rating-adjusted score: taking the rating gap out
Raw scores mix two things: how good the choice is, and who makes it. If stronger players tend to choose line A, line A scores well even if it is no better. The rating-adjusted score removes the rating gap game by game.
📐 Definition — rating-adjusted score (residual). For each game, the Elo-expected score
E = 1 / (1 + 10^((R_opp − R_own)/400)); for a group of games,adj = 100 × (mean score − mean E), in percentage points. Positive = the group scored more than the ratings predicted.
The book's clearest example is the Alapin Sicilian over the board (Chapter 21): in the broadcast games White scores 46.5% with 2.c3 and 50.8% in the Open Sicilian — an apparent four-point gap. But the players who choose the Alapin are, on average, lower-rated than their opponents. Against expectation the two systems are +2.63 ± 1.04 and +2.90 ± 0.42 points: the same. The raw gap was selection.
The same comparison on Lichess blitz, all rating gaps, using ECO B22 for the Alapin and B30–B99 for the 2.Nf3 Sicilians, shows that selection is a property of the pool, not of the opening:
n raw exp elo_diff avg adj adj_ci
grp
Alapin (B22) 12571 52.08 49.46 -4.71 1805.910034 2.62 0.84
B30-B99 (mostly 2.Nf3 lines) 95980 50.44 49.39 -6.33 1759.199951 1.05 0.31
other B20-B29 84014 50.04 48.99 -10.03 1688.250000 1.05 0.33
Here Alapin players are not weaker than their opponents (mean rating difference −4.7 vs −6.3 points), the expected scores are almost identical (49.46% vs 49.39%), and the adjustment changes little: the Alapin is +2.62 ± 0.84 against +1.05 ± 0.31 for the B30–B99 lines. But the Alapin's games are played at a higher average rating (1,806 vs 1,759). The adjustment removes the rating gap, not the rating level — so the next step is to compare inside each band:
| Lichess blitz band | Alapin games | Alapin share of these Sicilians | residual, Alapin | residual, B30–B99 |
|---|---|---|---|---|
| < 1200 | 454 | 8.0% | +2.9 | +0.5 |
| 1200–1399 | 797 | 8.8% | +3.9 | +0.9 |
| 1400–1599 | 1,699 | 9.9% | +1.5 | +0.9 |
| 1600–1799 | 2,894 | 11.6% | +2.5 | +0.7 |
| 1800–1999 | 3,388 | 13.0% | +2.5 | +0.8 |
| 2000–2199 | 2,235 | 13.3% | +1.7 | +1.2 |
| 2200–2399 | 866 | 12.5% | +6.8 | +2.4 |
| 2400+ | 238 | 11.0% | +1.7 | +5.2 |
Within most bands the Alapin's residual is one to three points above the 2.Nf3 lines'. With a few hundred to a few thousand games per band, each band's Alapin residual has an interval of several points (E.2), so the consistent direction across six of eight bands is more convincing than any single cell — and the top band, with 238 games, reverses it. This is what a careful database answer looks like: an effect of a couple of points in online blitz, no measurable effect over the board, and no claim beyond that.
Two traps in rating adjustment.
- Elo over-predicts favourites (Chapter 30): at a gap of about 200 points the formula says 76.0%, OTB classical games give 72.2%, Lichess blitz 68.0%. A group of games with large gaps therefore has a negative residual by construction. A strong player judged against raw expectation looks "weak" in every line — which is why the opponent-scouting module judges a line against the player's own average residual instead (Chapter 24; Appendix D, D.6).
- Colour. White scores above 50% in balanced games (51.5–52.4% in every band of balanced Lichess blitz games; about +31.8 FIDE points of first-move edge in OTB classical play). When you compare groups with different colour mixes, adjust for colour too, or compare within one colour.
Code: outpost.database.add_rating_cols(df) (adds exp_white, adj_white), outpost.database.summarise(...),
outpost.scout.line_stats(d).
E.4 Confounding and selection
A confounder is a third variable that influences both the thing you are looking at and the outcome, creating an association between them that is not cause and effect. Selection is the special case where the confounder decides which games enter your sample at all. Chess data are full of both, because nobody assigns openings, structures or time controls at random — players choose them.
Example 1 — holes and the evaluation
Positions in which one side has more holes (squares its pawns can never attack again) have worse evaluations for that side: the correlation between the hole difference and the stored evaluation is r = 0.174 in OTB middlegames (Chapter 5). Holes are bad, then? Restrict the comparison to positions with level material (same pawns and same piece material — 39.9% of the middlegames) and the correlation falls to 0.006. Holes mostly appear in positions where pawns have been lost or traded unevenly; material drove both the holes and the evaluation. The weak-colour-complex effect, by contrast, survives the restriction (−2.81 rating-adjusted points OTB with material level).
Example 2 — the Alapin
E.3 again: in the OTB data the opening was not worse; the players choosing it were weaker than their opponents. Rating is the confounder, and the rating-adjusted score is the adjustment.
Example 3 — analysed games are not ordinary games
Only 10.4% of Lichess games carry server evaluations, because someone asked for the analysis. Compare the two groups (human games, unfinished excluded):
games median_plies draw_pct time_forfeit_pct median_avg_rating rapid_pct
has_eval
False 3562490 62.0 3.8 33.4 1658.0 15.1
True 416163 61.0 3.3 23.9 1600.0 31.3
Analysed games are twice as often rapid (31.3% vs 15.1%), much less often lost on time (23.9% vs 33.4%) and played at a lower average rating (median 1,600 vs 1,658). Every Lichess accuracy, ACPL or blunder statistic in the book is computed from analysed games, so each one describes "games someone chose to analyse". The book says so every time, and compares like with like (for example, rapid with rapid).
Example 4 — the bishop pair and the rating gap
In Chapter 6 the raw "pawn price" of the bishop pair came out at about half a pawn, but stronger players win the bishop pair more often; with the rating gap taken into account the pair is worth closer to a third of a pawn (0.36 by score, 0.33 by evaluation).
What to do about it
| Remedy | How | Book example |
|---|---|---|
| Restrict | compare only games where the confounder is equal | holes with level material |
| Stratify | compare inside bands of the confounder | Alapin by rating band (E.3) |
| Adjust | subtract the part the confounder predicts | rating-adjusted score |
| Model | include the confounder in a regression | piece values with a rating-difference control (Chapter 6); weakness coefficients with material controls (Chapter 2) |
| Standardise | re-weight one group to the other's composition | Chess960 vs standard chess at the same speed × rating mix (Chapter 37) |
| Difference-in-differences | compare changes between conditions in two groups | online play (Chapter 36) |
None of these can remove a confounder you did not measure. Opening choice correlates with style, preparation, time spent studying — none of which is in a PGN header. That is why the book's opening statistics say "players who choose X score Y", not "X causes Y".
⚠️ Common pitfall: survivorship inside a game. "Positions with an IQP at move 20 score X" counts only games that reached move 20 with the IQP intact; games that collapsed earlier, or where the pawn was traded, are not in the sample. In Chapter 2, about 80% of the IQPs present at ply 40 had not existed at ply 20 — "IQP games" at different plies are different games.
E.5 Weights: making a sample stand for its population
Two of the book's tables are deliberately not simple random samples, and both come with weights.
sample_weight(ingame_featuresandpositions_sample): every analysed Lichess game is kept, but only one in eight of the others, so un-analysed games carry weight 8. Lichess rows sum to 4,000,445 when weighted — the four million games of the sample.stratum_weight(inpositions_sample): positions were drawn in equal numbers per source × band × phase, so each position stands for a different number of positions in the population.
A weighted mean is Σ wᵢxᵢ / Σ wᵢ. Forgetting the weights is not a rounding issue: in Chapter 31 the unweighted
subset says 29.5% of Lichess games are bullet, the truth is 35.9%; anything that differs between bullet and slower
games inherits the error. In positions_sample the raw table is one-third endgames by construction, while weighted
Lichess positions are 17.5% endgame. For intervals on weighted data use the Kish effective sample size (E.1).
⚠️ Common pitfall: weighting statistics that use evaluations. All analysed games have weight 1, so engine-based Lichess statistics are unweighted — and describe analysed games only (E.4). Weighting does not fix self-selection; it fixes the sampling design.
E.6 Regression to the mean in opening statistics
Select the openings, lines or players with the most extreme scores in one sample, look at them again in fresh data, and they will look more ordinary. That is regression to the mean: an extreme observed score is partly true quality and partly luck, and the luck does not repeat.
The book's data snapshot is 34 hours long, so we can split it in time. For balanced Lichess blitz games, take every ECO code with 30–300 games in the first half of the window (before 2026-10-01 16:45 UTC) and at least 30 in the second half, pick the top and bottom 10% by White's first-half score, and look at the same codes in the second half:
ECO codes with 30-300 games in half 1 and >=30 in half 2: 166 | cut time: 2026.10.01 16:45:36
top 10% in half 1: 17 codes, half-1 mean 62.9%, half-2 mean 48.8% (all games 51.8%)
bottom 10% in half 1: 17 codes, half-1 mean 42.8%, half-2 mean 49.7% (all games 51.8%)
correlation of half-1 and half-2 scores across codes: r = -0.01
same correlation for codes with >= 3000 games in each half (58 codes): r = 0.78
The 17 "best" small openings scored 62.9% for White in the first half and 48.8% in the second — below the overall 51.8%. The 17 "worst" went from 42.8% to 49.7%. Across all 166 small codes, the first-half score predicts the second-half score not at all (r = −0.01): with a few dozen games per code, the ranking is essentially noise. For codes with at least 3,000 games in each half, the same correlation is 0.78 — large samples carry real, repeatable differences.
The chapters found the same thing with people and lines:
- In Chapter 24, the weakest line of each of 1,732 players in the first half of their games scored −9.4 points against expectation; the same lines in the second half scored +2.3. "Weak line" detection on one player's games is mostly noise.
- In Chapter 31, of 63 database cells significant in a random half of the games, 42 (67%) replicated with the same sign in the other half; the correlation of cell values between halves was 0.55.
Remedies. (1) Demand replication: split the games (by time, or at random) and believe only what holds in both
halves. (2) Shrink small-sample scores towards a sensible prior — the database expectation — before ranking:
(points + K · prior) / (n + K), with the prior "worth" K games (the book uses K = 30). Dev's 18/50 Najdorf shrinks
from 36.0% to 39.1% towards the 44.3% database value; a line with 500 games barely moves.
Code: outpost.repertoire.shrink(points, n, prior_score, prior_games=30), outpost.database.split_half(...).
E.7 The bootstrap
When there is no simple formula for an interval — for a median, a ratio, a difference of accuracies, a silhouette — the bootstrap gives one by brute force: resample your data with replacement many times, recompute the statistic each time, and take the middle 95% of the results (the percentile interval).
The one rule that matters in chess data: resample the unit that is independent. Moves within a game are not independent — a player in time trouble, or in a lost position, makes several bad moves in a row. If you treat each move as an independent trial, your interval is too narrow. The fix is the cluster bootstrap: resample whole games.
Here is the blunder rate of White players rated 1500–1599 in a random sample of 400 analysed Lichess blitz games:
moves = np.ceil(smp.n_plies / 2).to_numpy()
bl = smp.white_blund.to_numpy()
rate = bl.sum() / moves.sum() * 100
boots = []
for _ in range(2000):
i = rng.integers(0, len(smp), len(smp)) # resample games, not moves
boots.append(bl[i].sum() / moves[i].sum() * 100)
400 games, 13270 White moves, 914 blunders: rate 6.89 per 100 moves
Wilson (moves independent): [6.47, 7.33]
cluster bootstrap over games (2000 resamples): [6.36, 7.47]
population value (all 17,090 such games): 7.33
The cluster bootstrap's interval is about 30% wider than the move-level Wilson interval (1.11 vs 0.86 points wide). And note where the full-population value lands: 7.33 sits exactly on the Wilson interval's upper edge but comfortably inside the bootstrap interval — this particular sample came out on the low side, and only the honest interval covers the truth with room to spare. The champions' accuracy study in the book's data snapshot uses the same cluster bootstrap over games (2,000 resamples) for ACPL and accuracy, and warns that its move-level blunder intervals are too narrow for exactly this reason (Chapter 29).
🔍 Why this works: the bootstrap treats your sample as a stand-in for the population and asks how much the statistic would wobble if you had drawn a different sample of the same size. Resampling games keeps each game's internal dependence intact, so the wobble includes the game-to-game variation that actually exists.
E.8 Correlation is not causation (and is not much else, either)
The Pearson correlation r measures how well a straight line describes the relationship between two variables,
from −1 to +1. r² is the share of the variance of one that a line through the other explains. The Spearman
correlation does the same on ranks, so it captures any monotonic relationship and resists outliers.
What the book's correlations say:
| Relationship | r | Source |
|---|---|---|
| Mobility difference vs evaluation, material-level middlegames | 0.351 OTB, 0.330 Lichess | Chapter 3 |
| Hole difference vs evaluation, all OTB middlegames → material level | 0.174 → 0.006 | Chapter 5 |
| Space difference vs evaluation (ply 30, OTB) | 0.111 | Chapter 5 |
| Engine evaluation of ten opening tabiyas vs White's score | +0.76 masters, +0.38 OTB, +0.05 Lichess | Chapter 21 |
| Engine evaluation vs White's score, 331 common club opening positions | 0.09 | Chapter 23 |
| Champions' ACPL vs year (18 champions) | −0.70 | Chapter 29 |
Three lessons from the table.
- A correlation of 0.35 is strong for chess features. Mobility "explains" about 12% of the variance of the evaluation on its own (0.351² ≈ 0.12). Positions are decided by many factors at once; any single one is weak. That is the whole case for the planning checklist of Chapter 8, whose five counts together explain 39–49% of the variance of stored evaluations.
- Correlations change with the population. The engine's opinion of an opening tracks master results (+0.76) and says almost nothing about club results (+0.05). Same openings, same engine, different players — the correlation is a property of the pool.
- A correlation is not a mechanism. The champions' ACPL falls with the year, but modern champions also face different opponents, different openings and different kinds of positions; the time trend is real, the reason for it is not established by r.
The book cannot run experiments — nobody can assign a random half of 1600 players to the Alapin — so causal language is reserved for what the engine shows in a specific position, and database findings are stated as associations with their confounders named (E.4).
E.9 Multiple comparisons: test thirty lines, find a "weakness"
A 95% interval excludes the truth 5% of the time. Look at one line, and a false alarm is unlikely. Look at thirty lines, and at least one false alarm is close to certain.
We simulated "seasons" of 30 opening lines, each played 10–80 times, with a true score of exactly 50% and a 4% draw rate — no real differences at all:
seasons (n=10000) with >=1 line whose 95% interval excludes 50%: 74.1%
seasons with >=1 line scoring 10+ points below 50%: 96.8%
theory for 30 independent 5% tests: 1 - 0.95^30 = 78.5%
one simulated season, smallest raw p: 0.0126 | Bonferroni: 0.378 | BH q: 0.378
In three seasons out of four, some line's interval excludes 50% by luck alone (a little under the theoretical 78.5%, because scores with few games are discrete and the Wilson interval is slightly conservative). And in almost every season at least one line is ten or more points "below par". The book's own version, with Dev's actual line counts, found 72.3% of luck-only seasons showing a line at least ten points below expectation (Chapter 20), and the single "below" node in Dev's study list is presented there as the false alarm one should expect among 30 tests.
Corrections.
- Bonferroni: multiply each p-value by the number of tests (or require p < 0.05 / m). Simple and very strict. In the simulated season above, the smallest of 30 p-values, 0.0126, becomes 0.378 — not significant.
- Benjamini–Hochberg (false discovery rate): sort the m p-values; the q-value of the k-th smallest is
p₍ₖ₎ · m / k(made monotone). Controls the expected share of false discoveries among the lines you flag, which suits screening. Chapter 35 uses q-values for per-opening verdicts. - Replication: re-test a flagged line on fresh games (E.6) before acting on it.
Code: outpost.progress.bh_qvalues(pvals); outpost.database.split_half(...).
⚠️ Common pitfall: the garden of forking paths. You do not need thirty formal tests to have a multiple-comparison problem. Slicing the same games by colour, then by speed, then by month until something looks interesting is the same thing. Decide the comparison before you look, or replicate after you find.
E.10 Logistic regression
Many chess outcomes are binary (won / not won) or bounded scores (0, ½, 1), and the relationship with a predictor is S-shaped: an extra 100 rating points matters a lot near an even game and little when one side is already a heavy favourite. Logistic regression models the log-odds as a straight line:
P(win) = 1 / (1 + e^(−(b₀ + b₁·x))), or equivalently log(P/(1−P)) = b₀ + b₁·x.
The Elo formula is a logistic curve in the rating difference, with a fixed slope: E = 1/(1 + 10^(−Δ/400))
corresponds to b₁ = ln(10)/400 ≈ 0.00576 per rating point. So a natural experiment is to fit the slope from data
and compare. Fitting decisive games only (draws dropped), with the rating difference in hundreds of points:
x = ((df.white_elo - df.black_elo) / 100).to_numpy().reshape(-1, 1)
y = (df.result == "1-0").to_numpy().astype(int)
m = LogisticRegression(C=1e6, max_iter=1000).fit(x, y)
scale = np.log(10) / (m.coef_[0][0] / 100)
Lichess blitz: n=400,000 decisive games; intercept +0.075 (White's edge), slope 0.354 per 100 pts; implied logistic scale 650 (Elo uses 400); P(win | +200) = 0.687
OTB classical: n=146,132 decisive games; intercept +0.254 (White's edge), slope 0.698 per 100 pts; implied logistic scale 330 (Elo uses 400); P(win | +200) = 0.839
How to read the output:
- The intercept is White's edge at equal ratings, on the log-odds scale: +0.075 in Lichess blitz, +0.254 over the board — the first move is worth more in slow OTB chess, consistent with the Elo-point estimates in Chapter 30 (about +31.8 FIDE points OTB classical vs +12.5 Glicko points in Lichess blitz).
- The slope says how fast the odds change with the rating gap. Converted to an Elo-style scale it is 650 for Lichess blitz — a much flatter curve than Elo's 400: Lichess ratings predict decisive results less sharply. Over the board the implied scale is 330, steeper than 400.
- The outcome definition changes the answer. Fitting decisive games only answers "given that somebody won, who?", and with many draws removed the OTB curve is steep. Chapter 30 fits the expected score with draws as half a win and finds a best scale of about 478 for FIDE classical and 670–750 for Lichess. Both fits are correct; they answer different questions. Always say what the outcome is.
Fractional logit. When the outcome is a score with draws (0, ½, 1), a standard trick enters each game twice — as a win with weight y and as a loss with weight 1 − y — and fits an ordinary logistic regression. Chapter 6 used it to estimate implied piece values from material differences (with a rating-difference control): knight fixed at 3, the pawn came out at 1.12, the bishop 3.06, the rook 4.81 and the queen 9.01 (Chapter 6).
Pitfalls. Coefficients are on the log-odds scale — translate them into probabilities at meaningful values (as
P(win | +200) above) before you explain them. Large samples make every coefficient "significant"; ask whether the
size matters. And a regression coefficient is an adjusted association, not a causal effect, unless the design makes it
one (E.4).
E.11 Clustering — and how to check that clusters are real
Clustering algorithms such as k-means always return clusters: ask for three groups of players and you get three groups, whether or not players come in types. The question is never "what are the clusters?" but "are they better than what structure-free data would give?". Three checks:
- Silhouette against a null. The silhouette of a point compares its average distance to its own cluster with that to the nearest other cluster (−1 to +1); the mean over points scores the clustering. Compute the same silhouette on null data with no clusters (each feature shuffled independently, or a Gaussian with the same covariance). Real structure must beat the null.
- Stability. Re-run k-means from different random starts and compare the partitions with the adjusted Rand index (ARI: 1 = identical, 0 = chance agreement). Clusters that change from run to run are artefacts.
- Reliability of the features. Split each player's games into two halves and correlate the feature between
halves; Spearman–Brown
2r/(1+r)estimates the reliability of the full-length average. A feature that does not agree with itself cannot define a type.
We ran all three on 1,745 OTB players with at least 40 classical games in the broadcast data (104,316 player-games; players are not named), using six features: draw rate, game length, reaching a book endgame, opposite-side castling, queens off by ply 40, and own book accuracy.
k silhouette null mean null 95th seed-ARI
2 0.194 0.115 0.119 0.988
3 0.176 0.111 0.114 0.948
4 0.164 0.112 0.116 0.524
5 0.163 0.116 0.120 0.690
6 0.154 0.120 0.123 0.636
split-half reliability (r between a player's odd and even games; Spearman-Brown corrected):
draw r = 0.57 -> full-length reliability 0.72 (players 1745)
plies r = 0.52 -> full-length reliability 0.68 (players 1745)
endgame r = 0.34 -> full-length reliability 0.50 (players 1745)
opp_castle r = 0.18 -> full-length reliability 0.30 (players 1745)
qoff20 r = 0.22 -> full-length reliability 0.36 (players 1745)
accuracy r = 0.77 -> full-length reliability 0.87 (players 1745)
k = 3 centroids (z-units):
draw plies endgame opp_castle qoff20 accuracy players
0 0.22 0.80 0.88 -0.17 0.49 0.35 540
1 -0.78 0.05 -0.08 0.37 -0.36 -0.82 679
2 0.78 -0.89 -0.80 -0.29 -0.04 0.70 526
What this says:
- The silhouettes beat the permutation null at every k (0.194 vs a null 95th percentile of 0.119 at k = 2) — but the values themselves are low. A silhouette below about 0.25 means the "clusters" are regions of a continuous cloud, not separate groups.
- Two- and three-cluster solutions are stable across seeds (ARI 0.99 and 0.95); four or more are not (0.52–0.69).
- The features differ greatly in reliability. Accuracy (0.87) and draw rate (0.72) are stable traits; opposite-side castling (0.30) and early queen trades (0.36) are mostly noise at 40–60 games per player.
- The k = 3 centroids read as "long, drawish, accurate games", "decisive, less accurate games" and "short, drawish, accurate games". Accuracy and draw rate both rise with playing strength, so at least part of this structure is rating level, not style — the confounding lesson of E.4 again. A style analysis has to take level out first.
Chapter 33 runs the full version, with engine-based features and a stricter Gaussian null (which preserves the correlations between features), and concludes that players do not form style types: its silhouettes never beat the Gaussian null — for example 0.132 against a null mean of 0.127 and 95th percentile of 0.134 for 801 Lichess blitz players. Style is a position in a continuous space, not a membership card.
Code: outpost.style.silhouette_vs_null(X, k), seed_stability(X, k), bootstrap_coassignment(...),
split_half_reliability(...); scikit-learn's KMeans, silhouette_score, adjusted_rand_score.
E.12 A checklist before you believe a number
| # | Question | Section |
|---|---|---|
| 1 | What is the interval, not just the estimate? (Wilson for scores; Kish n for weighted data) | E.1 |
| 2 | Is n large enough to see a difference of the size I care about? | E.2 |
| 3 | Did I remove the rating gap (and compare within bands for the rating level)? | E.3 |
| 4 | Who chose this — and what else differs between the groups? | E.4 |
| 5 | Are my data weighted, and did I use the weights? | E.5 |
| 6 | Did I select the extreme cases? Will they hold up in fresh data? | E.6 |
| 7 | Is my unit of resampling independent (games, not moves)? | E.7 |
| 8 | Am I reading a correlation as a cause? | E.8 |
| 9 | How many comparisons did I make — including the ones I looked at and dropped? | E.9 |
| 10 | What exactly is the outcome in my model (decisive games? scores with draws)? | E.10 |
| 11 | Do my clusters beat structure-free data, and are the features reliable? | E.11 |
| 12 | Which pool are the ratings from, and did I keep pools separate? | Appendix B |