Function: cricket_win_probability()
cricket_win_probability(
state):CricketWinProb[]
Defined in: src/models/cricket_wp.ts:328
In-play win probability for the batting / chasing team from match-state rows
(py cricket_win_probability).
Per row: resource surface -> proj_final = runs + resources_left * par_score ->
win_prob_raw = Phi((proj_final - benchmark) / sigma) -> per-(fmt, phase) isotonic
calibration (linear interpolation) -> 1e-6 * (raw - 0.5) tie-breaker, clamped to [0, 1]
-> terminal overrides.
Parameters
state
CricketState rows, the output of cricket_match_state or any rows with the same schema. An empty array returns an empty array.
Returns
A new array of CricketWinProb rows (each a shallow copy of the input plus
overs_left, wickets_left, resources_left, proj_final, win_prob_raw, win_prob),
in input order.
Throws
Error From get_format, for a row whose fmt is 'test' or unknown.
Remarks
A row is a chase iff innings_number === 2 and target is non-null; the benchmark
is then target with sigma_chase, else par_score with sigma_set. Chase overrides:
runs >= target -> win_prob = win_prob_raw = 1; else all out (wickets >= 10) or out of
balls -> 0. An (overs_left, wickets_left) cell missing from the surface reads as 0
resources. Pure: tables are bundled JSON, no network.
Example
import sdv from 'sportsdataverse';
const wp = sdv.cricket.cricket_win_probability([{
event_id: '8048', innings_number: 2, batting_team_id: '1', runs: 88, wickets: 3,
balls_bowled: 76, balls_total: 120, target: 156, fmt: 't20',
}]);
wp[0].win_prob; // chasing side's probability in [0, 1]