58 min read

Ahmedabad, 9 April 2023. Kolkata Knight Riders are chasing 205 against Gujarat Titans. With five

Chapter 20 — Win Probability Models: Building the Curve That Tells the Story of Every Cricket Match

Ahmedabad, 9 April 2023. Kolkata Knight Riders are chasing 205 against Gujarat Titans. With five balls of the match left they are 177 for 7 and need 28. Rinku Singh is on strike against the left-arm seamer Yash Dayal.

The model this chapter builds — fitted only on matches played before 2023, so it has never seen this game — puts Kolkata's chance of winning at that moment at 0.0017. About one in six hundred. Chapter 9's lookup table, fitted the same way, says 0.0031.

Then Rinku Singh hits five sixes in five balls. Here is the over as the model saw it, ball by ball, from code/case_study_02.py:

  19.2  RK Singh       v Yash Dayal     need  28 off  5  WP 0.002  -> 6
  19.3  RK Singh       v Yash Dayal     need  22 off  4  WP 0.003  -> 6
  19.4  RK Singh       v Yash Dayal     need  16 off  3  WP 0.005  -> 6
  19.5  RK Singh       v Yash Dayal     need  10 off  2  WP 0.013  -> 6
  19.6  RK Singh       v Yash Dayal     need   4 off  1  WP 0.073  -> 6

So was the model wrong?

Most people's instinct says yes. A model said "almost impossible", and the almost-impossible happened, in front of a stadium and a few million phones. But hold that instinct for a moment. If a forecaster says "one in six hundred" about thousands of different situations, it should see the thing happen now and then — about once every six hundred times. If it never happened, the forecaster would be the one who was wrong: its "one in six hundred" would really have meant "never". A single match cannot tell you whether a probability was right. Only the long run can.

That idea — that a probability is a promise about frequencies, and that you test the promise by grouping forecasts and counting — is called calibration, and it is the threshold concept of this chapter. Once it clicks you can never again read "Sri Lanka 64%" on a broadcast graphic the same way. You will want to know: 64% according to what, and when that model says 64%, do teams win 64% of the time?

This is the chapter where Crease gets its main engine. Chapter 9 built WP v0, a smoothed table of how often chasing sides won from each state. It was honest and useful, and it was wrong in a way we could measure: fitted before 2023, it underrated IPL chasers from 2023 to 2026 by 13.4 points. Here we build WP v1 properly — a fitted model trained on every men's T20 match in the snapshot, split the right way, compared across two model families, checked for calibration, and taught to cope with the scoring jump of the Impact Player era. Then we use it to redraw the curve of the book's anchor match at Newlands, to rank every batter and bowler of IPL 2026 by the wins they added, and to ask whether a model built on men's cricket can be trusted with women's.

Rinku Singh comes back in Case Study 2, where we run the test that actually answers "was the model wrong?" — not for one over, but for 3,667 chases at once.

🏏 Fan Track: Read 20.1, 20.6 (calibration) and 20.9 (the Newlands curve) closely; skim the code. You will come away able to judge any win-probability graphic you see on television.

📊 Analyst Track: Everything, especially 20.3 (leakage), 20.5 (logistic v boosting) and 20.7 (the era test). Run every script; the Project Checkpoint gives you crease.winprob.

🎰 Betting Track: 20.4–20.7 are the core: scoring rules, calibration, and why a model that is right on average can still be wrong for one league. Chapter 35 turns these probabilities into prices.


20.1 What a win-probability model is for

Start with the cricket question. Sri Lanka are 116 for 2 after 15 overs, chasing 170. Are they winning?

Everybody at Newlands on 25 January 2017 had an answer, and the answers differed. A required rate of 10.80 against a current rate of 7.73 (the numbers Chapter 7 computed for this exact moment) sounds like trouble. Eight wickets in hand sounds like plenty of batting to have a go. A win-probability model is a disciplined way of combining those facts into one number, using what happened in every other match that reached a similar point.

📐 Definition — win probability (WP): for a T20 chase, the probability that the chasing side wins, given the state before a delivery. The state is at least (runs needed, legal balls left, wickets in hand); a richer model adds context such as the target, the scoring environment and the strength of the two teams. Ties count as half a win for each side. WP for the side batting first is one minus the chasing side's WP once the chase starts, and is estimated from a projected total before that (section 20.8).

What do we want such a number for? Three things, and they pull in slightly different directions.

  1. Telling the story of a match. A WP curve, ball by ball, shows where the match turned. This needs a model that is sensible in every state, including strange ones (needing 4 off the last ball with two wickets left), because any state can turn up in a real game.
  2. Valuing players. Chapter 9 introduced Win Probability Added (WPA): the change in WP on each ball, credited to the batter and charged to the bowler. WPA is only as good as the WP underneath it. A model that is wrong in a systematic way — say it underrates every IPL chase since 2023 — hands out systematically wrong credit.
  3. Forecasting. A broadcaster, a franchise analyst deciding when to take a bowling change, a bookmaker — all need the number itself to be right in the sense this chapter cares most about: when it says 70%, teams should win about 70% of the time.

WP v0 did the first job reasonably. It struggled with the third. In Chapter 9 we fitted it on chases before 2023 and tested it on 2023–26: Brier score 0.1252 (we define the Brier score in 20.4), and in the IPL it forecast an average chasing WP of 0.374 while chasers actually won 0.508 of the time. A 13.4-point miss, in the world's most-watched league, in the model's most important use.

Why did a table miss so badly? Because a table only knows the three numbers in its key. It cannot know that a target of 200 in 2025 is a different proposition from a target of 200 in 2015, that the same state means something different in a Syed Mushtaq Ali Trophy game on a slow pitch and an IPL night game at the Chinnaswamy, or that Australia chasing against Scotland is not the same as Scotland chasing against Australia. To use that information we need a model with features, and that means fitting one.


20.2 The training data: every men's T20 match in the snapshot

The book's rule for T20 win probability is: use everything. A model of chases learns from chases, and there are more of them in the snapshot than any single league could provide. We take the same twelve men's T20 competitions Chapter 9 did — men's T20 internationals and eleven domestic and franchise leagues — and the same filters: 20 overs a side, a result (win or tie), no rain-rule revision. The first script reports what that gives us.

data = wp.build_states(wp.MEN_T20)          # crease.winprob — this chapter's module
g, s1, s2 = data.games, data.s1, data.s2   # matches, first-innings states, chase states
=== 20.2 The training pool: all men's T20 in the snapshot ===
matches (20-over, decided, no DLS): 9,117
chases with a valid 20-over target: 8,939
chase states (pre-ball): 999,986   first-innings states: 1,117,548
seasons: 17 Feb 2005 to 01 Nov 2026
chasing side won 52.4% (ties count half); ties: 95
             matches  first  last  chases
competition                              
t20s_male       3428   2005  2026    3332
ntb             1457   2014  2026    1415
ipl             1211   2008  2026    1201
sma              686   2016  2024     686
bbl              619   2011  2026     611
bpl              466   2012  2026     466
cpl              408   2013  2026     403
psl              350   2016  2026     343
lpl              136   2020  2026     130
ilt              133   2023  2026     132
sat              118   2023  2026     118
mlc              105   2023  2026     102

So WP v1 is trained on 8,939 men's T20 chases from 9,117 matches — almost a million pre-ball chase states. (The other 178 matches have no usable chase — a target set for fewer than 20 overs, or no valid second-innings state — and are left out of the chase model.) The pool is not dominated by any one competition: T20 internationals provide 37% of the chases, the T20 Blast 16%, the IPL 13%.

Each row of s2 is one delivery of a chase with the state before the ball was bowled — the same impact.innings_states table Chapter 9 built — plus three new columns of context.

📐 Definition — scoring environment (env_par): for each match, the average first-innings total of the previous 60 matches in the same competition, shrunk toward the average of all earlier matches with a weight of 10 matches. It uses only matches played before this one, so it is known at the toss. T20 internationals are split into two environments: full member v full member, and everything else.

📐 Definition — Elo gap (elo_diff): the batting side's walk-forward Elo rating minus the fielding side's, before the match, computed within each competition with Chapter 35's elo_walk_forward (K = 20). A rough, public-data measure of team strength.

📐 Definition — era flag (era): 1 if the match was played in 2023 or later, else 0 — the season of the IPL's Impact Player rule, after which IPL scoring jumped.

The environment feature is the important one, and the second half of the output shows why.

=== Scoring environment (env_par = past-only mean of the previous 60 first-innings totals) ===
env_group   ipl   psl   bbl   ntb  t20s_male_fm  t20s_male_assoc   sma
yr                                                                    
2015      165.3   NaN 157.8 168.1         158.4            137.4   NaN
2016      162.4 149.5 159.2 160.0         159.3            135.9 144.2
2017      166.7 149.0 162.9 168.3         157.1            138.0   NaN
2018      166.5 150.3 160.5 169.5         168.3            143.5 151.1
2019      168.7 153.4 157.4 167.3         165.5            147.2 148.7
2020      169.3 159.2 161.0 165.0         164.5            142.9   NaN
2021      162.6 162.8 165.7 165.2         160.5            141.2 148.8
2022      164.4 169.3 165.3 168.3         163.4            147.1 149.8
2023      173.8 177.0 161.1 175.6         166.9            140.9 149.0
2024      184.1 181.0 159.8 168.9         169.3            142.1 152.5
2025      183.1 179.7 164.9 175.2         168.3            148.9   NaN
2026      188.7 177.8 168.6 176.7         173.5            147.5   NaN

mean first-innings total, IPL by year (2019-2026):
yr
2019    168.5
2020    169.5
2021    159.3
2022    171.1
2023    183.0
2024    189.6
2025    190.9
2026    195.1

