Simulating the NBA: 2021–22 Season Results | by Jake Mitchell | Towards Data Science

With the start of the NBA 2021–22 Preseason approaching quickly, I set out to simulate every team’s 82 games, plus the postseason, to find the league’s best and worst performances.
Similar to my NFL Season Simulation, all 30 teams have a rating. This year’s range starts at 1304 (Cleveland Cavaliers) and goes to 1752 (Milwaukee Bucks) with every other team somewhere in between.
Every team’s chance of winning a matchup is determined by this rating. Take the season opener as an example: The Bucks (1752) at home against the Nets (1717).
Using these equations, the Bucks have a 55.20% chance to win, while the Nets have a 44.80% chance to win.
A random number generator decides the winner, and then both ratings are adjusted based on if they were the underdog or not. The Bucks beating the Nets would increase their rating less than if the Nets beat the Bucks, purely because the Bucks are expected to win. This allows for teams to gain momentum throughout a season. The code for this is shown below:
for i = 1:length(home_schedule)Ha = 1/(1+10^((team_data(home_schedule(i),1) - team_data(away_schedule(i),1) + 2.5) * -1/400)); % approx home team chance of winningAa = 1/(1+10^((-1 * team_data(home_schedule(i),1) + team_data(away_schedule(i),1)) * -1/400)); % approx away team chance of winningT = Ha + Aa - 1; % chance of a tieH = Ha - T/2; % adjusted home team winning chancesA = Aa - T/2; % adjusted away team winning chancesteam_data(home_schedule(i),1) = team_data(home_schedule(i),1) + 20 * (HW - H); % adjusts home team's ranking based on resultteam_data(away_schedule(i),1) = team_data(away_schedule(i),1) + 20 * (AW - A); % adjusts away team's ranking based on resultend
This pattern is applied to all 1,230 games to decide the postseason schedule. The NBA postseason consists of 10 teams from each conference. The top 6 teams from each are automatically placed into the first round, while seeds 7–10 play in a small bracket to decide the 7th and 8th seed. Once all 8 teams from both conferences are determined, the postseason commences like a standard bracket, with the winners of both conference finals meeting at the championship game. Each matchup is a best of 7 series, with the higher seed getting the home games in game numbers 1,2,5, and 7 (if necessary).
All the data for regular season records, postseason records, and playoff chances are documented along the way as the season is repeated 50,000 times.
Below shows the most likely regular season record for all 30 teams, along with the statistics after 50,000 simulated seasons. The minimum and maximum columns represent the least and most amount of wins in a season for that team. The 10%, 50%, and 90% are the percentiles for all 50,000 simulations.
The Miami Heat are expected to go 43–39, with a 10% chance that they win less than 33 games and 10% chance that they win more than 55 games. This leaves them with an 80% chance they win between 33 and 55 games.
Each team’s playoff chances are shown below:
The first column represents the chances of that team finishing in the top 10 of that conference, meaning that they made the playoffs. The next column is the chance that a team makes the first round games (top 8).
Only one team did not win a single championship out of all 50,000 games, the Cleveland Cavaliers. The Orlando Magic and Oklahoma City Thunder both only won one championship.
The top 3 favorites to win the NBA Finals are the Milwaukee Bucks (16.150%), the Los Angeles Clippers (12.158%), and the Phoenix Suns (11.802%).
I was also interested in the odds that a team has the best or worst season in NBA history. The chance that at least one team beats the season wins record is 6.44%, with the Milwaukee Bucks accounting for 34.70% of those seasons. The next two likely teams are the Los Angeles Clippers (14.20%) and the Phoenix Suns (13.77%).
The chance that at least one team beats the season losses record is 12.08%, with the Cleveland Cavaliers accounting for 40.31% of those seasons. The next two likely teams are the Orlando Magic (19.20%) and the Oklahoma City Thunder (16.55%).
Out of all 50,000 simulated seasons, only one team has a chance to beat both the season wins and losses record. The Golden State Warriors have a 0.026% chance to lose the most games in NBA history, but a 0.031% chance to win the most games in NBA history.
This NBA season simulation showed that the Milwaukee Bucks are clear favorites for this year’s NBA Finals (16.15%), even with the Western Conference accounting for the majority of the championships won (54.05%).
The odds of a team having the worst season in NBA history are nearly twice as much as a team having the best season in NBA history.
Only one team won zero championships over all 50,000 simulations, and that is the Cleveland Cavaliers with an expected record of 17–65.
If this type of content interests you, I recommend reading my other article on professional sports simulations, The NFL Simulation.