Skip to main content

Variable: cricketWpa

const cricketWpa: (stateWp) => Pick<CricketWinProb, "event_id" | "innings_number" | "balls_bowled" | "win_prob"> & object[] = cricket_wpa

Defined in: src/models/cricket_wp.ts:461

camelCase alias of cricket_wpa.

Batting / bowling win-probability added per state (py cricket_wpa).

Parameters​

stateWp​

Pick<CricketWinProb, "event_id" | "innings_number" | "balls_bowled" | "win_prob">[]

Rows carrying at least event_id, innings_number, balls_bowled and win_prob, typically the output of cricket_win_probability; any order.

Returns​

Pick<CricketWinProb, "event_id" | "innings_number" | "balls_bowled" | "win_prob"> & object[]

A new array sorted by event_id, innings_number, balls_bowled (nulls first, stable), each row a shallow copy of the input plus win_prob_before (the previous row's win_prob within the same (event_id, innings_number), else null), wpa_batting (win_prob - win_prob_before, 0 for the first state) and wpa_bowling (-wpa_batting).

Remarks​

Output order differs from input order. Tie order is stable here while polars' sort in sdv-py is unspecified on ties.

Example​

import sdv from 'sportsdataverse';
const wpa = sdv.cricket.cricket_wpa(sdv.cricket.cricket_win_probability(state));
wpa[0].wpa_batting; // 0 for the first state of an innings