Skip to contents

A thin wrapper around the pbpstats API’s “get-win-probability” endpoint.

Usage

get_win_probability(
  league = "nba",
  margin,
  pre_game_win_prob,
  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.

Value

A tibble of win probability data as returned by the API.

References

Darryl Blackport (2020). PBPStats API, MIT License. https://api.pbpstats.com/docs