Monday, April 6, 2020

Understanding the NHL Using Monte Carlo Methods

Hockey, similar to baseball, is a sport with a great amount of variation on not just a game-to-game level, but on the season-to-season level. This phenomenon applies to both teams and players. Take the 2018-2020 Tampa Bay Lightning, a that won the Presidents' Trophy with 128 points, the highest total in the salary cap era. Tampa Bay outscored teams by 103 goals over the course of the season, also a salary cap era record (tied with the 2005-2006 Senators). Despite mowing over the competition for an entire 82 game regular season, the Lightning were unceremoniously swept in the first round of the playoffs by the eighth-seeded Blue Jackets, a 98 point team.

Using each team's real point percentage (percentage of games resulting in at least a point, counting no points for an OT or shootout loss) and the log5 formula (developed by Bill James to estimate the probability that a team will win the game based on the true winning percentage of each team), the probability of this Blue Jackets team beating this Tampa Bay team in a single game is about 33% (33.075% rounded to three decimal places). This obviously neglects the effect of home ice advantage (so add or subtract a few percentage points if you want) and assumes that each team's real point percentage is their "true talent level" but 33% is a nice round number that helps me make my point. If for a given game the probability of the Blue Jackets winning is 33%, then the odds that they sweep the Lightning in a seven game series is 0.33 raised to the fourth power, or about 1.2%. So the fact that the Blue Jackets swept the Lightning was highly unlikely. Many in the media attributed this upset to the Lightning not facing adversity throughout the season, the stars on the team failing when the Lightning needed them most, and John Cooper getting out-coached by his counterpart John Tortorella. As a person who tends to look at results with a bit more nuance than your average hockey writer, I tend to dismiss these proclamations.

As I said, the odds of a sweep were about 1%. But the sweep and subsequent humiliation of the Lightning underscores the fact that the Tampa Bay winning the series was not a foregone conclusion. In fact, if you take the Blue Jackets 33% chance of winning a given game versus the Lightning, we can simulate the series over and over again using a Monte Carlo simulation and yield the probability that the Blue Jackets would win the series. I used a random number generator that gives numbers between 0 and 1. I did this for 70,000 games. A number at or below 0.33 would be attributed to a Columbus win, otherwise it would be attributed to a Tampa Bay win. I then set the criteria for four wins results in a series win. Using this methodology,  the Blue Jackets win the series 16.45% of the time. For some context, flipping a coin three times and having it land on heads each time is 12.5%. So Columbus winning the series should not have been considered outlandish. It was surprising, like landing heads three times in a row, but not out of the realm of possibilities. And this was for a series involving the best team in the salary cap era. For a "normal" series involving typical playoff teams, the series is even more of a toss-up. Next time you judge a team based on a playoff series win or loss, just keep this in mind. The variation in game outcomes in the NHL is such where bold proclamations based on a seven game series is foolhardy.

As I alluded to above, the variance in team performance also applies to players. Players are often criticized for not scoring for a few games at a time or are deemed streaky if they they score in bunches. But this is the norm in the NHL. There are so many variables that go into a player scoring a goal or registering an assist. There is the opposing team's defense, the opposing goalie, whether or not your teammate receives a pass and registers a shot, whether or not a shot is deflected, etc.

Take Artemi Panarin of the New York Rangers. Panarin was enjoying his more prolific season to date with 95 points in 69 games, good for 1.38 points per game. His next best season (with respect to points per game) was last year where he scored 1.10 points per game. Now, did Panarin get better to the tune of 0.28 points per game? Or was this the result of variance? The answer is a bit of both.

Using Monte Carlo simulations, I created two distributions. The first includes Panarin's career scoring data including this year. I simulated 10,000 games for Panarin. His scoring output (in points) for each game was based on a randomly generated number from a normal distribution. The distribution was based on a mean of the weighted average of his points per game, with the 2019-2020 season receiving the most weight and his first season receiving the least weight. The standard deviation of the distribution was based on the the standard deviation of the points scored in all of his games which I found by going through his game logs. I then segmented the 10,000 games into 82 game seasons and calculated the number of points scored in each 82 game sample. I repeated this exercise, but excluded his 2019-2020 season, thus weighting the 2018-2019 most heavily when calculating the mean of the distribution. This generated 121 seasons worth of games for each sample. I made a plot showing the distribution of 82 game point totals separated by the samples with and without the 2019-2020 season.

The dashed lines and number labels represent the means of each distribution. When incorporating this seasons scoring data, Panarin's 82 game scoring goes from 90.69 points to 100.11 points, an increase of 9.42 points per 82 games. That is an increase of 10.39% when incorporating this season. Given this was his age 28 season, I am dubious that he all of the sudden became a better point scorer to the tune of 10.39%. On the other hand, using the distribution from before 2019-2020, Panarin exceeded his 2019-2020 points per game threshold just 0.826% of the time. So I would say chances are he did make some improvement. But looking at the overlap of the distributions, there is a decent chance that a a 91 points per 82 game player would outscore a 100 points per 82 game player over the course of a season. His improvement had more to do with variance then any tangible change in skill. 

So what is the takeaway? Just looking at a player's point total does not tell you how good of a scorer he is, nor can it definitively tell you if he is a better scorer than another player. Given the randomness of the NHL, we would need more data to be confident in such a conclusion. Similarly, looking at the outcome of a single playoff series does not give you much insight into if one team is better than another. So when team's make sweeping changes after the outcome of one series, you should be skeptical of that teams decision makers. Hockey is a sport littered with variance. The better a team understands this, the more rational decisions that team will make. 

All data from the post is from Hockey-Reference

No comments:

Post a Comment