foot_prob | R Documentation |
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
.
foot_prob(object, data, home_team, away_team)
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. |
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.
A list with components:
prob_table
: A data frame containing the results probabilities of the out-of-sample matches.
prob_plot
: A ggplot
object for Bayesian models only showing the posterior predictive heatmap
of exact score probabilities, with the true result highlighted.
Leonardo Egidi legidi@units.it and Roberto Macrì Demartino roberto.macridemartino@deams.units.it.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.