Ranking the Indian Premier League (IPL) teams using the ELO rating system

The Indian Premier League is a popular cricket tournament which was founded and is run by the Indian cricket governing body BCCI. It is touted to be the most attended cricket league in the world with its brand value estimated to be close to USD 6 bn in 2019 (In contrast, the 27 year old English Premier League’s valuation is estimated at $6.7 bn).

There have been twelve seasons of IPL so far from 2008 to 2019. The 2020 games have been postponed indefinitely as on the date of writing this article on account of COVID-19. Typically, these games run between March and May of every year and uses a shortened form of the game called Twenty20. The league comprises of eight to ten teams representing different cities in India.

For this analysis, I am using an incredible dataset that I found here on kaggle submitted by Manas. The link contains two data files — one for a summary of matches and the other comprising of ball-by-ball observations. The focus of our article will be on the ‘matches’ dataset. I am using R and packages such as “tidyverse” and “elo” for this analysis. The snippet of the code is given at the end of this article.

I recently came across the concept of the ELO rating system through a screencast by Andrew Couch who was using it to rank UFC players. For those who are interested, the link is here . As I learnt more about the ELO ranking system, I found it a conceptually strong framework to rate and rank teams and I thought about using it to analyse IPL teams and see where it leads me.

An ELO rating system was created by Arpad Elo to calculate relative skill levels of players in zero-sum games. Though one can argue that cricket may not exactly be classified as a zero-sum game, this particular system has also been used in rating other games such as american football, table-tennis, major league baseball etc. Hence, my interest in using this for IPL. To find out how an ELO rating system works, I will paraphrase this sentence from Wikipedia:

“A player’s Elo rating is represented by a number which may change depending on the outcome of rated games played. After every game, the winning player takes points from the losing one. The difference between the ratings of the winner and loser determines the total number of points gained or lost after a game. If the high-rated player wins, then only a few rating points will be taken from the low-rated player. However, if the lower-rated player scores an upset win, many rating points will be transferred. The lower-rated player will also gain a few points from the higher rated player in the event of a draw. This means that this rating system is self-correcting. Players whose ratings are too low or too high should, in the long run, do better or worse correspondingly than the rating system predicts and thus gain or lose rating points until the ratings reflect their true playing strength.”

In summary, what this means is that the winner will gain a few points after each game and the loser will lose an equivalent points. However, if a weaker player or team that has generally lost in the past and causes an “upset” win, then the players/ teams will gain and lose a higher proportion of points for that match. Therefore, it makes it harder for top teams to keep maintaining a lead, while it is easier for weaker players/ teams to gain on each win.

Before going into the ELO based rating, it would be good to know how teams would be ranked through traditional (basic) analytical methods. If one were to use total games won in all the twelve seasons, we would see Mumbai Indians, Chennai Super Kings and Kolkata Knight Riders ranked as 1, 2 and 3 respectively. Note that I have combined teams who have had different owners and names over the last twelve seasons into one. So Delhi Capitals and Delhi Daredevils are combined. So is Deccan Chargers and Sunrisers Hyderabad as also Pune Warriors and Rising Pune Super Giants. A simple ranking order is as given below:

How would this compare to the success rate? i.e. if we compute the percentage of games won against games played, would the ranking look any different? Let’s see:

This does look different, Chennai pips Mumbai Indians now to be the first. More interestingly, Rajasthan Royals shoots up from eighth place to the fourth. Two simple analyses throw out two different results. If you were to bet on a team (gambling on sport is still illegal in India — so this is a hypothetical question), on whom would you really bet?

