Plot football matches probabilities for out-of-sample football matches.
Description
The function provides a table containing the home win, draw and away win probabilities for a bunch of
out-of-sample matches as specified by stan_foot or mle_foot.
Usage
foot_prob(object, data, home_team, away_team)Arguments
object |
An object either of class |
data |
A data frame containing match data with columns:
|
home_team |
The home team(s) for the predicted matches. |
away_team |
The away team(s) for the predicted matches. |
Details
For Bayesian models the results probabilities are computed according to the
simulation from the posterior predictive distribution of future (out-of-sample) matches.
Specifically, matches are ordered from those in which the favorite team has the highest posterior probability
of winning to those where the underdog is more likely to win. For MLE models
fitted via the mle_foot the probabilities are computed by simulating from the MLE estimates.
Supported MLE models include: "double_pois", "biv_pois", "dixon_coles",
"neg_bin", "skellam", and "student_t".
For the Dixon-Coles model, predictions incorporate the low-score dependence adjustment via weighted resampling from independent Poisson simulations. For the negative binomial model, predictions use the NB2 parameterization with separate overdispersion parameters for home and away goals.
Value
A list with components:
-
prob_table: A data frame containing the results probabilities of the out-of-sample matches. -
prob_plot: Aggplotobject for Bayesian models only showing the posterior predictive heatmap of exact score probabilities, with the true result highlighted.
Examples
## Not run:
if (instantiate::stan_cmdstan_exists()) {
library(dplyr)
data("italy")
italy_2000 <- italy %>%
dplyr::select(Season, home, visitor, hgoal, vgoal) %>%
dplyr::filter(Season == "2000")
colnames(italy_2000) <- c("periods", "home_team", "away_team", "home_goals", "away_goals")
fit <- stan_foot(
data = italy_2000,
model = "double_pois",
predict = 18
) # double pois
foot_prob(
fit, italy_2000, "Inter",
"Bologna FC"
)
foot_prob(fit, italy_2000) # all the out-of-sample matches
}
## End(Not run)