Is it all over?

I run 10,000 simulations on the final round of matches in the Premier League season, so as to project the odds of each player winning my PremPredict competition.

Robin Penfold
2019-05-07

“Some people are on the pitch. They think it’s all over …”

But it isn’t. It could be Roger or Luke.

Current standings

Let’s start with the current standings:

Names Scores Bonus WorstClub WorstCost
Roger Gathercole 46 -50 AFC Bournemouth 16
Luke Finnis 92 0 Newcastle 25
Neil Waterman 98 -50 Burnley 49
Andrea Laporta 110 -50 Wolves 64
Alan Finnis 178 -50 Wolves 81
Mike Finnis 202 0 Fulham 100
George Quin 204 -50 Watford 64
Peter Finnis 212 -50 Wolves 100
Robin Penfold 228 -50 Fulham 81
Vera Finnis 234 0 Fulham 81
Scott Harrop 240 -50 Watford 100
Mathew Saunders 276 0 Fulham 100
Alan Butcher 282 0 Fulham 121
Imogen Finnis 306 0 Wolves 144
Les Penfold 328 -50 Southampton 81
Beth Penfold 342 -50 Wolves 100
Hannah Finnis 356 0 Wolves 169
Marion Finnis 428 0 Wolves 144
Laura Finnis 450 0 Wolves 169
Paula Penfold 628 0 Brighton 144

Who will win PremPredict?

But here’s what we really want to know: What are our chances of winning?

Name Likelihood
Roger.Gathercole 0.919
Luke.Finnis 0.084

Well, unless your name is Roger or Luke then the answer is zero. (Or, more specifically, in the 10,000 scenarios that I ran, you didn’t win any of them.)

Who will win the Premier League?

By the way, these calculations also show who the bookies feel will be champions.

Liverpool Man City n chance
2 1 8745 0.8745
1 2 1244 0.1244
1 1 11 0.0011

Does each player depend upon a team to win?

In short, will Luke really support Liverpool?

Roger Luke Man City Liverpool n chance
TRUE FALSE 1 2 8745 0.8745
TRUE FALSE 1 1 11 0.0011
FALSE TRUE 2 1 810 0.0810
TRUE FALSE 2 1 404 0.0404
TRUE TRUE 2 1 30 0.0030

For completeness (and reproducibility), here’s the code that I used to calculate what’s above.

Current standings


library(premPredictor)
suppressMessages(library(tidyverse))

iterations <- 10000
  
player_info <- 
  "https://www.dropbox.com/s/uin6zk4w5cyk2m1/PremPredict-18-19.csv"
player_data <- get_player_data(url_value = player_info)

odds_info <- "https://www.dropbox.com/s/cb5qyxyexksvez1/odds.csv"
odds_data <- get_odds_data(url_value = odds_info)

results <- get_latest_standings(
  data_input = player_data, 
  use_saved_data = T, 
  data_file = '201819_penultimate.rds'
  )

knitr::kable(results)

Who will win PremPredict?


project_players <- get_projection(
  url_odds = odds_info,
  url_predictions = player_info,
  project_players = TRUE,
  use_saved_data = T,
  data_file = "201819_penultimate.rds",
  runs = iterations)

winPlayer <- as.data.frame(project_players==1L)

winLikelihood <- as.data.frame(
  apply(winPlayer, 2, sum)
)

winSummary <- tibble(
  Name = colnames(project_players), 
  Frequency = pull(winLikelihood, 1)) %>% 
  filter(Frequency > 0) %>% 
  arrange(-Frequency) %>%
  mutate(Likelihood = Frequency/iterations) %>%
  select(Name, Likelihood)

knitr::kable(winSummary)

Who will win the Premier League?


project_team <- get_projection(
  url_odds = odds_info, 
  url_predictions = player_info, 
  project_players = FALSE,
  use_saved_data = T,
  data_file = "201819_penultimate.rds",
  runs = iterations)

project_team %>% 
  select(Liverpool, `Man City`) %>% 
  count(Liverpool, `Man City`) %>% 
  mutate(chance = n / sum(n)) %>% 
  arrange(desc(chance)) %>% 
  knitr::kable()

Does each player depend upon a team to win?


project_team <- get_projection(
  url_odds = odds_info, 
  url_predictions = player_info, 
  project_players = FALSE,
  use_saved_data = T,
  data_file = "201819_penultimate.rds",
  runs = iterations)

project_team %>% 
  select(Liverpool, `Man City`) %>% 
  count(Liverpool, `Man City`) %>% 
  mutate(chance = n / sum(n)) %>% 
  arrange(desc(chance)) %>% 
  knitr::kable()

System settings


R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.15

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
 [1] forcats_0.4.0       stringr_1.4.0       dplyr_0.8.3        
 [4] purrr_0.3.2         readr_1.3.1         tidyr_1.0.0        
 [7] tibble_2.1.3        ggplot2_3.2.1       tidyverse_1.2.1    
[10] premPredictor_0.2.4

loaded via a namespace (and not attached):
 [1] tidyselect_0.2.5 xfun_0.9         haven_2.1.1     
 [4] lattice_0.20-38  colorspace_1.4-1 vctrs_0.2.0     
 [7] generics_0.0.2   htmltools_0.4.0  yaml_2.2.0      
[10] rlang_0.4.0      pillar_1.4.2     glue_1.3.1      
[13] withr_2.1.2      modelr_0.1.5     readxl_1.3.1    
[16] lifecycle_0.1.0  munsell_0.5.0    gtable_0.3.0    
[19] cellranger_1.1.0 rvest_0.3.4      evaluate_0.14   
[22] knitr_1.25       highr_0.8        broom_0.5.2     
[25] Rcpp_1.0.2       backports_1.1.4  scales_1.0.0    
[28] jsonlite_1.6     distill_0.7      hms_0.5.0       
[31] digest_0.6.20    stringi_1.4.3    grid_3.6.0      
[34] cli_1.1.0        tools_3.6.0      magrittr_1.5    
[37] lazyeval_0.2.2   crayon_1.3.4     pkgconfig_2.0.2 
[40] zeallot_0.1.0    ellipsis_0.3.0   xml2_1.2.2      
[43] lubridate_1.7.4  assertthat_0.2.1 rmarkdown_1.16  
[46] httr_1.4.1       rstudioapi_0.10  R6_2.4.0        
[49] nlme_3.1-139     compiler_3.6.0