Creating Elo Ratings — EFL ‘20–21 Season

Jack T.
7 min readFeb 7, 2022

--

One thing I really like about FiveThirtyEight’s sports coverage is their use of Elo Ratings and Soccer Power Index. This is a much cooler term than “power rankings”, but it’s essentially what it is, except in a much more mathematical way than subjectively ranking teams based on last week’s performance.

The Elo Rating system was originally developed by Arpad Elo, a Marquette University (Go Golden Eagles!) physics professor as a way to calculate the relative skill levels of players in games like chess. It’s now been applied to many major sports and some board games, like Scrabble and Diplomacy. The difference between the Elo ratings of the players or teams is supposed to serve as a predictor of who will win the match. A team with a higher Elo rating is expected to win, and receives a slight ratings points boost depending on how large the difference between the two teams is. This is also true for lower-rated teams who score an upset win over a higher-rated team, or battle to a draw. The lower-rated team will gain a points boost in this instance. Because of how the ratings change, the Elo system is self-correcting.

FiveThirtyEight uses the Elo Ratings system, or some variation of it depending on the sport, in their forecast models. I’ve linked to the SPI page and their article describing how their system works. Their article on how the SPI works is fascinating — I’ve read it several times and still keep going back for more insight.

To start my exploratory journey into Elo Ratings, I’m going to follow along with an NFL example, but modify it for soccer, and use the engsoccerdata package. The engsoccerdata package contains results of all top 4 leagues in England from 1888–2020. I’m mainly going to be focusing on the English Football League 2 for this project. To start off and practice, I’m only going to look at results from the 2020–2021 season. This will let me get a feel for the data and then I can go back to add in data from earlier seasons.

Let’s start by taking a look at the league table for EFL 2 for that 2020–2021 season. This will give us an idea of what the final standings looked like and how Elo Ratings compare with a team’s final positioning.

EFL League 2 Table, 2020–2021 Season

I imagine it was a pretty exciting finish to the season, with only 3 points separating the top three teams and Morecambe barely failing to make the top 3. That left a final spot playoff between Morecambe, New Port County, FG Rovers, and Tranmere Rovers, with Morecambe winning in extra time to gain promotion to League 1 for the first time in the club’s history!

Moving into final Elo Ratings for that season, I’m starting from scratch — so every team at Week 0 of the 2020–21 season is going to start with an Elo Rating of 1500 (1500 is the starting position for a lot of Elo ratings. If a team/player is below 1500, they are below average. If a team/player is above 1500, they are above average. If a team/player is squarely at 1500, they are extraordinarily average.).

I used the functions from the “Introduction to Elo Ratings” to assist in calculating the expected score of a match and calculating the teams new ratings post-match. Even though the functions are for the NFL, I’m going to use them straight up for these Elo Ratings. Since I’m starting these ratings from 2020–2021 season, every team in League 2 for that season currently has an Elo Rating of 1500. In addition to starting all the squads at 1500, I value a win at 1 point, a tie at 0.5 points and a loss at 0 points.

To determine the expected score of the home team of a match, the equation looks like:

Expected Home Team score

Raway is the Away squad’s rating and Rhome is the Home squad’s rating. Flipping some of the variables around will give you the away team’s expected score.

Now once we have the expected score for the home team, it’s time to calculate the new rating. That equation looks like:

Calculating new Elo Rating for the Home Squad

The K factor is set to 20 and is the max amount of points a team can gain from winning a match. This can be altered and tuned, but for now we’ll keep it at 20. I tested these out with a Week 1 match between Leyton Orient and Oldham Athletic, where Orient, the away team, won the match 1–0. Because I’m starting from 2020–21, both teams had Elo Ratings going into the game of 1500, making the expected score of the match a tie, valued in my program as 0.5. When I enter the outcome of the game for Oldham Athletic, a loss worth 0 points, into my function to calculate a new rating, Oldham Athletic’s rating after the game is 1490. This makes sense and tells us that the functions to calculate new ratings are working since they now have a rating below 1500. Leyton Orient’s new rating after the win is 1510. Ok, we now have a working, basic Elo Rating system.

Instead of one game, now I’ll loop through the whole season, the functions looking at the outcome of the match and the ratings of each team going into the match. Let’s see the top 10 squads in week 5 of the 20–21 season, arranged by their Elo Rating.

Team            Elo_Rating  Week
<chr> <dbl> <dbl>
1 Morecambe 1528. 5
2 FG Rovers 1519. 5
3 Walsall 1519. 5
4 Cambridge Utd 1519. 5
5 Salford City 1519. 5
6 Newport County 1518. 5
7 Cheltenham 1510. 5
8 Carlisle United 1510. 5
9 Exeter City 1510. 5
10 Harrogate 1510. 5

It appears to be working! Good news. Let’s graph the top 3 finishers from the season and take a look at how their ratings changed over the course of the campaign:

The above graph shows Bolton’s, Cambridge United’s and Cheltenham’s Elo Ratings throughout the course of the season. Because we’re starting from this season, every team starts at 1500. Cambridge United started off a little slow but quickly turned things around and didn’t drop below 1500 after Week 4. Cheltenham started the campaign off strong and never dropped below 1500. Bolton had a more interesting season. For the first half of the season, their Elo Rating was that of a below average team.

Starting in Week 25, Bolton went on an absolute tear, winning a bunch of matches in a row and overtaking Cheltenham and Cambridge Utd in terms of Elo Rating. Interestingly enough, however, Bolton finished third that season. They might have had too many points to make up during the last stretch of the season and, while they were beating teams with higher ratings than them, a win is still only worth 3 points.

Here’s the final Elo Ratings for last season:

The breakdown in this table is interesting! Bolton has the highest Elo Rating of the season, but finished third, while Morecambe had the third-highest Elo but had to make it through the playoff to gain promotion.

Now that I have Elo Ratings for the clubs at the end of the ’21 season, these will be the ratings for them at the start of the current season. The only teams that will not be part of League 2 for the ’22 season are Grimsby Town and Southend United, since they were relegated the National League, and Cheltenham, Cambridge, Bolton and Morecambe, who were all promoted to League 1. The new teams in this ‘22 season, are new promotees Hartlepool United and Sutton United and new relegatees Bristol, Swindown Town, Northhampton Town and Rochdale.

Next, I’ll be looking at how the clubs’ current Elo Ratings are stacking up so far during the ’22 campaign.

--

--

Jack T.
Jack T.

Written by Jack T.

Data enthusiast. Topics of interest are sports (all of them!), environment, and public policy.

No responses yet