View source: R/foot_round_robin.R
foot_round_robin | R Documentation |
Posterior predictive probabilities for a football season in a round-robin format
foot_round_robin(object, data, teams = NULL, output = "both")
object |
An object either of class |
data |
A data frame containing match data with columns:
|
teams |
An optional character vector specifying team names to include. If |
output |
An optional character string specifying the type of output to return. One of |
For Bayesian models fitted via stan_foot
the round-robin table is computed according to the
simulation from the posterior predictive distribution of future (out-of-sample) matches.
The dataset should refer to one or more seasons from a given national football league (Premier League, Serie A, La Liga, etc.).
If output = "both"
a list with:
round_table
: A data frame of matchups (Home
, Away
), observed scores, and Home_prob
(median posterior probability of a home win).
round_plot
: A ggplot
heatmap of home‑win probabilities with observed scores overlaid.
If output = "table"
or "plot"
, returns only that component.
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_1999_2000 <- italy %>%
dplyr::select(Season, home, visitor, hgoal, vgoal) %>%
dplyr::filter(Season == "1999" | Season == "2000")
colnames(italy_1999_2000) <- c("periods", "home_team", "away_team", "home_goals", "away_goals")
fit <- stan_foot(italy_1999_2000, "double_pois", predict = 45, iter_sampling = 200)
foot_round_robin(fit, italy_1999_2000)
foot_round_robin(fit, italy_1999_2000, c("Parma AC", "AS Roma"))
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.