Fitting Bayesian and MLE Football Models
Overview
This is the first package allowing for the estimation, visualization and prediction of the most well-known football models: double Poisson, bivariate Poisson, Dixon-Coles, negative binomial, Skellam, student_t, diagonal-inflated bivariate Poisson, and zero-inflated Skellam. It supports both maximum likelihood estimation (MLE, for 'static' models only) and Bayesian inference. Team abilities can be static or dynamic over weeks or seasons, with alternative specifications of the evolution variance: a common variance (Owen, 2011), variance inflation after the summer break (Koopman and Lit, 2015) doi:10.1111/rssa.12042, and weighted dynamic models with commensurate priors (Macrì-Demartino, Egidi and Torelli, 2026) doi:10.1093/jrsssc/qlag032. Historical team strengths can be estimated through a Bayesian Bradley-Terry-Davidson model and used as a covariate. For Bayesian methods, it incorporates several techniques: MCMC sampling with Hamiltonian Monte Carlo, variational inference using either the Pathfinder algorithm or Automatic Differentiation Variational Inference (ADVI), and the Laplace approximation. The package compiles all the 'CmdStan' models once during installation using the 'instantiate' package. The model construction relies on the most well-known football references, such as Dixon and Coles (1997) doi:10.1111/1467-9876.00065, Karlis and Ntzoufras (2003) doi:10.1111/1467-9884.00366 and Egidi, Pauli and Torelli (2018) doi:10.1177/1471082X18798414.
New models
- Add the Dixon-Coles model (
"dixon_coles") tostan_foot(), static and dynamic, and tomle_foot(). - Add the negative binomial model (
"neg_bin") tomle_foot().
Dynamic models in stan_foot()
- Add
dynamic_parto choose the evolution variance: a common variance (common_sd, Owen, 2011) or a variance inflation after the summer break (kl_varianceandperiods_per_season, Koopman and Lit, 2015). - Add
dynamic_weightfor the weighted dynamic models with commensurate priors (Macrì Demartino, Egidi and Torelli, 2026), with spike and slab hyperpriors set throughdynamic_par$spikeanddynamic_par$slab.
Other changes
print.stanFoot()withteamskeeps all the global parameters and shows the team names in the team-indexed parameters.foot_prob()supports the"dixon_coles"and"neg_bin"MLE models.- Add an identifiability constraint to the Bradley-Terry-Davidson Stan models.
- Extend the confidence intervals of
mle_foot()to the model-specific parameters and move the MLE simulations to the internalsimulate_goals_mle(). - Rewrite the vignette.
Show all changes in 2.1.0Hide the rest of the changes in 2.1.0
Bug fixes
- Fix the likelihood of the static bivariate Poisson model.
- Draw
y_repandy_prevof the bivariate Poisson models from the bivariate Poisson distribution. - Rewrite the diagonal-inflated bivariate Poisson model as in Karlis and Ntzoufras (2003), with the new parameter
draw_distfor the draws. - Return
diff_y_previn the bivariate Poisson and diagonal-inflated bivariate Poisson models. - Fix the AIC and BIC of
mle_foot()to count only the free parameters of each model. - Fix
foot_prob()for MLE models, which usedobject$homeinstead ofobject$home_effect. - Fix
compare_foot()withNArows in a probability matrix, which misaligned the outcomes of the following elements ofsource. - Match
rankinginstan_foot()to the teams by name instead of by position, with informative errors for missing or duplicated teams. - Fix the observed frequencies in
pp_foot(type = "aggregated")for models fitted withpredict > 0.
Documentation
- Update
foot_abilities()for the six MLE models. - Fix the documentation of
italy,priors,btd_foot(),compare_foot(),plot_logStrength()and ofnorm_methodandrhoinstan_foot().
From NEWS.md in the release
Install
Health
- OK13 OK2026-10-15
- NOTE11 OK, 2 NOTE2026-07-16
- OK12 OK2026-04-25
- NOTE11 OK, 3 NOTE2026-03-10
Documentation
- Help pages
- 17
- Examples that run
- 0%11 never run
- Exported functions with examples
- 92%
- Documented parameters
- 92%
- Return-value docs
- 100%
- Help pages citing references
- 24%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- not measured
- Median days to close, 50 most recently updated closed PRs
- 1
Stars over time
Forks over time
Issues over time
PRs over time
Commits over time
9 development-tooling and community-health practices detected across 5 families in the upstream repository
Checks run against github.com/leoegidi/footbayes on 2026-10-21.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-10-14 · The repository has a site deploy workflow
Show all practicesHide 1 practice
Dependencies
Code & Tests
Datasets
People & History
Package metadata
- First published
- 2022-02-21
- Total releases
- 5 / 4 yrs
- License
- GPL-2 OSI
- Additional repositories
- stan-dev.r-universe.dev
- Minimum R
- ≥ 4.2.0
- Bundled data
- 1,003 KB / 2 files
- Download size
- 3.2 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("footBayes")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-23, which the citation names so these numbers can be found later. More on citing and the projects behind them.