Let’s see how the elo rating system ranks the teams. I am doing this using the “elo” package in R created by Ethan Heinzen. The package does the work very simply through a simple function called elo.run. You can find a lot of examples of using this and other functions here. So I loaded up the ELO package and used primarily three columns — team1, team2 and winner. For the elo function to run, it needs a “results” argument, that is either a 1 (if teamA wins), 0 (if teamB wins) or 0.5 (if there is no result or a tie). Another important argument to be provided is the “k” factor which determines how many points get added and removed from each team for each win or loss. If you keep the ‘k’ too high, you may end up rewarding/ penalising too much and each game could have a significant influence on the ranking. If you keep the ‘k’ too low, each win or loss could have a very insignificant effect. For the purpose of this analysis I retained it at an experimental k=20. This can be adjusted to determine the sensitivity levels later if required.

After the analysis was run, elo.rank function provides the final ranking of the teams, which lists as under:

Elo Ranks (k = 20)

This ranking is very similar to the analysis we did using the win percentage above, except that Rajasthan Royals moves back to 7th place instead of 4th. This result has a good intuitive edge, particularly when you see the performance of Rajasthan Royals. They were barred from playing for a few years which meant that they had lesser number of matches under their belt. Moreover, their performance in recent editions of IPL was much worse than earlier seasons. They infact had won the first edition of IPL back in 2008!

So if one were to compare the rankings through the three methods, this is how the rankings compare:

(Yes, this was made in excel, not R!)

The data that gets generated using the above function also gives additional paramaters, such as elo scores of each team after each match and the amount of points that have got added or removed from the elo scores. This helps us to do additional analysis on the performance of the teams. For example:

  1. Findings out the trend of performance over time through the movement of elo scores:
    Plotting elo scores over the matches give an insight into how the team has moved. If there were consequtive periods of sustained wins or losses and what important turning points led to them being in the position they were in. Lets look at three teams and their end-of-season elo scores.

Note that the y-axis does not start at “0” which is a best practice. However, I had truncated the y-axis to focus more on the differential between the lines of teams vis-a-vis the individual lines.

If we were to story Royal Challenger’s performance, we can surmise the following conclusions:
a. A poor start in 2008
b. Good show between 2009 to 2016
c. Sharp drop in performance in 2017 which got slightly improved in 2018
A comparison to Chennai will show that they have generally been consistently moving ahead year on year.

2. Elo scores also help to arrive at a probability of winning. There is a specific function which determines the current probability of a win between two teams. In our analysis, this is how the teams ended their 2019 season:

Using this elo score and using the function elo.prob, one can compute the probability of the first team winning. For example, the elo.prob for Kings XI Punjab (elo score of 1439) and Mumbai Indians (elo score of 1532) is 0.36. i.e. Kings XI Punjab has a 36% chance of winning. One can then easily look at the above data and say that Rajasthan Royals or Royal Challengers, its anyone’s game. Likewise, according to this analysis Sunrisers Hyderabad has a 52% chance of winning against Mumbai Indians. Bear in mind, that as per the ranking analysis listed earlier, Mumbai was ranked higher than Sunrisers! I need to understand what this dichotomy. Probably because ranking also considers other factors.

3. Now, all the above analysis, is dependent on the ‘k’ factor which determines the extent of penalty or reward. Playing with the ‘k’ factor allows us to see how some teams can unexpectedly jump the ranks. So for example, here is the ranking at different ‘k’ levels.

The interesting points to note here is when we look at Delhi Capitals with ranks of 5, 9, 3 and 3. A further analysis of this may depict why.

If we look at the trend line of how the elo scores have moved for Delhi Capitals, we can see that somewhere during 2012–2017 there was a sharp fall in their performance, which recovered off late. We know from the conceptual understanding of elo, the penalty factor or the reward factor favors low performing teams winning. A quick analysis below shows that Delhi has won 48% of their matches after 2016 as compared to seasons before that. However, I do not know if recent streak of good performance should enable such a high jump in ranking.

So, overall, as a conclusion, the elo system does look like a promising method of analyzing relative rankings of teams. However, the cautionary tale here is that the k-values definitely need to be carefully derived such that they do not influence the rankings too significantly!

You can find the r-script here, if interested.

Learner for life! Data Enthusiast.