Advent Calendar of Football Trivia Analyses

This is another astonishing component.

Answer – yes, kind of. But also no.
This question has actually been answered (as many of these will have been). For a league of 20 teams (like the English Premier League), we might imagine if would have happened over the last ~150 years, but it’s almost certain from some basic maths that it won’t have, and moreover, will never happen.
Let’s load some data and see why.
#as per usual, going to heavily rely on tidyverse
#and engsoccerdata throughout these posts
library(tidyverse)
library(engsoccerdata)
#load English league data
league_data %
#select and gather match results
select(season=Season, division, home, visitor, hgoal, vgoal) %>%
gather(“location”, “team”, -season, -division, -hgoal, -vgoal) %>%
mutate(
g_for=case_when(
location==”home” ~ hgoal,
location==”visitor” ~ vgoal
),
g_ag=case_when(
location==”home” ~ vgoal,
location==”visitor” ~ hgoal
)) %>%
#get correct point for a win/loss
mutate(
points=case_when(
g_for>g_ag & season g_ag & season>1980 ~ 3,
g_for==g_ag ~ 1,
g_for %
#group by season and league and get final tables
group_by(season, division, team) %>%
summarise(points=sum(points),
gd=sum(gd),
g_for=sum(g_for)) %>%
arrange(-points, -gd, -g_for) %>%
#rank league order and alphabetical order
mutate(league_pos=rank(-points, ties.method=”first”),
alph_order=rank(team, ties.method=”first”)) %>%
select(season, division, team, league_pos, alph_order) %>%
#split by league and season
split(., f=list(.$season, .$division)) %>%
keep(function(x) nrow(x)>0)

#print the top of the first league table
head(league_data[[1]])
## # A tibble: 6 x 5
## # Groups: season, division [1]
## season division team league_pos alph_order
##
## 1 1888 1 Preston North End 1 9
## 2 1888 1 Aston Villa 2 2
## 3 1888 1 Wolverhampton Wanderers 3 12
## 4 1888 1 Blackburn Rovers 4 3
## 5 1888 1 Bolton Wanderers 5 4
## 6 1888 1 West Bromwich Albion 6 11
We can then run a load of Spearman’s rank correlation tests on the data to see which ones are perfectly correlated or anti-correlated in both league and alphabetical ranking. We’ll use the very handy broom package to tidy the results of our many tests into one data.frame (remove the filter at the end of the pipe chain to see what gets output).
#use broom to tidily do stats
library(broom)

#correlate league and alphabetical order by year
exact_correlations %
map_df(., function(data) {
cor.test(
data$league_pos,
data$alph_order,
method=”spearman”
) %>%
tidy() %>%
mutate(season=unique(data$season),
division=unique(data$division))
}) %>%
#take only significantly
filter(abs(statistic)==1)

print(exact_correlations)
## # A tibble: 0 x 7
## # … with 7 variables: estimate , statistic , p.value ,
## # method , alternative , season , division
And so we find no exact correlations. There are no instances in 363 separate seasons of English league football where teams line up in either alphabetical, or anti-alphabetical order.
Let’s see why this is. To make things simpler, I’m going to imagine a cutdown league of only 6 teams using teams starting with each of t

I be nuts about extensions, because they are the nice!

Copyright for syndicated content belongs to the Linked Source