Two things stand out. First, environments differ a lot at the same time: in 2024 the average IPL match was played in a 184-run world, the average associate T20I in a 142-run world, the Syed Mushtaq Ali Trophy in a 152-run world. A model that treats "need 54 off 30" identically across those worlds is averaging over very different games. Second, the IPL's environment moved by about 20 runs between 2022 and 2024 — and so did the PSL's. (The IPL first-innings averages here are for decided, full-length matches; the book's season tables, which include every match, put 2026 a fraction higher. The story is the same.)

Matches in the pool by year (stacked by competition group) and the rolling scoring environment for the IPL, PSL, T20 Blast and full-member T20Is

📊 Figure (described): Left: stacked bars of men's T20 matches per year in the training pool, growing from a handful in 2005 to roughly 800–1,050 a year since 2021, with associate T20Is the fastest-growing group. Right: env_par before each match for four competitions; the IPL line sits in a 150–170 band until 2022 and then climbs to the high 180s by 2026, with the PSL rising alongside. The takeaway: "the era" is not one switch flipped in 2023 — it is a moving level that differs by league.

🔄 Check your understanding 1. Why must env_par use only matches played before the one being predicted? 2. The pool's chasing sides won 52.4% of matches. Why is that not a good enough "model"?

Answer

  1. Because the model will be used live, before the match's own scores exist. Using the match's own first-innings total in its environment would leak the answer (a high first innings both raises env_par and makes the chase harder) and make the model look better in testing than it can ever be in use. 2. It ignores the state: 52.4% is the right forecast at the first ball only on average, and it is the same at 0 for 3 and at 150 for 1. Section 20.4 shows its Brier score is twice WP v1's.

20.3 Splitting the data honestly: why we split by match, not by ball

🧩 Productive struggle. You have 999,986 chase states. The textbook recipe for checking a model is to hold back 20% of the rows at random, fit on the other 80%, and score the held-back rows. Before reading on, write down what is wrong with doing that here — and predict whether it will make a model look better or worse than it really is.

Here is the experiment. We take the pre-2023 chases only and fit two models on each of three splits: a deliberately flexible gradient-boosted model (600 trees of depth 8, no minimum leaf size to speak of) and a logistic regression. Both use the state plus target, environment and Elo gap.

flex = dict(n_estimators=600, max_depth=8, min_child_weight=1, learning_rate=0.1, subsample=0.8)
rng = np.random.default_rng(20)
ball_test = rng.random(len(pre)) < 0.2
splits = {
    "random balls (80/20)": (pre[~ball_test], pre[ball_test]),
    "by match (80/20)": wp.split_by_match(pre, 0.2, seed=20),
    "by time (fit <2021, test 2021-22)": wp.split_by_time(pre, "2021-01-01"),
}
=== 20.3 Leakage: random-ball split v by-match split (pre-2023 chases only) ===
                               split         model  train_brier  test_brier  test_logloss  test_balls  matches_in_both
0               random balls (80/20)  flexible GBM       0.0177      0.0185        0.0990      119046             5272
1               random balls (80/20)      logistic       0.1278      0.1274        0.3987      119046             5272
2                   by match (80/20)  flexible GBM       0.0117      0.1933        0.6917      119462                0
3                   by match (80/20)      logistic       0.1271      0.1301        0.4034      119462                0
4  by time (fit <2021, test 2021-22)  flexible GBM       0.0093      0.2036        0.8168      174490                0
5  by time (fit <2021, test 2021-22)      logistic       0.1306      0.1211        0.3793      174490                0

Read the first row. On a random-ball split the flexible model scores a test Brier of 0.0185 — about seven times better than anything else in this chapter. It looks like a miracle. Split the same data by match and the same model scores 0.1933, worse than the logistic regression and not far from the 0.25 you get by saying 50% every time.

What happened is leakage. Every one of the 5,272 chases had about 80% of its balls in training and 20% in test (the matches_in_both column). The target, the environment and the Elo gap are constant within a match, so together they act like a fingerprint. A flexible model learns "the match with target 167, environment 158.3 and Elo gap +41 was won by the chasing side" from the training balls, and then "predicts" the test balls of that same match by recognising the fingerprint. It is not forecasting cricket; it is looking up the answer.

📐 Definition — leakage: any route by which information about the outcome being predicted reaches the model during fitting in a way it could not in real use. In ball-by-ball data the classic route is a random split of balls: neighbouring balls of one match share the outcome.

The logistic regression barely notices the difference (0.1274 v 0.1301) because it is too simple to memorise matches — which is a useful property, not a weakness. The out-of-time split is the most honest of all: fit on everything before 2021, test on 2021–22. That is exactly how the model will be used — fitted on the past, applied to the future.

Test Brier scores for a flexible gradient-boosted model and a logistic model under three splits

📊 Figure (described): Paired bars of test Brier score for the flexible gradient-boosted model and the logistic model under a random-ball split, a by-match split and a by-time split. The boosted model scores about 0.02 on the random-ball split and about 0.19–0.20 on the other two; the logistic model sits near 0.12–0.13 throughout. Lower is better. The takeaway: the brilliant score is an artefact of the split, not a property of the model.

⚠️ Common pitfall: splitting balls instead of matches. Any published "ball-by-ball model" that reports accuracy from a random split of deliveries should be treated as unverified. The rule for this book: split by match at least; split by time whenever the model is meant to forecast. Every number from here on is out of time.

Two practical rules follow. First, the train/test split for this chapter is Chapter 9's: fit on chases before 2023 (5,272 chases, 598,074 states), test on 2023–26 (3,667 chases, 401,912 states). Using the same split as WP v0 lets us compare directly. Second, any tuning (choosing the boosted model's depth, say) happens inside the training years, on a by-match validation split — the test years are touched once, at the end.


20.4 Scoring forecasts: the Brier score and log loss

Before comparing models we need a scoreboard. Accuracy ("did the side with WP above 50% win?") is the wrong one for probabilities: it treats 51% and 99% the same and throws away exactly the information a WP model exists to provide.

📐 Definition — Brier score: the mean squared difference between the forecast probability p and the outcome y (1 = chasing side won, 0 = lost, 0.5 = tie), over all forecasts: Brier = mean((p − y)²). 0 is perfect; always saying 0.5 scores 0.25. Lower is better.

📐 Definition — log loss: −mean(y log p + (1 − y) log(1 − p)). It punishes confident wrong forecasts much harder than the Brier score does (a 1% forecast that loses costs 4.6; a 40% forecast that loses costs 0.51). Always saying 0.5 scores 0.693. Lower is better.

Both are proper scoring rules: a forecaster gets the best expected score by reporting what it really believes. That matters. A scoring rule that rewards shading forecasts toward 0 or 1 would encourage exactly the overconfidence we are trying to catch.

One more caution. Every number below scores every pre-ball state, so a chase contributes about a hundred forecasts. Early states are hard (Brier near 0.2), late states easy (many forecasts near 0 or 1). So a Brier score only means something relative to another model on the same test set — never compare a Brier from this chapter with one from a different split or a different set of matches.


20.5 WP v1: logistic regression against gradient boosting

The features

The state is three numbers, but how you feed them to a model matters. A logistic regression is a straight line on the log-odds scale, so the features have to be shaped so that a straight line can fit the cricket. After some experiment (all inside the training years) WP v1 uses:

  • log runs needed, log balls left, and their difference, the log of the required runs per ball — the single most important quantity in a chase;
  • wickets in hand and its square (the fifth wicket matters more than the tenth);
  • the share of the innings left, and interactions among these (needing a run a ball with 9 wickets is not the same as with 3);
  • the target, the environment and the Elo gap, each also interacted with the required rate and the share of innings left.

