vs_match_win_probability | R Documentation |
Create a win probability graph for a match
vs_match_win_probability(
pbp,
so,
go_to = 25,
go_to_tiebreak = 15,
max_sets = 5,
show_plot = TRUE,
home_color = "blue",
visiting_color = "darkred"
)
pbp |
data frame: a data frame containing the set number, home team, visiting team, serving team, point-winning team, home team score, and visiting team score at the end of each point,
easiest to obtain by subsetting the plays component of a datavolley object as returned by |
so |
integer: a two-element vector of sideout rates for the home team and visiting team, easiest to obtain using |
go_to |
integer: the minimum score that must be reached to end a non-tiebreaker set (typically 25 for indoor volleyball in sets 1 to 4, or 21 in beach volleyball) |
go_to_tiebreak |
integer: the minimum score that must be reached to end a tiebreaker set (typically 15) |
max_sets |
integer: the maximum number of sets that can be played, either 3 or 5 |
show_plot |
logical: if |
home_color |
string: the color used to indicate points in the match where the home team is favored to win |
visiting_color |
string: the same as |
A data frame containing the home team's probability of winning the set (set_probs
) and match (match_probs
) at each point in the set.
The first row of the data frame refers to the start of the match (0-0, Set 1).
## Not run:
library(datavolley)
x <- dv_read(vs_example_file())
sideout_rates <- vs_estimate_rates(x, target_team = "each")$sideout
play_by_play <- subset(plays(x), point)
vs_match_win_probability(play_by_play, sideout_rates) ## data frame is not printed to console
## but can be stored in a variable
match_win_probs <- vs_match_win_probability(play_by_play, sideout_rates)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.