Chapter 30 Notes — Optimal Batting Order

Chapter link: Chapter 30

Overview and learning objectives

Chapter 30 tests the claim every T20 fan has shouted at a television: bat your power hitter higher. It opens with Tim David's IPL 2026 season (305 off 162, SR 188.3, yet fewer than ten balls in eight of fifteen innings). Positions are inferred from order of arrival, each slot gets a measured budget of balls, every batter gets a shrunk per-ball profile judged against the same situations, and innings are simulated with named batters at the crease. The chapter then searches all 5,040 orders of RCB's top seven, tests "promote the power hitter" on all ten IPL 2026 sides, compares floating roles with fixed slots, checks left-right pairing, and ends with the Test nightwatchman. Crease gains batting_order.py.

By the end of the chapter students should be able to:

  1. Infer batting positions from ball-by-ball data and compute a slot budget (balls per team innings), explaining why it differs from "balls when he batted".
  2. Explain why a batter must be compared with an average batter in the same situations, and describe the run tilt and dismissal multiplier.
  3. Justify a shrinkage choice with an out-of-time test (k = 100 balls for run tilts; no batter-specific phase deviations).
  4. Run an exhaustive order search with common random numbers, re-check the leaders on fresh simulations, and quantify the optimiser's curse.
  5. Explain why promotion is a transfer of balls, using David's No. 6 → No. 3 numbers (+10.8 balls, +18.5 of his own runs, +1.6 team runs).
  6. Convert a run gain into win probability with the defend curve, and report a plateau of good orders rather than a single best one.
  7. State what the inferred-nightwatchman analysis can and cannot show, and why the label's rule must be stress-tested.

Where students struggle

  • Individual runs versus team runs. Students see David make 18.5 more runs at No. 3 and stop there. Make them find where the other 16.9 went (Exercise B3). This is the chapter's central idea and its most common error.
  • "Who" versus "how". Raw strike rates by position mix the batter with the situation. The §30.2 example helps: in overs 12–15 with 6–7 down, the real rate was 0.951 runs per delivery against 1.001 for an average batter in that situation, because 34.2% of those deliveries were faced by usual Nos. 8–11.
  • Kohli's "below-average" run index. Kohli's middle-overs run index is 98.0, yet the search puts him in the top three. Students read this as a contradiction. The answer is his dismissal index (76.6): balls given to him are rarely wasted. Use Exercise D6.
  • Common random numbers. Students think CRN makes each estimate more accurate. It doesn't; it makes the difference more precise (±0.43 v ±0.73 runs). Exercise B5 gives the factor of about 2.9.
  • The optimiser's curse. The screen's best (206.16) re-checks at 203.80; the top 25 drop from 205.17 to 203.20. Students who skip the re-check overstate every gain.
  • Untestable is not wrong. The out-of-time lineup slope is 0.44 with a 90% interval of −0.94 to 1.82. Some students read "not confirmed" as "refuted". The interval includes both 0 and 1.
  • Inferred labels. Nightwatchmen are a rule applied to data. The 52.1% day-1 check shows the rule works, not that every flag is right.

Pacing

50-minute session. - 0–7: Tim David's 2026 season table; students guess the No. 3 − No. 6 gap in balls. - 7–15: §30.1 slot budgets (No. 3 18.15, No. 6 9.93, gap 8.22) and §30.2's who-versus-how idea. - 15–27: §30.4 productive struggle: students write RCB's best order, then reveal +4.95 runs, rank 1,994 of 5,040, the plateau. - 27–40: §30.5 promotion table and the ten-team median (0.38 runs); the transfer argument. - 40–50: §30.8 nightwatchman headline numbers; assign the checkpoint.

75-minute session. As above, plus a 15-minute live demo of 04_order_search.py and 05_power_hitter.py, and 10 minutes on the out-of-time lineup test (§30.3) and floating roles (§30.6). Lab time: about 60 minutes. Run scripts from the chapter directory with PYTHONIOENCODING=utf-8 on Windows. 04_order_search.py takes about 45 seconds, 05_power_hitter.py about 40, 06_floating_left_right.py and case_study_01.py about 35–40, and most others under 20.

