A thin wrapper around the pbpstats API’s “get-leverage” endpoint.
Usage
get_leverage(
league = "nba",
margin,
pre_game_win_prob,
seconds_remaining,
end_of_possession_seconds_remaining
)
Arguments
- league
Character. Which league to query; e.g.,
"nba"
or"wnba"
; defaults to"nba"
.- margin
Numeric. Point margin (difference in score).
- pre_game_win_prob
Numeric. Pre-game win probability as a decimal (e.g.,
0.65
for 65%).- seconds_remaining
Integer. Seconds remaining in the game.
- end_of_possession_seconds_remaining
Integer. Seconds remaining at the end of the possession.
References
Darryl Blackport (2020). PBPStats API, MIT License. https://api.pbpstats.com/docs