That is 25 columns in all. The log scale is not decoration. An earlier version used the required run rate capped at 24 an over; it fitted the bulk of the data as well, but near the end of a chase it went badly wrong — "4 needed off 1 ball" and "8 needed off 2" have the same rate but very different chances. Logs bend the right way there. (Section 20.6 shows the last over is still the model's weakest region.)

The gradient-boosted model (xgboost) gets the raw numbers — runs needed, balls left, wickets in hand, required runs per ball, plus the same context — and monotone constraints: more runs needed can never raise WP; more balls or more wickets can never lower it; a stronger batting side can never be worse off. Trees can learn interactions by themselves, so they need no hand-shaping.

class WPModel:
    def _matrix(self, df):
        ...
        rr, bb = np.maximum(r, 1.0), np.maximum(b, 1.0)
        lr, lb = np.log(rr), np.log(bb)
        lq = lr - lb                                   # log(required runs per ball)
        frac = b / BALLS
        rq = np.minimum(rr / bb, 6.0)
        cols = [lq, lr, lb, w, w ** 2, frac, lq * w, lq * frac, w * frac, lq ** 2, lq * lb, lr * lb,
                rq, rq * frac, np.log1p(w) * lq, lb ** 2, w * lb]
        if "target" in self.extras:
            t = (c["tgt"] - 160.0) / 30.0
            cols += [t, t * lq, t * frac]
        if "env" in self.extras:
            e = (c["env"] - 160.0) / 20.0
            cols += [e, e * lq, e * frac]
        if "elo" in self.extras:
            d = c["elo"] / 100.0
            cols += [d, d * frac]
        ...

Full code: project/crease/winprob.py and code/02_logit_vs_gbm.py.

Tuning the trees, fairly

The boosted model has knobs. We choose them on a by-match 80/20 split inside the pre-2023 years:

=== GBM tuning (by-match 80/20 split of the pre-2023 chases; validation log loss) ===
   max_depth  min_child_weight  val_logloss  val_brier
1          3               500       0.4069     0.1307
0          3                50       0.4083     0.1312
4          5               500       0.4100     0.1321
2          3              2000       0.4102     0.1314
5          5              2000       0.4112     0.1319
3          5                50       0.4119     0.1325
8          7              2000       0.4127     0.1324
7          7               500       0.4128     0.1331
6          7                50       0.4216     0.1353
chosen: {'max_depth': 3, 'min_child_weight': 500, 'n_estimators': 300, 'learning_rate': 0.05}

The winner is the shallowest, most heavily regularised setting in the grid: trees of depth 3 with at least 500 balls' worth of weight in every leaf. The data are telling us something already — the chase state space is smooth, and the extra flexibility of deep trees mostly buys the ability to memorise matches, which section 20.3 showed is worthless.

The comparison

Now every model, fitted before 2023, scored once on 2023–26:

=== Out of time: fit < 2023, test 2023-26 (Brier, log loss; IPL subset; IPL gap = observed - forecast) ===
                                model  brier  logloss  ipl_brier  ipl_gap
0                           base rate 0.2475   0.6930     0.2482   0.0134
1                  required rate only 0.1385   0.4302     0.1707   0.1435
2                  WP v0 (Ch 9 table) 0.1252   0.3903     0.1580   0.1339
3                        logit: state 0.1249   0.3874     0.1583   0.1333
4               logit: state + target 0.1200   0.3734     0.1493   0.1077
5                  logit: state + env 0.1192   0.3723     0.1399   0.0860
6         logit: state + target + env 0.1164   0.3645     0.1378   0.0770
7   logit: state + target + env + elo 0.1143   0.3591     0.1389   0.0771
8                          gbm: state 0.1264   0.3923     0.1614   0.1384
9                 gbm: state + target 0.1215   0.3790     0.1529   0.1145
10                   gbm: state + env 0.1238   0.3862     0.1631   0.1425
11          gbm: state + target + env 0.1207   0.3779     0.1567   0.1273
12    gbm: state + target + env + elo 0.1191   0.3741     0.1579   0.1304

Rows 2 and 3 first. A logistic regression on the state alone (0.1249) does as well as WP v0 (0.1252) — the same information, smoothed differently, gives the same answer. The table was never the problem; the missing context was.

Then the context features, one at a time. The target alone cuts the Brier to 0.1200; the environment alone to 0.1192; both together 0.1164; add the Elo gap and the logistic model reaches 0.1143. In log loss, the same story: 0.3903 for WP v0 down to 0.3591. The IPL gap — how far chasers out-performed the forecast — falls from 13.4 points to 7.7.

That last row is WP v1: logistic regression on the state plus target, scoring environment and Elo gap. It is the default in crease.winprob.fit_wp.

The boosted model is better than WP v0 with the same features, but worse than the logistic model in every row — and, strikingly, adding the environment makes the boosted model worse in the IPL (0.1529 → 0.1631 for target → environment alone). Figure 20.3 shows why.

Left: WP against runs needed with 36 balls and 7 wickets left for WP v0, WP v1 and boosting. Right: start-of-chase WP against target in a 150-run and a 190-run environment for WP v1 and boosting

📊 Figure (described): Left panel: three S-shaped curves of chasing WP against runs needed (36 balls, 7 wickets in hand, target 170, environment 160); WP v0, WP v1 and boosting nearly overlap, falling through 50% at about 60 runs needed. Right panel: WP at the start of a chase against the target, for environments of 150 and 190 runs. WP v1's two curves are smooth and clearly separated — a 190-run world makes every target easier. Boosting's curves are steppy and its 190-run curve sits below where it should be, close to the 150 curve, because no IPL-like environment of 190 existed in its training data.

Start of the chase (all 120 balls, 10 wickets), Elo gap 0: WP by target and environment
   target  v1 env 150  v1 env 170  v1 env 190  gbm env 150  gbm env 170  gbm env 190    v0
0     140       0.670       0.782       0.863        0.658        0.769        0.741 0.707
1     160       0.473       0.604       0.721        0.457        0.600        0.550 0.537
2     180       0.299       0.412       0.534        0.287        0.427        0.378 0.313
3     200       0.176       0.254       0.352        0.159        0.267        0.229 0.168
4     220       0.101       0.148       0.212        0.109        0.147        0.123 0.077

🔍 Why this works (and why the trees fail). A tree model predicts by dropping a state into a leaf and reporting the average outcome of the training states in that leaf. For a feature value beyond anything in training, it lands in the outermost leaf and reports whatever that leaf learned — it cannot continue a trend. Only 1% of pre-2023 chases were played in an environment above 172.7; the IPL test matches of 2026 averaged 188.7. So the trees treat a 190-run world as if it were a 173-run world, and their curves even turn the wrong way (chasing 160 is 0.600 at 170 but 0.550 at 190). The logistic model is a smooth function of the environment, so it extrapolates: if bigger environments made targets easier up to 173, it assumes they keep doing so. That is an assumption, and it could be wrong — but in a game whose scoring has risen for a decade it is a much better assumption than "nothing changes beyond the edge of the data".

How big is the environment effect in cricket terms? Chasing 200 at the first ball, WP v1 gives the chasing side 17.6% in a 150-run environment and 35.2% in a 190-run one. Chapter 9's era-specific tables gave 0.168 (pre-2023 pool) and 0.491 (IPL 2023–26) — so WP v1, fitted without a single 2023 match, closes about half the gap between the stale table and the new reality, purely by knowing what kind of scoring world the match is played in.

Once a chase is under way, the state dominates and the environment matters much less. For "54 off 30, 8 wickets in hand, target 170", WP v1 moves only from 0.559 (environment 150) to 0.528 (environment 190) — and in the opposite direction, because at a fixed target a high-scoring environment means the chasing side has been slow to reach this point. Context features earn their keep mainly at the start of a chase and in the first innings, where the state alone says little.

📋 Try it — Predict this match. It is IPL 2026. A side chasing 190 is 110 for 3 after 14 overs (80 needed off 36, 7 wickets in hand), environment 188.7, Elo gap 0. Use model.predict(80, 36, 7, target=190, env_par=188.7, elo_diff=0) with WP v1 fitted before 2023, and again with env_par=160. Before running it, guess which is higher and by how much.

Worked answer

From code/02_logit_vs_gbm.py:

text Try it: need 80 off 36, 7 wickets in hand, target 190, Elo gap 0 (WP v1): env_par 188.7: 0.131 env_par 160: 0.146

About 13–15%: needing 13.3 an over for six overs is hard in any league. Most people guess the high-scoring environment helps; it slightly hurts, for the reason given above — with the target fixed at 190, being only 110 after 14 overs in a 189-run world is a sign that this pitch or this batting line-up is not playing like the league average. The gap is 1.5 points. At this stage of a chase the state does most of the work; the environment mattered most when the target was set.

🔄 Check your understanding 1. WP v1 and the state-only logistic model share the same state features. What is the only reason WP v1 scores better out of time? 2. Why did tuning choose the shallowest trees?

Answer

  1. The context: target, scoring environment and Elo gap. The state-only logistic model (0.1249) is no better than WP v0 (0.1252). 2. Because, judged on held-out matches, the extra flexibility of deep trees mostly fits match-specific noise. The state space is smooth and low-dimensional, so a small model loses little and generalises better.

20.6 Calibration: does 70% mean 70%?

🚪 Threshold concept — calibration. A probability forecast is a promise about frequencies: of all the times a calibrated model says 70%, the event happens about 70% of the time. You cannot check that promise on one match — a single 70% forecast is "right" whichever way the match goes. You check it by pooling many forecasts with the same number and counting. Once you see forecasts this way, a model is not "right" or "wrong" about a match; it is calibrated or miscalibrated across matches, and sharp or vague. Those are different properties, and you need both.

Tom Ashworth spent fifteen years pricing sport for a licensed bookmaker before he started teaching risk. Nusrat sent him the reliability diagram below with a one-line message: Which model is best?

Tom: Before I answer — which one would you trade on?

Nusrat: The one with the lowest Brier score. WP v1.

Tom: Good instinct, wrong reason. The Brier score mixes two things. One is whether your 70s come in seventy per cent of the time. That's calibration — the bit a bookmaker loses money on if it's wrong, because the other side of the counter will find your mispriced 70s and back them all day. The other is whether your forecasts move — whether you say 95 and 5 when you can, instead of hiding near 50. That's resolution. You can be perfectly calibrated and useless: say 52.4% before every ball of every chase and you'll be right on average for ever.

Nusrat: So I need both numbers separately.

Tom: You need both numbers separately, and you need them for every league you'd use the model in. A model that's calibrated "overall" can be ten points out in the one competition you care about. We'd find out the expensive way.

The reliability diagram

To draw one, sort every forecast into bins (0–10%, 10–20%, …), and in each bin compare the average forecast with the share of those states in which the chasing side actually won. A calibrated model lies on the diagonal.

t = wp.calibration_table(p, y, bins=10)      # predicted, observed, n per bin
WP v0 (table)
             bin  predicted  observed      n   gap
0  (-0.001, 0.1]      0.031     0.042  98283 0.011
1     (0.1, 0.2]      0.149     0.207  35928 0.059
2     (0.2, 0.3]      0.251     0.309  31496 0.059
3     (0.3, 0.4]      0.350     0.399  25996 0.050
4     (0.4, 0.5]      0.448     0.492  25561 0.044
5     (0.5, 0.6]      0.552     0.592  24475 0.040
6     (0.6, 0.7]      0.652     0.670  25624 0.018
7     (0.7, 0.8]      0.751     0.773  26589 0.022
8     (0.8, 0.9]      0.853     0.865  32073 0.013
9     (0.9, 1.0]      0.965     0.971  75887 0.005

WP v1 (logistic)
             bin  predicted  observed      n   gap
0  (-0.001, 0.1]      0.030     0.031  98031 0.001
1     (0.1, 0.2]      0.147     0.182  37356 0.034
2     (0.2, 0.3]      0.248     0.269  30204 0.021
3     (0.3, 0.4]      0.349     0.385  25604 0.036
4     (0.4, 0.5]      0.450     0.495  23872 0.046
5     (0.5, 0.6]      0.550     0.600  22869 0.050
6     (0.6, 0.7]      0.651     0.680  23289 0.029
7     (0.7, 0.8]      0.751     0.772  25358 0.021
8     (0.8, 0.9]      0.852     0.858  30122 0.006
9     (0.9, 1.0]      0.973     0.977  85207 0.004

Every gap is positive, for both models. Out of time, in 2023–26, chasing sides won more often than either model expected, in every probability band — by up to 6 points for WP v0 and up to 5 for WP v1. That is not noise; with 20,000–100,000 states per bin, it is a shift in the game. WP v1's gaps are smaller nearly everywhere, and much smaller in the tails (0.001 and 0.004 at the extremes).

Reliability diagram for WP v0, gradient boosting and WP v1 on men's T20 chases 2023–26, with histograms of the forecasts

📊 Figure (described): Top: observed share of chases won against the average forecast in ten bins, for three models fitted before 2023, with a dotted diagonal for perfect calibration. All three curves sit slightly above the diagonal through the middle (chasers did better than forecast); WP v1's curve is closest to it. Bottom: histograms of the forecasts — all three models put most states near 0 or 1, with WP v1 slightly more decisive. The takeaway: WP v1 is both better calibrated and sharper, but the whole 2023–26 period leans toward the chasing side.

Splitting the Brier score: reliability and resolution

Tom's two numbers have formal names. Murphy's decomposition splits the Brier score into reliability (the calibration error — lower is better), resolution (how far forecasts move away from the base rate in the direction the outcomes go — higher is better) and uncertainty (how hard the outcome is to predict at all, which no model can change):

📐 Definition — Brier decomposition: Brier ≈ reliability − resolution + uncertainty, where reliability = Σ nₖ/N (mean forecastₖ − observedₖ)², resolution = Σ nₖ/N (observedₖ − overall rate)², uncertainty = rate × (1 − rate), over forecast bins k.

=== Brier decomposition and recalibration fit ===
                   brier  reliability  resolution  uncertainty  intercept  slope
model                                                                           
WP v0 (table)     0.1252       0.0011      0.1222       0.2499     0.2095 0.9708
Gradient boosting 0.1191       0.0016      0.1290       0.2499     0.2803 1.0138
WP v1 (logistic)  0.1143       0.0006      0.1328       0.2499     0.1576 1.0220

WP v1 wins on both: its reliability error is about half WP v0's (0.0006 v 0.0011) and its resolution is higher (0.1328 v 0.1222). Notice where most of the Brier improvement comes from: resolution. The context features let WP v1 say "this chase is harder than the state suggests" before the state reveals it. The boosted model has better resolution than WP v0 but worse reliability — sharper, but less honest.

The last two columns come from a recalibration fit: regress the outcome on the logit of the forecast. A calibrated model has intercept 0 and slope 1. All three slopes are close to 1 (none of the models is badly over- or under-confident in how far it spreads its forecasts); all three intercepts are positive — the whole 2023–26 period favoured chasers relative to the past. WP v1's intercept is the smallest.

📐 Definition — recalibration slope and intercept: the coefficients a, b in logit P(win) = a + b · logit(p). Slope below 1 means the forecasts are too extreme (overconfident); above 1, too timid; a nonzero intercept means a shift in the overall level.

Tom's test: when the model says 70%

=== The 70% test: states where the model said 65-75% ===
WP v0 (table)        n= 26,144  mean forecast 0.700  chasing side won 0.715  (distinct chases 1,772)
Gradient boosting    n= 23,880  mean forecast 0.700  chasing side won 0.744  (distinct chases 1,705)
WP v1 (logistic)     n= 24,178  mean forecast 0.701  chasing side won 0.721  (distinct chases 1,765)

Around 70%, WP v0 and WP v1 both pass comfortably (71.5% and 72.1%); the boosted model's 70s came in 74.4% of the time. Note the last column: 24,178 states but only 1,765 chases. That is the honest sample size.

⚠️ Common pitfall: treating ball states as independent. A chase contributes a hundred or so forecasts and one outcome. Calibration tables built on states look as if they rest on hundreds of thousands of observations; their real information is closer to the number of matches. Whenever you put an interval on a calibration gap, resample matches, not balls — as the IPL interval below does.

Calibration by league: where "overall" hides the problem

=== Calibration-in-the-large by competition (observed - forecast, 2023-26) ===
                     chases  observed  WP v0 (table)  Gradient boosting  WP v1 (logistic)
group                                                                                    
T20I (other)           1560     0.459         -0.057             -0.023            -0.031
T20 Blast               470     0.487          0.072              0.063             0.031
T20I (full members)     303     0.472          0.051              0.038             0.021
IPL                     281     0.508          0.134              0.130             0.077
BPL                     171     0.557          0.064              0.040             0.054
BBL                     150     0.620          0.103              0.073             0.078
PSL                     139     0.493          0.128              0.131             0.084
ILT20                   132     0.590          0.089              0.065             0.074
CPL                     126     0.579          0.099              0.083             0.072
SA20                    118     0.433          0.006              0.004            -0.001
MLC                     102     0.527          0.083              0.067             0.056
LPL                      70     0.457          0.058              0.037             0.038
Syed Mushtaq Ali         45     0.585          0.065              0.083             0.085

IPL 2023-26 (281 chases): gap v0 +0.134 (90% +0.101 to +0.169); v1 +0.077 (90% +0.045 to +0.110)
  IPL 2023: chases  71  observed 0.435  v0 0.363  v1 0.398  env_par 173.8
  IPL 2024: chases  70  observed 0.483  v0 0.364  v1 0.418  env_par 183.9
  IPL 2025: chases  69  observed 0.486  v0 0.376  v1 0.434  env_par 183.1
  IPL 2026: chases  71  observed 0.629  v0 0.393  v1 0.474  env_par 188.7

(The gap here is the average observed outcome minus the average forecast across all ball states of the competition — Chapter 9's measure, so the 0.134 for WP v0 in the IPL is the same 13.4 points.)

This is the table that matters for anyone using a WP model in a particular league. WP v1 cuts the IPL miss from 13.4 points to 7.7 (90% interval, resampling chases: 4.5 to 11.0), and the PSL miss from 12.8 to 8.4. It halves the T20 Blast miss. But it does not eliminate them: in almost every franchise league, chasers in 2023–26 did better than a model fitted on the past expects even after accounting for the scoring environment. Associate T20Is go the other way — chasers there did worse than forecast.

The year-by-year IPL rows are sobering. The environment feature moves WP v1's average forecast up as scoring rises (0.398 → 0.474), but the results moved faster, ending in a 2026 season in which the observed chase outcome, averaged over ball states, was 0.629 — 15 points beyond even WP v1. That is not a problem a pre-2023 model can solve; it needs recent data, which is the subject of the next section.

Left: reliability diagram for IPL chases 2023–26, WP v0 v WP v1. Right: observed minus forecast by competition for both models

📊 Figure (described): Left: IPL-only reliability curves. WP v0's curve sits well above the diagonal across the middle — its forecasts of about one in three came in roughly 60% of the time; WP v1's curve is closer but still above. Right: horizontal bars of observed − forecast for eleven competitions with 100+ chases; WP v1's bars are shorter than WP v0's in most leagues and nearly all point the same way — toward the chasing side — except associate T20Is.

The last over: where every smooth model struggles

Calibration is also about where in the state space a model fails. The last over is special: a chase there is a handful of discrete events. Needing 4 off 1 ball is one swing for a boundary, and no smooth function of "runs per ball" knows that.

last ball of the chase, 2023-26, by runs needed (ties count half):
              1      2      3      4      5      6      7      8+
n        51.000 39.000 32.000 47.000 33.000 30.000 28.000 870.000
observed  0.922  0.769  0.422  0.340  0.167  0.167  0.054   0.000
v0        0.843  0.431  0.191  0.150  0.117  0.104  0.067   0.009
v1        0.836  0.508  0.235  0.078  0.027  0.011  0.007   0.002

The samples are small (30–50 last-ball states per row), but the direction is clear: both models under-rate the batting side's chance of a last-ball boundary, and WP v1 badly so when 4–6 are needed (it says 1–8%; batters got there 17–34% of the time). Over the whole last over the picture is milder — WP v0 and v1 have the same last-over Brier, 0.052 — but a model whose "4 off 1" is 0.078 will hand a batter who hits that four almost a full win of WPA when the honest figure is nearer two-thirds.

We tried the obvious fix, and it is in the module as EndGame: treat the last two overs as a dice game, count the real distribution of single-ball outcomes by required-rate band and wickets left, and solve the chase exactly by dynamic programming. It got the last ball closer but did worse elsewhere — in sample it under-forecast chasers by about 5 points in the middle bands (0.686 against an observed 0.744 when needing 6–9 an over), for the same reason Chapter 19's Markov chain produced too narrow a spread of totals: real batters and real conditions vary from innings to innings, and averaging them into one set of ball probabilities loses that. So WP v1 ships without it (endgame=False), and the last ball goes in the chapter's list of honest limitations — and in Exercise C6.

🔄 Check your understanding 1. A model says 30% for 10,000 states in the IPL, and chasers won 48% of them. Is the model miscalibrated, unlucky, or both? 2. Why can a model with a worse Brier score sometimes be the better one to use?

Answer

  1. Almost certainly miscalibrated: but check how many chases those 10,000 states come from. If it is 100 chases, an 18-point gap is still large (the IPL interval above is about ±3 points per 281 chases), so it is not plausibly luck. 2. Because the Brier score adds calibration and resolution together. A sharper model with a small calibration error can score better overall than a slightly blunter but calibrated one — and for pricing or decisions, a known calibration error you cannot fix is worse than a little lost sharpness. Look at both components, by league.

20.7 The 2023+ era: an era flag, an era-only fit, or the environment?

The IPL's scoring jump is the hardest test a T20 win-probability model has faced. We now have three seasons of it. What is the right way to build a model for next season?

There are three candidate fixes, and section 20.5 has already tried the third:

  1. An era flag — a 0/1 feature for 2023 onward, letting the model shift its predictions in the new era.
  2. An era-only fit — throw away the old data and fit only on 2023 onward.
  3. The scoring environment — a continuous feature that measures each league's scoring level as it changes, instead of a single switch.

To test them honestly we need some of the new era in training. So the split moves: fit on everything before 2025 (7,105 chases, including 1,833 from 2023–24), test on 2025–26 (1,834 chases, 200,902 states).

=== Out of time 2025-26 (Brier unless stated) ===
                                brier  logloss  ipl_brier  t20s_male_fm_brier  t20s_male_assoc_brier  ntb_brier  ipl_gap
approach                                                                                                                
WP v0 table, pooled            0.1229   0.3835     0.1554              0.1145                 0.1013     0.1358   0.1675
logit state, pooled            0.1227   0.3815     0.1571              0.1144                 0.1008     0.1355   0.1678
logit state + era flag         0.1217   0.3790     0.1511              0.1126                 0.1023     0.1342   0.1543
logit state, era-only fit      0.1218   0.3793     0.1504              0.1127                 0.1025     0.1345   0.1510
WP v1 (target+env+elo), pooled 0.1097   0.3468     0.1188              0.0992                 0.0889     0.1272   0.0630
WP v1 + era flag               0.1093   0.3461     0.1175              0.0989                 0.0892     0.1277   0.0543
WP v1, era-only fit            0.1087   0.3445     0.1146              0.0980                 0.0877     0.1309   0.0131
GBM v1 features, pooled        0.1121   0.3546     0.1217              0.1027                 0.0918     0.1307   0.0629
GBM v1 features, era-only fit  0.1136   0.3597     0.1195              0.1027                 0.0936     0.1349   0.0489

Brier difference era-only minus pooled (WP v1 features): -0.00101 (90% by-match bootstrap -0.00210 to +0.00008)
Brier difference WP v1 pooled minus state+era flag: -0.01204 (90% -0.01436 to -0.00969)

The answer has two layers.

First layer: the environment features do almost all the work. On a state-only model, the era flag and the era-only fit help a little (0.1227 → 0.1217/0.1218 overall; IPL 0.1571 → about 0.151). Replacing them with WP v1's context features is ten times as big an improvement: 0.1097, and the paired, match-resampled difference against the era-flag model is −0.0120 (90% interval −0.0144 to −0.0097). An era flag is one number for every league; the IPL's scoring moved by 20 runs, the BBL's barely at all, and associate T20Is not at all. A single switch cannot describe that. A measured environment can.

Second layer: with the context features in place, recent data still help — a little. The era-only WP v1 (fitted on 1,833 chases from 2023–24) beats the pooled WP v1 overall (0.1087 v 0.1097), although the 90% interval on the difference just touches zero (−0.0021 to +0.0001). In the IPL it is clearly better (0.1146 v 0.1188), and it almost removes the IPL bias: chasers out-performed it by only 1.3 points in 2025–26, against 6.3 for the pooled model. It is worse in the T20 Blast, which did not change much and loses the benefit of a decade of data.

The boosted model, again, does not beat the logistic model with the same features, pooled or era-only.

Brier scores for six approaches on men's T20 chases 2025–26, all competitions and the IPL

📊 Figure (described): Two panels of horizontal bars, all competitions (left) and the IPL (right), for WP v0, state-only logistic models with an era flag or an era-only fit, WP v1 pooled, WP v1 era-only, and boosting with WP v1's features. The two WP v1 bars are shortest in both panels; in the IPL the era-only WP v1 is shortest of all (0.1146), and the state-only "era" fixes barely improve on WP v0. The takeaway: measure the environment; then prefer recent data when you are forecasting the current season.

So the book's policy, which crease.winprob follows:

  • Historical curves and career WPA (Newlands 2017, Chapter 9's career leaderboards): the pooled WP v1. It knows each match's own environment, so it is fair across eras.
  • The current season (a live broadcast graphic, an IPL 2026 leaderboard, a betting model): WP v1 fitted on recent seasons only, refitted every season. Section 20.10 does exactly that.

🏏 Eye test: Wendell watched the 2025–26 table over Nusrat's shoulder.

Wendell: You've spent a page proving what any IPL captain could have told you in April 2023. You get an extra batter with the Impact Player, everybody bats deeper, so everybody swings harder, so the totals go up. And chasing gets easier because you know exactly what you need and you've got a bat at nine who can hit.

Nusrat: The environment feature catches the first part — the totals going up. It doesn't catch the second. The table says chasers still beat the pooled model by six points even after it knows the totals went up.

Wendell: That's the depth, then. Wickets in hand don't mean the same thing when number nine is a batter.

He may well be right, and the data can see the symptom (pooled WP v1 under-rates chasers; a model fitted on 2023+ does not) but not the cause. Cricsheet has no batting-position or Impact-Player substitution labels in the delivery table, so "wickets in hand are worth more now" is a hypothesis to test — Exercise D3 sets it up — not a finding of this chapter.

🔄 Check your understanding 1. Why is an era flag a poor tool when several leagues are pooled? 2. The era-only WP v1 is best in the IPL but worse in the T20 Blast. What does that suggest about refitting policy?

Answer

  1. It forces the same shift on every league at the same date, but leagues changed by different amounts (IPL and PSL a lot, BBL and associate T20Is little) and not all in 2023. 2. That "recent data only" is a bet that the recent past is more like the future than the long past. It pays where the game has changed (the IPL) and costs where it has not (the Blast, which loses a decade of data). A practical compromise is per-league recency: weight recent seasons more heavily, and more so in leagues whose environment has moved.

20.8 First-innings win probability via par

Everything so far has been about the chase, where the target makes the question concrete. In the first innings there is no target yet — so what does "Sri Lanka 0.40" mean when South Africa are 79 for 1 after 10 overs?

It means: if we could see the rest of South Africa's innings, and then the chase, how often would Sri Lanka win? We split that into two questions, each of which we can already answer.

  1. What total will the batting side reach? That is Chapter 19's Expected Runs table: from (balls left, wickets left), the average runs still to come. We rescale it to the match's environment (ER × env_par / table par) and add the real spread around it: for every over, the empirical distribution of (actual runs to come ÷ projected runs to come) in training innings.
  2. How often is each total defended? That is the chase model at its first ball: P(defend T) = 1 − WP(need T + 1 off 120, 10 wickets, target T + 1, same environment and Elo gap).

Average the second over the first and you have the first-innings WP.

📐 Definition — first-innings WP via par: WP(bat first | score s, balls left u, wickets left w) = mean over q of P(defend s + ER(u, w) · env_par/par · m_q), where ER is the Expected Runs table, par its value at the first ball, and m_q are 41 quantiles of the runs-to-come multiplier for the current over. crease.winprob.ParWP implements it.

par = wp.ParWP().fit(train_first_innings)          # Ch 19 hybrid ER table + spread
te1["wp_par_v1"] = wp.first_innings_wp(te1, v1, par)
Expected Runs table (pre-2023 men's T20 pool, hybrid): par 158.6 from 5,255 complete first innings
runs-to-come multiplier quantiles (5%, 50%, 95%) by over bowled:
  after  0 overs: 0.69  1.02  1.34
  after  5 overs: 0.67  1.01  1.37
  after 10 overs: 0.63  1.01  1.42
  after 15 overs: 0.56  1.00  1.52
  after 18 overs: 0.41  0.97  1.72

The par of 158.6 is Chapter 19's pre-2023 pool par, as it should be. The multipliers say that at the start of an innings the final total lands within about ±33% of par 90% of the time, and that the relative spread widens as the innings goes on (with two overs left, anything from 41% to 172% of the projected last-two-overs runs) even though the absolute spread shrinks.

The defend curve is where the environment earns its keep:

=== Defend curves: P(side batting first wins | final total), Elo gap 0, WP v1 (fit < 2023) ===
   total  env 145  env 160  env 175  env 190  WP v0
0    140    0.372    0.279    0.202    0.142  0.300
1    160    0.569    0.471    0.375    0.288  0.474
2    180    0.733    0.655    0.567    0.475  0.698
3    200    0.844    0.793    0.730    0.656  0.836
4    220    0.911    0.881    0.842    0.793  0.923
5    240    0.949    0.932    0.910    0.881  0.965
break-even total (P(defend) = 0.5) at env 160: 163
break-even total (P(defend) = 0.5) at env 190: 183

A total of 180 is a 73% total in a 145-run world and a 47.5% total in a 190-run world. The break-even total — the score that makes you a coin-flip to win — is 163 in a 160 environment and 183 in a 190 one. And even WP v1, fitted before 2023, is too generous to the side batting first in the modern IPL: it makes 200 a 66% total at environment 190, whereas Chapter 3 found that in IPL 2026 teams batting first with 200 or more won 20 of 37 (54.1%).

How does the par method compare with alternatives? We score three, all fitted before 2023, on every first-innings state of 2023–26:

=== First innings 2023-26 (3,737 matches, 458,678 states): P(side batting first wins) ===
                                       brier  logloss  mean_forecast  observed  overs 1-6   7-15  16-20
method                                                                                                 
Ch 9: par proxy + WP v0               0.2109   0.6140         0.4930    0.4805     0.2308 0.2042 0.1982
WP v1 via par (ER table + env)        0.1994   0.5862         0.4831    0.4805     0.2216 0.1936 0.1818
direct logistic, first-innings states 0.1952   0.5771         0.4890    0.4805     0.2160 0.1897 0.1790

IPL first innings 2023-26: observed bat-first win share 0.474; mean forecast Ch 9 0.607, v1 par 0.573, direct 0.527; Brier 0.2421 / 0.2301 / 0.2231

The par method with WP v1 beats Chapter 9's version (0.1994 v 0.2109) in every phase. But a third method beats both: a direct logistic model fitted on first-innings states (projected total relative to the environment, share of innings left, wickets, Elo gap) scores 0.1952. Why keep the par method at all?

Because the two answer different questions. The direct model is a black box that maps a first-innings state to a probability; it is a better forecaster. The par method is built from two pieces you can inspect and argue with — "they'll make about 175, and 175 here is defended 55% of the time" — and its first-innings WP joins the chase WP seamlessly at the innings break, because both come from the same chase model. For telling the story of a match and splitting credit between the innings, that coherence matters more than 0.004 of Brier. Both are in the chapter's code; crease.winprob uses the par method for curves, and Exercise C3 builds the direct one into the module.

Left: defend curves for four scoring environments. Right: first-innings calibration of three methods, 2023–26

📊 Figure (described): Left: P(side batting first wins) against first-innings total for environments of 145, 160, 175 and 190 runs — four parallel S-curves, each shifted right by roughly 15 runs from the last. Right: reliability curves for the first-innings forecasts of Chapter 9's method, WP v1 via par and the direct model; all three track the diagonal, with Chapter 9's method flattening at the top (its 90% forecasts won only about 85%).

Here is the par method at work on one state, 91 for 1 after 10 overs — the state Chapter 19's hook followed through seven real IPL innings:

=== Projection example: 91/1 after 10 overs ===
env 160: projected final total median 187, 10th-90th pct 159-217; WP(bat first) 0.682
env 190: projected final total median 205, 10th-90th pct 172-241; WP(bat first) 0.663

In a 190-run world, 91 for 1 projects 18 runs higher — and is worth slightly less, because the chase will be easier too.

📋 Try it — Settle this debate. "In the IPL now, 200 is a par score, not a winning one." Using the defend-curve table above and Chapter 3's IPL 2026 result (teams batting first with 200+ won 20 of 37), decide whether the claim is fair, and say what WP v1 fitted before 2023 gets wrong about it.

Worked answer

At environment 190 — about where the IPL sat in 2024–26 — WP v1 puts P(defend 200) at 0.656 and the break-even total at 183. So by the model, 200 is still a winning score, worth roughly two wins in three. The real 2026 record (54.1%) is much closer to "par". The model is too generous to the side batting first for the same reason it under-rates IPL chasers in section 20.6: even after accounting for the environment, chasing in the modern IPL is easier than anything in the pre-2023 data. A model fitted on 2023–25 (section 20.10's model) is the fairer referee — and the honest verdict is "200 is slightly better than par, and much less safe than it used to be".


20.9 Anchor A: the Newlands curve, rebuilt

Now the payoff. South Africa v Sri Lanka, third T20I, Newlands, 25 January 2017 (Cricsheet 936157). South Africa made 169 for 5; Sri Lanka were 116 for 2 after 15 overs, lost Dickwella and de Silva in Imran Tahir's 16th over for two runs, and then Seekkuge Prasanna (37 not out off 16) and Asela Gunaratne won it with a ball to spare.

Chapter 9 drew this match's curve with WP v0. Here we draw it with WP v1 — and, to keep the comparison clean, both models are fitted leave-one-match-out: on every men's T20 match in the snapshot except this one. (WP v0 refitted this way reproduces Chapter 9's numbers exactly.)

s1_loo = data.s1[data.s1["match_id"] != MID]
s2_loo = data.s2[data.s2["match_id"] != MID]
v1 = wp.fit_wp(s2_loo)
par = wp.ParWP().fit(s1_loo)
cur = wp.wp_curve(MID, v1, par, data=data)
South Africa v Sri Lanka, Newlands, Cape Town, 25 Jan 2017; winner Sri Lanka
context: env_par 157.1 (T20Is between full members, past-only); Elo before the match SA 1556, SL 1475 (gap for SA +81)

=== Checkpoints: WP of Sri Lanka (the chasing side) ===
                 moment     score  SL WP v1  SL WP v0
0    inns 1, after 0 ov    SA 0/0     0.460     0.528
1   inns 1, after 10 ov   SA 79/1     0.336     0.398
2   inns 1, after 13 ov  SA 107/1     0.289     0.345
3   inns 1, after 19 ov  SA 148/5     0.431     0.524
4    inns 2, after 0 ov    SL 0/0     0.348     0.431
5    inns 2, after 5 ov   SL 45/1     0.518     0.563
6   inns 2, after 10 ov   SL 81/2     0.531     0.576
7   inns 2, after 14 ov  SL 114/2     0.679     0.755
8   inns 2, after 15 ov  SL 116/2     0.503     0.649
9   inns 2, after 16 ov  SL 118/4     0.191     0.246
10  inns 2, after 17 ov  SL 137/4     0.523     0.565
11  inns 2, after 18 ov  SL 144/5     0.328     0.332
12  inns 2, after 19 ov  SL 159/5     0.673     0.623
13        innings break  SA 169/5     0.348     0.431
SA par projection after 10 overs (v1, ER table x env): 174.9

The two curves tell the same story with different emphasis, and every difference has a reason you can name.

Sri Lanka start lower. WP v1 makes them 0.460 before a ball is bowled and 0.348 at the start of the chase, against WP v0's 0.528 and 0.431. Two context features are responsible. South Africa went into the match rated 81 Elo points higher (1556 v 1475, on all earlier men's T20Is in the data). And 170 was an above-par target in that environment: full-member T20Is had been averaging 157.1 in the first innings. WP v0 knew neither fact.

"116 for 2 after 15" was never as good as it looked. WP v0 had Sri Lanka 0.649 there; WP v1 has 0.503 — a coin flip. Part of that is the lower starting point; part is the 15th over itself, two runs off Andile Phehlukwayo, which WP v1 treats as a heavier blow (−0.177 against −0.107). With 54 needed off 30, a two-run over costs you more than a table of past chases admits.

Tahir's over is still the turning point, though WP v1 spreads the damage over two overs:

=== Over-by-over change in Sri Lanka's WP (chase, overs 13-20) ===
       runs  wkts  dWP v1  dWP v0          bowler
over1                                            
13        7     0  -0.002   0.013      WD Parnell
14       12     0   0.133   0.117        JT Smuts
15        2     0  -0.177  -0.107  AL Phehlukwayo
16        2     2  -0.312  -0.403     Imran Tahir
17       19     0   0.332   0.319      WD Parnell
18        7     1  -0.196  -0.233      D Paterson
19       15     0   0.345   0.291  AL Phehlukwayo
20       11     0   0.327   0.377      D Paterson

Over 16 ball by ball (Imran Tahir), Sri Lanka's WP before -> after:
  N Dickwella    0 run(s)                           v1 0.503 -> 0.457   v0 0.649 -> 0.609
  N Dickwella    WICKET N Dickwella (caught)        v1 0.457 -> 0.355   v0 0.609 -> 0.450
  DM de Silva    1 run(s)                           v1 0.355 -> 0.342   v0 0.450 -> 0.438
  S Prasanna     1 run(s)                           v1 0.342 -> 0.329   v0 0.438 -> 0.426
  DM de Silva    WICKET DM de Silva (stumped)       v1 0.329 -> 0.223   v0 0.426 -> 0.282
  BKG Mendis     0 run(s)                           v1 0.223 -> 0.191   v0 0.282 -> 0.246

At 118 for 4 after 16, needing 52 off 24, both models agree Sri Lanka are big underdogs: 0.191 (v1) and 0.246 (v0). Then the curve becomes a seesaw — 19 off Parnell's 17th, Mendis run out in the 18th, 15 off the 19th, 11 off the 20th.

Sri Lanka's win probability ball by ball at Newlands with WP v1 and WP v0, wickets marked

📊 Figure (described): Sri Lanka's WP after every ball of both innings, WP v1 as a solid orange line and WP v0 as a dashed grey line, with wickets marked by red crosses. Through South Africa's innings Sri Lanka drift from about 0.46 to the low 0.30s and recover to about 0.35 at the break (v0 runs 5–10 points higher throughout). In the chase both lines climb to a peak after 14 overs, collapse through overs 15–16 to below 0.2, then swing violently in the last four overs before finishing at 1. The takeaway: the shape is the same story; WP v1 is lower early because it knows South Africa were stronger and 170 was above par.

The biggest single-ball swings, by WP v1, all come at the end:

=== Turning points (biggest single-ball swings, batting side's WP; cricket notation 15.2 = over 16 ball 2) ===
   innings batting_team over_ball         batter          bowler                          what  wp_before  wp_after    dwp
0        2    Sri Lanka      18.3     S Prasanna  AL Phehlukwayo                      6 run(s)      0.358     0.645  0.287
1        2    Sri Lanka      19.4  DAS Gunaratne      D Paterson                      4 run(s)      0.789     0.993  0.203
2        2    Sri Lanka      18.6     S Prasanna  AL Phehlukwayo                      4 run(s)      0.472     0.673  0.200
3        2    Sri Lanka      19.1  DAS Gunaratne      D Paterson                      4 run(s)      0.673     0.872  0.200
4        2    Sri Lanka      16.6     S Prasanna      WD Parnell                      6 run(s)      0.339     0.523  0.185
5        2    Sri Lanka      17.3     S Prasanna      D Paterson   WICKET BKG Mendis (run out)      0.624     0.455 -0.169
6        2    Sri Lanka      18.5     S Prasanna  AL Phehlukwayo                      0 run(s)      0.606     0.472 -0.134
7        2    Sri Lanka       5.1   LD Chandimal     Imran Tahir  WICKET LD Chandimal (bowled)      0.518     0.387 -0.131

Prasanna's six off the third ball of the 19th over is the biggest swing of the match in both models (Chapter 9 had it at +24.8 points; WP v1 +28.7). Four of the top five are Prasanna and Gunaratne boundaries in the last three overs. Imran Tahir's two wickets do not make the single-ball top eight under WP v1 — each was worth about 10 points — but his over as a whole (−0.312) is the biggest negative swing of any over in the chase. Turning points come in two shapes: one huge ball, or a sequence of medium ones.

Now the credit:

=== Match WPA: batting (v1 v v0) ===
                batting_team   runs  balls    wpa  gained   lost  wpa_v0
batter                                                                  
S Prasanna         Sri Lanka 37.000 16.000  0.573   1.025 -0.452   0.504
DAS Gunaratne      Sri Lanka 11.000  6.000  0.344   0.410 -0.067   0.377
N Dickwella        Sri Lanka 68.000 51.000  0.229   0.844 -0.615   0.157
extras             Sri Lanka  0.000  0.000  0.086   0.121 -0.036   0.070
AB de Villiers  South Africa 63.000 44.000  0.073   0.203 -0.131   0.081
WU Tharanga        Sri Lanka 20.000 11.000  0.069   0.214 -0.145   0.018
...
LD Chandimal       Sri Lanka  5.000  5.000 -0.113   0.038 -0.151  -0.118
BKG Mendis         Sri Lanka  2.000  3.000 -0.232   0.000 -0.232  -0.235
DM de Silva        Sri Lanka 19.000 27.000 -0.304   0.038 -0.342  -0.204

=== Match WPA: bowling ===
                    bowled_at  balls  runs    wpa  wpa_v0
bowler                                                   
Imran Tahir         Sri Lanka     24    18  0.462   0.525
PADLR Sandakan   South Africa     24    23  0.042   0.055
...
AL Phehlukwayo      Sri Lanka     24    34 -0.249  -0.255
D Paterson          Sri Lanka     23    39 -0.289  -0.296
WD Parnell          Sri Lanka     24    42 -0.321  -0.278

(The runs column for bowlers counts every run scored off them, including byes and leg-byes.)

The ranking is stable — Prasanna, Gunaratne, Dickwella for Sri Lanka; Tahir the largest bowling contribution on the field — but the sizes move. Prasanna's WPA rises from +0.504 to +0.573; Dickwella's from +0.157 to +0.229; Dhananjaya de Silva's 19 off 27 falls from −0.204 to −0.304; Tahir's +0.525 becomes +0.462. Dickwella gains because WP v1 started Sri Lanka lower, so his 68 off 51 dragged them further. De Silva loses because WP v1 thinks a slow partnership at 10 an over required was more damaging than the table did.

WPA at Newlands under WP v1 and WP v0: Sri Lanka's batters and South Africa's bowlers in the chase

📊 Figure (described): Two panels of paired horizontal bars. Left: Sri Lanka's batters' WPA, WP v1 (solid) beside WP v0 (hatched) — Prasanna highest (about +0.57 v +0.50), then Gunaratne, Dickwella; de Silva lowest (about −0.30 v −0.20). Right: South Africa's bowlers in the chase — Tahir the only large positive (+0.46 v +0.53), Parnell, Paterson and Phehlukwayo each about −0.25 to −0.32. The takeaway: the model changes the sizes of the credits, not the story.

🏏 Eye test: Wendell watched the curve with the sound off.

Wendell: Your model gives Dickwella a quarter of a win and de Silva minus a third. I'll give you de Silva — 19 off 27 when you need ten an over is a crime. But Dickwella batted 51 balls and got out to a leg-spinner with the game on a knife-edge. The man who should have finished it didn't.

Nusrat: The model charges him for that. He lost 0.615 of a win across his innings — more than anyone on the field. He also gained 0.844. The net is positive because most of his 68 came when the chase needed it.

Wendell: Gross and net. Fine. I'd still drop him down the order in my head.

The model sees what happened ball by ball, with the average chase as its yardstick. It cannot see what Wendell is pointing at — that Dickwella was the set batter facing a leg-spinner in a spell where South Africa clearly targeted him, and that a coach's question ("would someone else have done better in that spot?") is about the counterfactual, not the record.

🔄 Check your understanding 1. Why does WP v1 put Sri Lanka lower than WP v0 at the start of the chase? 2. Name one turning point that is "one huge ball" and one that is "a sequence of medium ones".

Answer

  1. It knows two things WP v0 did not: South Africa's Elo rating was 81 points higher, and a target of 170 was above the full-member T20I environment of 157.1. 2. One huge ball: Prasanna's six at 18.3 (+0.287). A sequence: Phehlukwayo's two-run 15th over and Tahir's 16th over together (−0.177 and −0.312), none of whose single balls was bigger than about 0.10.

20.10 WPA leaderboard: IPL 2026

Section 20.7 said: for the current season, fit on recent seasons. So for IPL 2026 we fit WP v1 on men's T20 chases from 2023–25 only (2,780 chases) and the par model on all first innings before 2026 (8,215). Neither has seen a ball of IPL 2026. Then we value both innings of every decided, full-length match of the season — 72 of them — and add up WPA.

v1 = wp.fit_wp(s2_fit)                                   # 2023-25 chases
par = wp.ParWP().fit(s1_fit)                             # first innings before 2026
cur = wp.match_curves(ids, v1, par, data)                # every IPL 2026 match, both innings
bat = wp.wpa(cur, by="batter")
WP v1 fitted on 2,780 men's T20 chases (2023-25); par on 8,215 first innings before 2026
IPL 2026 matches valued (decided, 20 overs a side, no DLS): 72
IPL 2026 chases: observed chasing win share 0.641; mean forecast (per ball) era-only v1 0.567 v observed 0.629; Brier era-only 0.0943, pooled 0.1039
start-of-chase WP: mean 0.536, range 0.091-0.998
batter names mapping to >1 registry id in IPL 2026: 0

First, a calibration check on the season itself. Even the recent-data model under-rated IPL 2026 chasers (average forecast 0.567, observed 0.629): 2026 was an extreme chasing season — chasers won 64.1% of these matches. The era-only model is still clearly better than the pooled one on this season (Brier 0.0943 v 0.1039). And no batter name maps to two different people this season, so names are safe to group on.

=== IPL 2026 batting WPA (both innings) - top 15 ===
             batter  matches   runs  balls     sr  runs_rank  wpa  gained  lost  wpa_per_match  wpa_pooled
0     V Suryavanshi       16 776.00 327.00 237.31          1 2.34    4.44 -2.10           0.15        2.28
1    P Simran Singh       13 510.00 302.00 168.87         11 1.08    3.23 -2.15           0.08        1.22
2         DA Miller       10 211.00 137.00 154.01         49 0.97    2.93 -1.95           0.10        0.96
3      Ishan Kishan       15 602.00 330.00 182.42          6 0.95    2.99 -2.05           0.06        1.01
4      RD Rickelton       11 440.00 236.00 186.44         16 0.87    2.88 -2.01           0.08        0.82
5        D Padikkal       14 430.00 250.00 172.00         18 0.74    2.20 -1.47           0.05        0.78
6           V Kohli       15 675.00 405.00 166.67          4 0.73    2.42 -1.68           0.05        0.96
7     Priyansh Arya       13 364.00 172.00 211.63         23 0.73    2.18 -1.45           0.06        0.60
8   Abhishek Sharma       15 563.00 275.00 204.73          8 0.70    2.82 -2.13           0.05        0.71
9         H Klaasen       15 624.00 390.00 160.00          5 0.66    2.42 -1.76           0.04        0.85
...
bottom 5 among batters with 100+ balls:
          batter  matches   runs  balls     sr   wpa
166  Dhruv Jurel       16 515.00 333.00 154.65 -0.47
167      RR Pant       12 280.00 216.00 129.63 -0.49
170    AM Rahane       13 327.00 242.00 135.12 -0.57
171     T Stubbs       12 275.00 215.00 127.91 -0.79
173     N Pooran       13 196.00 160.00 122.50 -1.00

batters with 100+ balls: 60; Spearman(runs, WPA) 0.49; Spearman(SR, WPA) 0.71; Spearman(WPA era-only, WPA pooled) 0.978

the five top run-scorers and their WPA rank:
  V Suryavanshi    runs  776 (SR 237.3)  WPA +2.34  WPA rank 1
  Shubman Gill     runs  732 (SR 163.0)  WPA +0.50  WPA rank 17
  B Sai Sudharsan  runs  722 (SR 158.0)  WPA +0.40  WPA rank 22
  V Kohli          runs  675 (SR 166.7)  WPA +0.73  WPA rank 7
  H Klaasen        runs  624 (SR 160.0)  WPA +0.66  WPA rank 10

Vaibhav Suryavanshi added 2.34 wins — more than twice anyone else. That is the season's top run-scorer (776 runs at a strike rate of 237.31) also being its most valuable batter, which does not always happen: his innings were fast enough that the runs moved the needle. His gross numbers are worth a look too: he gained 4.44 wins of probability and gave back 2.10. Even the best batter in the league loses half of what he gains — that is what batting in T20 is.

Below him the order changes sharply. Prabhsimran Singh (11th by runs) and David Miller (49th by runs, 211 of them in 10 matches) are second and third, because their runs came in chases at moments of high leverage: Miller's 0.97 is almost entirely from chasing (+1.03 chasing, −0.06 setting). Shubman Gill and Sai Sudharsan, second and third by runs with 732 and 722, are 17th and 22nd by WPA: a strike rate around 160 in a 189-run world is close to the going rate, and going-rate scoring adds roughly nothing to a win probability built on the league average.

At the other end, Nicholas Pooran (196 runs at 122.50) cost his side a full win; Tristan Stubbs, Ajinkya Rahane, Rishabh Pant and Dhruv Jurel follow. Jurel is the interesting one: 515 runs at 154.65, and still negative — runs at below the environment's rate, in the wrong moments.

Across the 60 batters with 100+ balls, WPA correlates more with strike rate (Spearman 0.71) than with runs (0.49). And the ranking barely depends on which WP model you use: era-only and pooled WP v1 give WPA totals with a rank correlation of 0.978. WPA is robust to the model's calibration problems in a way that win probabilities are not, because a model that is wrong by the same amount before and after a ball is right about the change.

=== IPL 2026 bowling WPA - top 12 ===
           bowler  matches  balls  runs  econ  wpa  wpa_per_match
0       SP Narine       13    306   339  6.65 1.17           0.09
1         B Kumar       15    354   467  7.92 1.16           0.08
2       E Malinga       15    326   507  9.33 0.91           0.06
3       J Overton       10    168   249  8.89 0.87           0.09
4       RA Jadeja       12    198   277  8.39 0.60           0.05
5         L Ngidi       11    248   340  8.23 0.58           0.05
6   Sakib Hussain       11    252   397  9.45 0.55           0.05
7     Rashid Khan       17    341   516  9.08 0.54           0.03
8       AJ Hosein        7    148   198  8.03 0.53           0.08
9       JJ Bumrah       13    294   410  8.37 0.49           0.04
...
bottom 6:
          bowler  matches  balls  runs  econ   wpa
119   R Shepherd       12    144   282 11.75 -0.67
120   MP Stoinis        4     47    98 12.51 -0.82
121     M Jansen       12    284   483 10.20 -0.94
122      RA Bawa        2     24    50 12.50 -0.97
123     VG Arora       10    228   390 10.26 -0.97
124  XC Bartlett        8    191   379 11.91 -1.05
bowlers with 120+ balls: 61; Spearman(economy, WPA) -0.73

Sunil Narine (+1.17, economy 6.65) and Bhuvneshwar Kumar (+1.16) lead the bowlers. Jasprit Bumrah's season — 4 wickets in 294 balls at 8.37, a season Chapter 14 found was among the least likely in its expected-wickets simulation — still adds +0.49 wins: in a 189-run world, conceding 8.37 an over is worth having even without wickets. E Malinga is third with an economy of 9.33, which looks ordinary until you remember the environment. At the bottom, Xavier Bartlett (−1.05) and Vaibhav Arora (−0.97).

IPL 2026 batters: runs against batting WPA, dot size proportional to balls faced

📊 Figure (described): Scatter of the 60 IPL 2026 batters with 100+ balls: runs on the horizontal axis, batting WPA on the vertical. Suryavanshi sits alone at top right (776 runs, +2.34). Gill and Sai Sudharsan sit far right but only about +0.4 to +0.5; Miller sits far left (211 runs) at almost +1.0. Pooran, Stubbs, Rahane and Pant are below zero. The takeaway: runs and wins added are related but far from the same thing.

The season's biggest single balls, unsurprisingly, were last-over sixes and one last-over run-out:

=== The season's biggest single-ball swings ===
  09 Apr Lucknow Super Giants   inns 2 over 20: MD Choudhary v VG Arora, 6 run(s): 0.147 -> 0.966
  08 Apr Delhi Capitals         inns 2 over 20: DA Miller v M Prasidh Krishna, WICKET Kuldeep Yadav: 0.772 -> 0.000
  10 May Royal Challengers Beng inns 2 over 20: B Kumar v RA Bawa, 6 run(s): 0.140 -> 0.792
  08 Apr Delhi Capitals         inns 2 over 20: DA Miller v M Prasidh Krishna, 6 run(s): 0.348 -> 0.984
  09 Apr Lucknow Super Giants   inns 2 over 20: MD Choudhary v VG Arora, 6 run(s): 0.246 -> 0.738
  26 Apr Lucknow Super Giants   inns 2 over 20: Mohammed Shami v Kartik Tyagi, 6 run(s): 0.011 -> 0.500
  18 Apr Delhi Capitals         inns 2 over 20: DA Miller v R Shepherd, 6 run(s): 0.258 -> 0.688
  14 May Mumbai Indians         inns 2 over 20: Tilak Varma v XC Bartlett, 6 run(s): 0.568 -> 0.992

Three of the eight involve Delhi's David Miller. On 8 April the same last over gave Delhi a 0.348 → 0.984 six and then a 0.772 → 0.000 run-out of the non-striker, Kuldeep Yadav, which ended the chase in defeat. Under the book's credit convention a non-striker dismissal is charged to the non-striker — so Kuldeep Yadav, with 9 runs from 21 balls all season, finishes with a batting WPA of −0.98, second-lowest in the league. Mohammed Shami's six on 26 April took Lucknow from 0.011 to a tie (0.500).

⚠️ Common pitfall: reading season WPA as skill. WPA is a record of what happened, valued by context. It is not a measure of ability and it does not repeat well: one last-ball run-out moves a batter's season by most of a win, and leverage — how often you happen to bat when the match is close — is mostly decided by your team-mates and the fixture list. Use WPA to tell the story of a season; use the rate-and-context metrics of Chapters 8, 13 and 19 (SR+, runs above replacement, Expected Runs Added) to judge players, and shrink everything (Chapter 6).

🔄 Check your understanding 1. Gill scored 732 runs and added +0.50 wins; Miller scored 211 and added +0.97. Give two reasons this can happen without anything being "wrong". 2. Why do the era-only and pooled models give almost the same WPA ranking (0.978) when they disagree about win probabilities by several points?

Answer

  1. (a) Gill's strike rate (163.0) was close to the 2026 environment's going rate, so many of his runs merely kept WP level; (b) Miller's runs came in the last overs of close chases, where a single ball can move WP by 30–60 points (leverage). 2. WPA sums changes in WP. A model that under-rates every chasing state by a similar amount still gets the change from one ball to the next nearly right.

20.11 Women's T20: can the men's model be trusted?

Every model so far has been fitted on men's cricket. Women's T20 has fewer matches — 2,594 decided, full-length chases across women's T20Is, the WPL and the WBBL — and a different scoring level. Chapter 9 found that the same state means very different things: needing 54 off 30 with 8 wickets in hand was 0.652 on its men's table and 0.256 on its women's. Can WP v1's context features — which taught it that a 190-run world differs from a 150-run world — also teach it that women's cricket differs from men's?

We fit on chases before 2023 and test on women's chases 2023–26 (1,535 of them):

women's chases: 2,594 (282,094 states); by competition:
competition
t20s_female    2035
wbb             471
wpl              88
train (before 2023): 1,059; test (2023-26): 1,535 chases
women's env_par by group, 2026 mean: {'t20s_female_assoc': 118.7, 't20s_female_fm': 151.0, 'wbb': 148.3, 'wpl': 154.7}

=== Women's T20 chases 2023-26, out of time ===
                                 brier  logloss  gap (obs - fcst)  intercept  slope
model                                                                              
men's model, state only         0.1589   0.4930           -0.1694    -1.4847 0.8762
men's WP v1 (women's env + Elo) 0.1111   0.3460           -0.0943    -0.9882 1.1305
women's WP v0 table             0.1173   0.3613           -0.0296    -0.2569 0.8932
women's own, state only         0.1158   0.3567           -0.0284    -0.2633 0.8630
women's own WP v1               0.0916   0.2895           -0.0300    -0.3416 0.9548
men + women together, WP v1     0.0934   0.2970           -0.0365    -0.3914 1.1673

=== Spot check: need 54 off 30 with 8 wickets in hand, target 130, Elo gap 0 ===
  env 120: men's v1 0.460   women's v1 0.081
  env 150: men's v1 0.437   women's v1 0.286
  men's state-only 0.579; women's v0 table 0.233

The answer is: partly, and not enough.

  • The men's state-only model is badly wrong for women: it over-rates the chasing side by 16.9 points on average (Brier 0.1589).
  • Giving the men's model the women's own scoring environment and Elo gaps helps a great deal (0.1111 — better even than a women's state-only table) — but it still over-rates women's chasers by 9.4 points, with a recalibration intercept of −0.99. Knowing the scoring level is not the same as knowing how women's chases unfold: the same "54 off 30, 8 down, target 130" is 0.437 on the men's WP v1 at a 150-run environment and 0.286 on the women's.
  • A women's own WP v1 is best by a distance (0.0916), with a recalibration slope of 0.95 — close to calibrated in spread, though women's chasers also did about 3 points worse than any women's model fitted before 2023 expected.
  • One model fitted on men and women together, with the environment features, is nearly as good (0.0934) — the large men's sample helps the shape, and the environment does part of the translation — but its slope of 1.17 says its forecasts are too timid for women's matches.

Reliability diagram for women's T20 chases 2023–26: men's state-only model, men's WP v1 with women's context, women's own WP v1

📊 Figure (described): Reliability curves for three models on women's chases 2023–26. The men's state-only curve sits far below the diagonal (its 50% forecasts won about a quarter of the time); the men's WP v1 with women's context is closer but still below; the women's own WP v1 is closest to the diagonal, though still slightly below it. The takeaway: context features shrink the gap between men's and women's cricket but do not close it — fit women's models on women's data.

The by-competition breakdown (in code/08_womens_check.py) adds one twist: in full-member women's T20Is, the WPL and the WBBL the men's WP v1 with women's context is about as good as the women's own model (better in the WBBL, 0.1126 v 0.1257); the big failure is in associate women's T20Is (0.1151 v 0.0845), where the gap between teams is large and the women's model has learned to use it. The practical rule for Crease: use a women's WP v1 for women's cricket — fit_wp on build_states(wp.WOMEN_T20).s2 — and treat any men's-fitted number for a women's match as a rough guide at best.

🔄 Check your understanding Why does the men's WP v1 still over-rate women's chasers even when it is told the women's scoring environment?

Answer

The environment feature shifts how big a target is relative to the league, but the rest of the model — how fast a required rate becomes impossible, what a wicket costs at the death — is learned from men's chases, where hitting power at the death is greater relative to the average total. The same state therefore looks more recoverable to the men's model than it is.


20.12 Beyond T20: what changes in ODIs and Tests

This chapter's models are T20 models, and they should not be stretched. The same machinery transfers to ODIs with care, and to Tests hardly at all.

  • ODIs. The state is the same three numbers with 300 balls instead of 120; the logic of splitting by match, scoring out of time and checking calibration by competition is identical. What changes is the balance of the features: over 50 overs wickets in hand matter far more (Chapter 19 priced an ODI wicket at 25 overs at about 19.5 runs, against single figures in T20), rain revisions are common (Chapter 23's DLS problem — a revised target is a new state space), and there are far fewer matches per year, so environment features have less to learn from.
  • Tests. A Test has three outcomes, not two — the draw — and the "state" includes the innings, the lead, the overs left in the match and the pitch, as Chapter 33 shows for declarations. A Test WP model is a three-way (multinomial) model of win/draw/loss, and its calibration has to be checked for each outcome separately. Chapter 29's fourth-innings backtest is a start.

The idea that survives every format is the threshold concept: a forecast is a promise about frequencies, and you check it by counting.


Spaced Review

Before reading each answer, try to answer from memory.

  1. From Chapter 6: a batter averages 66.83 after a hot start; the book found such a group averaged 37.21 afterwards. What does that have to do with section 20.3's flexible model scoring 0.0117 in training and 0.1933 on new matches? Both are regression to the mean in different clothes. A small sample (a hot start; a single match's balls) contains real signal plus noise; anything that fits the noise — a selector, or a deep tree that memorises a match — looks brilliant on the data it was chosen from and disappoints on fresh data. The fixes are the same family too: shrink (min_child_weight = 500) and judge on data the choice never saw.

  2. From Chapter 9: what was WP v0, and which three rules did its "shaping" step enforce? An empirical, smoothed table of chase win rates on (runs needed, balls left, wickets in hand), shrunk toward a small logistic backstop. Shaping enforced: more runs needed never helps, more balls left never hurts, more wickets in hand never hurts — the same three rules this chapter wrote into the boosted model as monotone constraints.

  3. From Chapter 19: what is the "price of a wicket", and why did the Markov chain's simulated totals come out too narrow? The drop in Expected Runs when a wicket falls in a given state. The chain's spread was too narrow because every innings drew from one league-average set of ball probabilities; real innings each have their own conditions. Section 20.6's EndGame experiment failed the same way — a reminder that a model of individual balls must allow the whole innings to vary.


Project Checkpoint: winprob.py

Nusrat's Crease now has its main engine. The new module, project/crease/winprob.py, gives every later chapter a calibrated, context-aware win probability and plugs straight into Chapter 9's WPA machinery.

What she added:

  • build_states(codes) — both innings' pre-ball states for any set of competitions, with the three context columns (env_par, elo_diff, era) computed past-only.
  • fit_wp(states, kind="logit", extras=("target", "env", "elo")) — WP v1 by default; kind="gbm" for the monotone boosted model; extras=() for a state-only model. Returns a WPModel.
  • predict_wp(model, states) and WPModel.predict(R, B, W, target=, env_par=, elo_diff=).
  • ParWP().fit(first_innings_states) and first_innings_wp(...) — first-innings WP via Chapter 19's Expected Runs table.
  • wp_curve(match_id, model, par, data=), match_curves(...), turning_points(curve, n), wpa(curves, by=).
  • Diagnostics: calibration_table, brier, log_loss, brier_decomposition, calibration_fit; and the experimental EndGame.

The demo (code/project_checkpoint.py) values Chapter 9's second example match — Mumbai Indians v Delhi Capitals, IPL 2023, chasing 173 — with models fitted only on matches before 2023:

model = wp.fit_wp(train2)                                # WP v1
par = wp.ParWP().fit(train1)
cur = wp.wp_curve(MID, model, par, data=data)
print(wp.turning_points(cur, n=4))
bound = model.bind(env_par=..., elo_diff=..., target=...)
via_impact = impact.chase_wp(chase, bound)               # Chapter 9's function, WP v1 inside
WP v1 fitted on 5,209 chases (590,291 states); 25 features; ER par 158.6

predict_wp() on the real chase: start 0.477 (target 173, env_par 170.0, Elo gap +0)
  inns 1 after 0 ov    0/0  P(MI chasing wins) 0.490
  start of chase       0/0  P(MI chasing wins) 0.477
  inns 2 after 15 ov 123/1  P(MI chasing wins) 0.724
  inns 2 after 16 ov 139/3  P(MI chasing wins) 0.850

turning_points(curve, n=4):
 innings   batting_team over_ball   batter            bowler     what  wp_before  wp_after    dwp
       2 Mumbai Indians      19.6 TH David          A Nortje 2 run(s)      0.671     1.000  0.329
       2 Mumbai Indians      18.4  C Green Mustafizur Rahman 6 run(s)      0.575     0.860  0.284
       2 Mumbai Indians      19.5  C Green          A Nortje 1 run(s)      0.869     0.671 -0.198
       2 Mumbai Indians      18.6 TH David Mustafizur Rahman 6 run(s)      0.838     0.987  0.149

impact.chase_wp with model.bind(...): start 0.477, max |difference| from wp_curve 0.00e+00

(5,209 rather than 5,272 chases: the 63 tied chases before 2023 are left out of fitting, since a tie is half a win for each side; they are kept for scoring.) Chapter 9's era-matched tables had this chase at 0.392 (pre-2023 pool) and 0.720 (IPL 2023–26) at the start. WP v1, with no 2023 data at all, says 0.477 — it has moved about a quarter of the way toward the new era just by reading the environment. And impact.chase_wp with a bound WP v1 reproduces the module's own curve exactly, so every Chapter 9 function — chase_wp, match_wp, wpa_table, innings_impact — now runs on WP v1 by passing a different model.

Where it goes next: Chapter 24 builds the pre-match model whose output is WP at ball zero; Chapter 27 puts wp_curve live, ball by ball, with Chapter 19's simulator alongside; Chapter 31 uses WP to price bowling decisions; Chapter 35 turns WP v1 into prices and asks whether calibration is enough to beat a market; and Chapter 37 draws the curve for broadcast.

🔷 R corner (not run in this book's build): the logistic core of WP v1 in base R, given a data frame s of chase states with runs_needed, balls_left, wkts_in_hand, target, env_par, elo_diff and bat_won (ties removed).

r s$lq <- log(s$runs_needed) - log(s$balls_left) s$frac <- s$balls_left / 120 fit <- glm(bat_won ~ lq * wkts_in_hand + lq * frac + I(wkts_in_hand^2) + scale(target) * lq + scale(env_par) * frac + I(elo_diff / 100), family = binomial, data = s) p <- predict(fit, newdata = test, type = "response") mean((p - test$bat_won)^2) # Brier score


Chapter Summary

The models.

Model Features Brier, men's T20 chases 2023–26 (fit < 2023) IPL gap (obs − fcst)
Base rate none 0.2475 —
Required rate only runs needed ÷ balls left 0.1385 +0.144
WP v0 (Ch 9 table) state 0.1252 +0.134
Logistic, state only state 0.1249 +0.133
Boosting (tuned, monotone) state + target + env + Elo 0.1191 +0.130
WP v1 (logistic) state + target + env + Elo 0.1143 +0.077

Metrics.

Metric Definition Good is
Brier score mean (p − y)² low; 0.25 = coin flip
Log loss −mean(y log p + (1−y) log(1−p)) low; 0.693 = coin flip
Reliability calibration error in the Brier decomposition near 0
Resolution how far forecasts move with the outcomes high
Recalibration slope / intercept logit P(win) = a + b·logit(p) b ≈ 1, a ≈ 0
Calibration-in-the-large observed − forecast, by league near 0 in every league you use
WPA Σ ΔWP credited per Chapter 9's convention descriptive, not predictive

Headline findings. Trained on 8,939 men's T20 chases from 9,117 matches. Random-ball splits leak (0.0185 v 0.1933 for the same model). The context features — target, scoring environment, Elo — not the model family, are what beat WP v0; logistic regression beats boosting out of time because trees cannot extrapolate into new scoring environments. In 2023–26 chasers beat every pre-2023 model, most of all in the IPL and PSL; WP v1 roughly halves the IPL miss (13.4 → 7.7 points); for the current season, an era-only WP v1 nearly removes it (1.3 points in 2025–26). The last ball is every smooth model's weak spot. Men's models over-rate women's chasers even with women's context; fit women's models on women's data.

Decision framework — building or judging any win-probability model:

  1. Split by match; score out of time. Distrust any number from a random-ball split.
  2. Report Brier and log loss against a baseline on the same test set.
  3. Draw the reliability diagram — overall, by league, by stage of the innings, and for the last over.
  4. Put intervals on calibration gaps by resampling matches, not balls.
  5. Ask what the model cannot know (environment, team strength, era) and whether a feature can tell it.
  6. Prefer the simplest model that extrapolates sensibly; refit on recent seasons for live use.
  7. Use WPA to describe; use rate metrics with shrinkage to judge players.

What's Next

A win-probability model tells you who is winning; it does not tell you what to do. Chapter 21 turns to the decision that comes before the first ball — who to pick — and asks how much an all-rounder is really worth, now that the Impact Player rule has changed what a balanced XI looks like.