Lecture outline

  1. Ten balls a night: David's 15 innings, positions {4: 1, 5: 4, 6: 8, 7: 2}, median entry in over 15.
  2. Positions from order of arrival; slot budgets (top three take 51.8% of balls in the IPL, 55.5% in women's T20Is, 38.8% in men's Tests).
  3. Per-ball profiles: situation cells, run tilt, dismissal multiplier; shrinkage chosen out of time (k_run 100, k_out 554).
  4. The simulator: strike rotation, new batter on strike, IPL spread 0.04 (Chapter 27's 0.07 is too wide: sd 41 v real 36.7).
  5. Validation: average lineup sd 37.3 v real 36.7; out-of-time lineup slope 0.44 (90% CI −0.94 to 1.82); 80% ranges cover 84.5%.
  6. The search: 5,040 orders, CRN, re-check (203.80 v usual 198.85); simple rules; local search reaches 204.07 in 85 evaluations.
  7. "Promote the power hitter": slot table; ten sides, median 0.38 runs, 0.0023 WP; powerplay transfer check (−8.0 runs per 100 deliveries for usual Nos. 4–5).
  8. Floating roles (fully floating +3.48 v best fixed +4.95) and left-right (no reliable effect in any format per Chapter 12; 0.2–0.5 runs at its +0.42 estimate, at most 1.3 at the top of the interval).
  9. The nightwatchman: 425 innings, median 27 balls, protected batter −4.00 runs, next-morning wickets 1.17 v 1.14.
  10. What the order can't see (§30.9).

Live coding demo

Scripts: code/04_order_search.py, then code/05_power_hitter.py.

  1. Run 04_order_search.py. Expected output: 5,040 orders screened × 400 simulations; screen mean 198.86, best 206.16, worst 191.59, sd 2.63; usual order rank 1,994. Re-check with 20,000 fresh simulations: usual 198.847, best 203.80 (+4.95 runs, WP +0.0320); top 25 screened at 205.17, re-checked at 203.20. Paired margin best − usual ±0.43 against ±0.73 unpaired.
  2. Before the re-check prints, ask the room to predict whether the screen's best will hold up. Then show the optimiser's curse line.
  3. Show the slot heat map counts: Kohli in slot 1 in 43 of the top 100 orders, David 35, Patidar 17; Krunal Pandya in slot 7 in 52, Padikkal in slots 6–7 in 75.
  4. Run 05_power_hitter.py. Expected: David at slots 1–7 gives +2.35 / +2.17 / +1.61 / +0.20 / +0.40 / 0 / −1.13 runs; at No. 3 he faces 22.2 balls and makes 38.1 against 11.4 and 19.6 at No. 6. The ten-team table gives a median of 0.38 runs, with RCB's David the largest gain (1.89) and Punjab's Stoinis the smallest (0.07).
  5. Live change: change who= to a different RCB batter (for example Padikkal, index 2) and ask students to predict the curve before running. With a dismissal index of 121.7, moving Padikkal up should cost runs and moving him down should gain, which is what the best re-checked order already does (Padikkal at No. 6). The chapter doesn't print this table, so let the output confirm or surprise them.
  6. Close with project_checkpoint.py (about 8 seconds): Rajshahi Warriors' BPL 2025/26 final XI; usual order 156.0, local search 160.34 (+4.36), Neesham opening. Point at Williamson's 54 BPL balls: the profile is mostly prior.

In-class activity — "Set RCB's order"

Groups of three get the §30.2 profile table for RCB's top seven (middle-overs run index / dismissal index): Iyer 105.0/108.9, Kohli 98.0/76.6, Padikkal 96.7/121.7, Patidar 112.6/101.0, Jitesh Sharma 103.9/108.5, David 104.9/82.5, Krunal Pandya 89.4/100.6. Task: (a) write a top-seven order and a one-line rule for it; (b) guess the runs between best and usual, and between best and worst; (c) name one batter whose position you'd refuse to change without more data, and why. Collect the guesses on the board, then reveal: best v usual +4.95, best v worst about 12 runs, the usual order mid-table at rank 1,994. Groups whose rule used only run index get about three-quarters of the gain (202.5); those who used both numbers should land on the plateau. Finish with Wendell's §30.5 Eye test: David has faced no IPL powerplay balls since 2022.

Answers and teaching notes for key exercises

  • B1. No. 8 bats in 56.19% of team innings and faces 7.22 balls when he does, a budget of 4.06. A 0.3-runs-per-ball improvement is worth about 1.2 runs per team innings. Use it to show how little the lower order bats.
  • B2. At env 190.1: 195 → about 0.458, 205 → about 0.545. Ten runs near par are worth about 8.7 points, consistent with the printed 0.415 at 190 and 0.501 at 200.
  • B3. David gains 18.51 runs; the team gains 1.61; the others lose about 16.9. They lose roughly the balls he gains, at about 1.5–1.6 runs a ball, so they weren't much worse per ball than him. This is the transfer argument in numbers.
  • B4. (203.80 − 198.86)/2.63 ≈ 1.9 standard deviations. The screen's best is higher because it is the maximum of 5,040 noisy estimates.
  • B8. 7 × 0.0023 ≈ 0.016 wins a season. Even RCB's best case is about 0.09 wins over seven first innings. Is a "correct" change worth a dressing-room argument?
  • D6. Strong replies avoid formulas: Kohli scores slightly below an average batter in the same situations but gets out far less often (dismissal index 76.6), so the balls he receives keep the innings alive for the hitters behind him. Point the journalist to the slot heat map, where Kohli sits in the top three in 92 of the 100 best orders.
  • Quiz 20. Recommend demoting the weak top-four batter (3.0 runs, built on well-measured profiles) over promoting the hitter to No. 2 (2.5 runs, an extrapolation into the powerplay, where usual Nos. 4–5 lose about 8 runs per 100 deliveries). If the coach wants the hitter higher, suggest No. 4. Three runs is about 2.5 points of win probability per first innings: worth doing because it is free, invisible in one season's results. Full credit needs both the recommendation and the size.

Assessment ideas

  • Short answer: "Promoting the power hitter gains 10–15 balls, so it gains 10–15 balls' worth of runs." Mark for the transfer argument with the chapter's numbers.
  • Code task: Exercise C3 (Sunrisers Hyderabad's order search and three local-search restarts), graded on the re-check and on whether students report a plateau.
  • Applied write: Exercise D4, the 100-word note to a coach, graded on the plateau, the extrapolation warning and the win-probability conversion.
  • Robustness task: Exercise C6 (four nightwatchman rule variants; which conclusions move?).

Format, gender and region diversity notes

  • Case Study 1 runs the full pipeline on the WPL 2026 champions (RCB women). Richa Ghosh's slot table (+0.90 at No. 1 to −4.18 at No. 7) and her 34 powerplay balls against 642 at the death mirror the David extrapolation problem. The usual order ranks 165 of 5,040, with a best gain of only +1.42 runs.
  • The Project Checkpoint uses the BPL 2025/26 final (Rajshahi Warriors), with Tanzid Hasan, Shanto and Mushfiqur Rahim, whose dismissal index of 77.2 is the profile to trust most.
  • The nightwatchman section covers every Test nation in the data: New Zealand use them most (18.89 per 100 team innings) and Ireland least (4.55). Case Study 2 examines England's fall (14.89 per 100 in 2001–15 to 8.44 in 2016 to May 2022).
  • Format transfer: Exercises D1 (ODIs) and D2 (Tests) ask why the order matters less in Tests while one slot decision matters more.

Connections