footBayes 0.1.0 is on CRAN! The goal of the package is to propose a complete workflow to:
– fit the most well-known football (soccer) models: double Poisson, bivariate Poisson, Skellam, student t through the maximum likelihood approach and HMC Bayesian methods using Stan;
– visualize the teams’ abilities, the model pp checks, the rank-league reconstruction;
– predict out-of-sample matches via the pp distribution.
Here a super quick use of the package for the Italian Serie A. For any detail, check out the vignette and enjoy!
p.s. the vignette has been compiled without plot rendering to save time during the CRAN submission
library(footBayes) require(engsoccerdata) require(dplyr) # dataset for Italian serie A italy <- as_tibble(italy) italy_2000_2002<- italy %>% dplyr::select(Season, home, visitor, hgoal, vgoal) %>% dplyr::filter(Season=="2000" | Season=="2001" | Season =="2002") fit1 <- stan_foot(data = italy_2000_2002, model="double_pois", predict = 36) # double poisson fit (predict last 4 match-days) foot_abilities(fit1, italy_2000_2002) # plot teams abilities pp_foot(italy_2000_2002, fit1) # pp checks foot_rank(italy_2000_2002, fit1) # rank league reconstruction foot_prob(fit1, italy_2000_2002) # out-of-sample posterior pred. probabilities
Leo:
I don’t like the alphabetical order of the graphs. I recommend ordering by estimated ability, or won-loss record, or preseason ranking, or something like that.
Nice suggestion Andrew, thanks a lot.
This edit will be implemented in the next CRAN package version (and immediately on Github).
I wonder whether the data will include the soccer matches in England back in the mid 1960s as reported in Norway. The matches, due to the rare extremely cold weather in England, never actually took place but the “football pools” in Norway had to continue because of the revenue stream. Experts in Norway decided who won and by what score in the nonexistent matches and distributed the money accordingly to the Norwegian betters.
Can you tweak it to do us football and predict super bowl winner? Can you make sure you do not predict the chiefs?