Simulate a volleyball match using either best-of-5 or best-of-3 scoring
Usage
vs_simulate_match(
rates,
process_model = "phase",
serving = NA,
serving5 = NA,
max_sets = 5,
go_to = 25,
go_to5 = 15,
point_margin = 2L,
point_margin5 = 2L,
n = 2000,
simple = TRUE,
method = "theoretical"
)
vs_simulate_match_mc(...)
vs_simulate_match_theor(...)
vs_simulate_match_beach(...)Arguments
- rates
list: A two-element list, each element of which is a set of rates as returned by
vs_estimate_rates- process_model
string: either "sideout" or "phase". See
vs_estimate_rates()- serving
logical: if
TRUE, team 1 will serve first in the match. IfNA, the team serving first will be chosen at random- serving5
logical: if
TRUE, team 1 will serve first in the tiebreaking set (if the match gets that far). IfNA, the team serving first in that set will be chosen at random- max_sets
integer: the maximum number of sets to be played (either 3 or 5)
- go_to
integer: the minimum score that must be reached to end the set (typically 25 for indoor volleyball in sets 1 to 4, 15 in set 5, or 21 in beach volleyball)
- go_to5
integer: the minimum score that must be reached to end the tiebreaker set (typically 15 for indoor volleyball)
- point_margin
integer: the minimum score difference in order to win the set. Only applicable to
method"monte carlo". Formethod"theoretical" a two-point margin is always used- point_margin5
integer: the minimum score difference in order to win the tiebreaker set. Only applicable to
method"monte carlo". Formethod"theoretical" a two-point margin is always used- n
integer: the number of simulations to run. Only applicable to
method"monte carlo"- simple
logical: if
TRUE, just return the probability of team winning and the probabilities of each possible set score. IfFALSE, return extra details in a named list. The details will differ betweenmethod = "monte carlo"andmethod = "theoretical"- method
string: the simulation method to use. Either "monte carlo" or "theoretical". Details TBD
- ...
parameters as for
vs_simulate_match.vs_simulate_match_theorandvs_simulate_match_mcare convenience functions forvs_simulate_match(..., method = "theoretical")andvs_simulate_match(..., method = "monte carlo")respectively.vs_simulate_match_beachis a convenience function forvs_simulate_match(..., max_sets = 3, go_to = 21, go_to5 = 21)(typical beach volleyball settings).
Examples
if (FALSE) {
library(datavolley)
x <- dv_read(dv_example_file())
rates <- vs_estimate_rates(x, target_team = "each")
vs_simulate_set(rates) ## simulate a single set
vs_simulate_match(rates) ## simulate a match
## so given the performances of the two teams during that match, we expect
## that the home team should have won, with 3-0 being the most likely scoreline
## compare to the actual match result
summary(x)
}
