Elo Score

1.Introduction to Elo Rating System

1.1 Definition

Elo rating system [1] is a method for calculating the relative skill levels of players in zero-sum games such as chess. It is named after its creator Arpad Elo, a Hungarian-American physics professor. It is also widely used in rankings of other games and competitions like WOW, DOTA, LOL.

1.2 Symbols

1.3 Mathematical Details

The mathematical formulas of are:

This could also be expressed by:


1.4 Further Apprehension

If Player A’s actual score exceeds the expected score, with the help of Elo rating system, the rating of Player A is adjusted upward. In the other case, when Player A’s actual score falls short of the expected score, the rating of Player A is adjusted downward.

2. Implementation of Elo Rating System in NBA

2.1 Challenges and Solutions

The first challenge is that Elo score needs to be updated after each game. We deal with the challenge by creating a table to update Elo scores dynamically after each game.

The second challenge is that after each season, the Elo score needs to be updated as well. Since the sum of Elo score would decrease a little bit after each season. To tackle this issue, Elo scores for the next season are carried over at a rate of 1.03.

The third challenge is about the home team advantage. It is acknowledged that home team usually has some advantages in the game, so we take this situation into account and add an extra 20 points to home team.

2.2 Modifications

(1) Charlotte Hornet? Charlotte Bobcats?

We unify the team name ‘Charlotte hornet’ and ‘Charlotte Bobcats’ due to the fact that Charlotte Bobcats changed its team name during the whole period.

(2) The Value of K

We assign different K values for teams in different levels: the initial Elo score for each team is 1500. If the Elo score of Team A is above 1600, the corresponding K value of team A is 12. If the Elo score of Team A is between 1400 and 1600, the corresponding K value of team A is 20. Otherwise, the corresponding K value of team A is 24.

2.3 The Elo ranking system function (Code)

2.4 The Final Data Frame

Using the game logs from the past 4 years as our base Data Frame, we pulled in statistics on each game ranging from data on average player ages, defense, offense, opponent defense, opponent offense, and Elo score. Our key elements for the merge was a combination of the Date, Season, Visiting Team and Home Team.

The size of final data frame consists of 6567 rows and 137 columns. Considering that we assign the same Elo score for each team at the beginning of 2013–2014 NBA regular season, the first 600 rows can not reflect the ability difference among teams very well. Thus, we drop first 600 rows of the data frame. For baseline model and advanced models, we split the final in-sample dataset into training dataset (70%) and testing dataset (30%).


1. https://en.wikipedia.org/wiki/Elo_rating_system