Case Study 2 — Is the Pass Model Good Enough to Drive a Simulator?

Setup

Section 35.6 fitted a logistic pass model and showed that it predicts individual laps well out of sample: a log loss of 0.261 against 0.393 for the base rate, an AUC of 0.883, and good calibration from 2% to 30%. But Box Box does not use the model one lap at a time. It runs whole races, thousands of them, and what matters for a strategy decision is whether the race totals come out right: how many passes, how variable from race to race, and at which circuits.

A model can be excellent lap by lap and still be wrong about races. If laps within a race share something the model does not see (a track that is dirtier off-line, a wind direction that helps the tow, a field that happens to be on similar tyres), then the passes in a race are not independent coin flips. The model will predict the average race correctly and the spread of races badly. This case study tests that, and turns the answer into a component for the simulator.

The script is code/case_study_02.py. It reads the out-of-sample predictions saved by 05_pass_probability.py.

The data

  • 13,451 following situations in the 76 dry races of 2023–2026 R21 (the book's dry-race filter: no intermediate or wet tyre and no rainfall on any lap), 1,790 of which ended in a pass.
  • For each situation, the model's probability from the 10-fold cross-validation grouped by race: every race was predicted by a model that never saw it.

For each race we compare the observed number of passes from following situations with the expected number (the sum of the probabilities). If the laps were independent Bernoulli trials with those probabilities, the variance of the observed count would be $\sum p(1-p)$, and the race z-score $z = (\text{obs} - \text{exp}) / \sqrt{\sum p(1-p)}$ would be roughly standard normal.

Analysis

The level is close

Dry races: 76; situations 13,451; passes from situations 1790; out-of-sample expected 1878.8
Per race: Spearman(observed, expected) = 0.62; median |obs - exp| 7.1 passes; mean abs 8.1
  exp         : mean abs error 8.06, Spearman 0.62
  exp_circuit : mean abs error 10.67, Spearman 0.30
  2023-25: observed 1380 vs expected 1422.6 (ratio 0.97, 59 races)
  2026: observed 410 vs expected 456.2 (ratio 0.90, 17 races)

In total the model expected 1,878.8 passes and saw 1,790: it is 5% high overall, 3% high for 2023–25 and 10% high for 2026. It ranks races moderately well (Spearman 0.62), and it beats a simple baseline that multiplies each race's number of situations by its circuit's average conversion rate in other races (mean absolute error 8.1 against 10.7 passes per race). The model's extra information (pace, tyres and gap) is worth something at the race level, not just the lap level.

Scatter of observed against expected passes from following situations for 76 dry races, with Bernoulli intervals; points spread widely around the diagonal, with 2026 Italian, 2023 Spanish and 2023 Qatar well above it and 2024 Miami and 2026 Mexico City well below

📊 Figure (described): Each point is a dry race: expected passes from following situations (out of sample) against what happened, with ±1.96 Bernoulli standard deviations. The cloud follows the diagonal, but far more races sit outside their intervals than chance allows. The 2026 Italian GP (47 against 25.9), the 2023 Spanish GP and the 2023 Qatar GP are well above; the 2025 Abu Dhabi GP (47 against 76.3), the 2024 Miami GP and the 2026 Mexico City GP (16 against 39.0) are well below.

The spread is wrong

Dispersion (mean z^2; 1 = Bernoulli-consistent): 6.65; share |z| > 2: 50.0% (about 4.6% expected)

Largest misses (observed - expected):
 year             gp   n  obs  exp    z
 2025   Abu Dhabi GP 269   47 76.3 -4.9
 2026    Japanese GP 281   32 56.7 -4.2
 2026 Mexico City GP 206   16 39.0 -4.8
 2024       Miami GP 283   19 39.6 -4.4
 2025       Qatar GP 221    2 19.6 -4.5
 year                gp   n  obs  exp   z
 2025 Emilia Romagna GP 263   40 28.3 2.9
 2025       Canadian GP 288   32 18.0 4.1
 2024       Japanese GP 110   34 19.8 4.1
 2023        Spanish GP 159   45 29.6 3.7
 2023          Qatar GP 106   37 17.2 6.3
 2026        Italian GP 173   47 25.9 5.3

Half the races (50.0%) have |z| > 2, where independent laps would give about 4.6%. The mean squared z is 6.65: race totals vary nearly seven times as much as the model's lap-level randomness can produce. Qatar is the striking example. In 2023 the circuit produced 37 passes from 106 situations, far more than expected (z = +6.3); in 2025 it produced 2 from 221 (z = −4.5). Same circuit, same model inputs in kind, opposite surprises.

Histogram of race z-scores against the standard normal curve; the observed distribution is far wider, from about -5 to +6.5

📊 Figure (described): The distribution of race z-scores (blue bars) against the standard normal curve that independent Bernoulli laps would produce (orange). The observed spread is several times wider, with tails out to −5 and +6.5. Something shared by all the laps of a race moves the pass rate up or down.

Simulated race totals (500 draws): median per-race SD 3.48 passes; observed residual SD 10.12

A Bernoulli simulation with the model's probabilities gives a typical race total a standard deviation of 3.5 passes. The real races miss their expectations with a standard deviation of 10.1. A simulator built on the plain model would make every race look much the same, and it would understate the chance of a procession or a thriller.

Where the model is biased by circuit

Observed / expected by circuit (pooled):
               obs     exp  races  ratio
madring          8   20.63      1   0.39
monaco           7   13.25      3   0.53
yas_marina     107  141.15      3   0.76
suzuka          91  114.06      4   0.80
shanghai        69   79.68      3   0.87
...
imola           65   59.62      2   1.09

By circuit, the model is mostly close to unbiased: 21 of the 25 circuits sit between 0.87 and 1.09. Two of the four exceptions are Yas Marina (107 against 141.2 over three races) and Suzuka (91 against 114.1 over four), where the model runs 20–24% high; a refit with more seasons will show whether that persists. The other two are Madring (one race, 8 against 20.6) and Monaco (7 against 13.3 over three races). Both of those are cases the shrinkage works against: with one race or very few passes, the circuit effect is pulled towards the average, so the model is less pessimistic than the circuit deserves. That is the price of shrinkage, and the right price. A circuit with one race should not be given an extreme effect on the strength of that race.

A race-level offset

The fix that matches the evidence is a random race effect: one extra term on the log-odds that is shared by all the laps of a race and drawn afresh for each simulated race. We estimated its size directly. For each race we found the logit shift $\delta$ that makes the expected count equal to the observed count, and took the spread of those shifts, minus the part that sampling noise would produce on its own.

Race-level logit offset that reproduces each race's count: SD 0.811 raw; after removing sampling noise (mean 0.343) about 0.735; IQR -0.53 to +0.57

📐 Definition: race offset. $u_r \sim N(0, 0.743^2)$ added to the linear predictor for every lap of race $r$. A race with $u_r = +0.743$ has every situation's odds multiplied by $e^{0.743} = 2.1$; a race with $u_r = -0.743$ has them halved.

The module stores RACE_SD = 0.743, estimated on a slightly earlier cut of the same races; the 0.735 above differs only in the third digit, which changes no simulated result that matters. It draws the offset with sample_race_offset(rng). The project checkpoint shows what it does to one situation (0.4 s/lap quicker, 8 laps fresher, 0.5 s behind, at Monza on 2026 rules) across five simulated races:

  five simulated races at Monza, same situation (2026): ['35.1%', '16.6%', '43.0%', '46.4%', '9.2%']

The same situation is a 9% chance in one simulated race and a 46% chance in another, which is how real races look.

Why a random effect, and not more predictors?

The natural objection is that we should explain the race-to-race variation instead of drawing it at random. Section 35.8 tried. A regression of log green passes on the top-ten pace spread, the number of neutralisations, the spread of tyre-age offsets and the era explains only 18% of the variation across the 76 dry races (R² = 0.18). Two features mattered (the pace spread and 2026); the rest did not. Until someone finds the missing variables, a random effect is the honest model: it reproduces what we see without pretending we know why.

What it changes for strategy

The race offset matters most for questions about tails. The checkpoint's two-car battle draws one offset per simulated race. A car 0.3 s/lap quicker on equal tyres at the Hungaroring, on 2026 rules, is stuck for more than 10 laps in 41.2% of runs and never gets past in 30 laps in 13.1%. A strategist deciding whether to undercut a slower car, or to wait and pass it on track, is really deciding how much of that 41% risk to accept. Without the offset, the simulated race would be more predictable than the real one, and waiting would look safer than it is.

What it means (and doesn't)

  • The pass model is good enough to drive a simulator's average. It gets the overall level within 5%, most circuits within about ±10% (Yas Marina, Suzuka, Monaco and Madring are the exceptions, all on the high side), and it ranks races better than circuit averages.
  • It is not good enough on its own to drive the simulator's spread. Without a race effect, Box Box would produce races that are far too alike. With RACE_SD, the spread of simulated race totals can match the real spread.
  • We do not know what the race effect is. Candidates include track condition off the racing line, wind, how the field's strategies happened to line up, and in 2026 how energy deployment interacted with the circuit on that day. The data cannot separate those. Treating it as random is honest; naming it would not be.
  • 2026 runs slightly hot. The model over-predicts 2026 by 10% out of sample (and 2023–25 by 3%). With 17 dry 2026 races in the data, that may be noise or a sign that the 2026 era term is still settling. Refit when the season ends.

Discussion questions

  1. Why does a model that is well calibrated lap by lap still fail to reproduce the spread of race totals? What assumption breaks?
  2. The race offset has SD 0.743 on the logit scale. Explain in plain words what that means for a race in which the typical situation has a 15% pass chance.
  3. Shrinkage makes the model too optimistic about Monaco and Madring. Would you fix that by using raw circuit effects instead? What would you lose?
  4. A strategist asks: "On average, is the undercut worth more at Barcelona than at Monaco?" Is the race-offset spread relevant to that question? What about to "how often will we be stuck for 15 laps?"

Your turn

Extend code/case_study_02.py: rerun the Bernoulli simulation with a race offset drawn from $N(0, 0.743^2)$ for each simulated race (one draw per race per simulation), and compare the simulated spread of race totals with the observed residual SD of 10.12. Then refit the race offset separately for 2023–25 and for 2026. Is passing in 2026 more or less "race-dependent" than in the DRS era? Report both SDs with the number of races behind them.