# The Yhat Blog

machine learning, data science, engineering

# The Data Science of Firing Your (NHL) Coach

#### by Jean-René Gauthier | February 23, 2016

About Jean-René: Jean-René Gauthier is a former astronomer and current data scientist at DataScience. Oh and btw, he loves hockey :-)

### The Data Science of Firing Your (NHL) Coach

I'm a longtime fan of the Montreal Canadiens. I still remember their last Stanley Cup championship in 1993. I was just a kid back then, but I still have vivid memories of goalie Patrick Roy winking at the Los Angeles Kings’ Tomas Sandstrom after making an impressive save!

However, the Habs — as the Canadiens are affectionately known — have not been doing so great this year. In fact, they have lost so many games that Head Coach Michel Therrien’s job might very well be in jeopardy. This got me thinking: Does firing a coach during the season actually help a team improve their record? I decided to find out for myself.

I’ll be posting two separate investigations; the first asks whether replacing a coach can improve a team’s record — which, keep in mind, is not the same as determining if firing a coach is a good idea. In the second post, I will ask whether replacing a coach has a similar impact as keeping the same coach until the end of the season. In other words, it is possible that a team can improve under the same coach and end up with a similar record as a team with an in-season coaching change?

### Descriptive Analysis

I started my investigation by looking at the last 40 NHL seasons (1974-75 through 2014-15) on hockey-reference.com. I used the python package beautifulsoup to scrape the record of every team that played in the last 40 years and looked for in-season coaching changes.

After loading the libraries, global parameters, and functions (see appendix below), we read the data and create our pandas dataframe

year team coach_id coach coach_games wins losses olosses ties win_perc coach_link career_games coach_age career_wins career_losses career_poff_games career_stanley_cups career_winning_perc
0 1975 PHI 0 Fred Shero 80 51 18 0 11 0.739130 /coaches/sherofr01c.html 234 49 113 84 28 1 0.573604
1 1975 NYR 0 Emile Francis 80 37 29 0 14 0.560606 /coaches/francem01c.html 574 48 305 180 72 0 0.628866
2 1975 NYI 0 Al Arbour 80 33 25 0 22 0.568966 /coaches/arboual01c.html 185 42 61 81 11 0 0.429577
3 1975 ATF 0 Bernie Geoffrion 52 22 20 0 10 0.523810 /coaches/geoffbe01c.html 199 43 77 90 4 0 0.461078
4 1975 ATF 1 Fred Creighton 28 12 11 0 5 0.521739 /coaches/creigfr99c.html 0 41 0 0 0 0 -1.000000

In the chart below I plotted the raw coach firings per team in the last 40 years

The NHL has nearly doubled in teams since it began with 18 in 1975, as shown in the chart below.

Returning to coaching, I found 212 in-season coaching changes in the last 40 seasons. In the figure below, I show the breakdown by team. The St. Louis Blues have fired more coaches (15) during a season than any other team in the league. The New York Rangers and the Washington Capitals are not far behind with 12 and 11 coaches fired, respectively.

During a season, general managers do not have many options to significantly improve their team's record and make it to the playoffs. They can either 1) trade players, 2) send some players to the minors, or 3) fire their head coach.

In the post-lockout NHL, payroll caps limit the ability of general managers to trade players and send them back to the minors. In principle, this could open the door to option three. One of my working hypotheses was that the rate at which coaches get fired would go up in the post-lockout NHL.

To address this question, I plotted below the number of coaches fired per team versus the NHL season. I also performed a simple linear regression to highlight the overall trend in the data.

The results above are quite interesting. They show that the rate is actually going down, which is the opposite of what I expected. In fact, the rate of in-season firings went down by almost 50% over the last 40 years. And the results are significant: The slope is different from zero at a 3-σ significance level.

My findings above are also interesting in a different context. In 1974-75, there were only 18 teams in the NHL. Twelve of these 18 teams (67%) participated in the playoffs. In 2014-15, only 16 of the 30 teams (53%) made it to the first round. Given the stiff competition between teams in the current NHL era, I naively thought that the rate would go up because the stakes are so high. Yet again, the results point to a different story.

### When Do Coaches Get Fired?

Next, I wanted to know when coaches typically get fired during the season. Since the number of regular season games has changed a bit over the years (from 80 to 84, then down to 82), I normalized each season by the total number of regular season games. I show the aggregated results below for all 40 seasons. The histogram denotes the distribution of the number coaches being fired versus the game number. The dashed red line shows the mean number of coaches per bin.

Assuming an 82-game regular season, a coach will, on average, get fired after game 37.

I also looked at evolution over time. In the figure below, I show the mean churn game in the seasons 1975-1995 (early cohorts) and 1996-2015 (late cohorts). I only split the data into two bins in order to keep a statistically large enough sample for each bin.

There is no evidence of a change in the typical number of games before a coach gets fired. For the figure below, I assume that a season lasts 82 games. The error bars corresponds to the 95% C.I. on the mean estimated via bootstrap resampling (N=1000).

### Will the Newly Hired Coach Perform Better Than His Predecessor?

This is the most important aspect of my analysis. Will the newly hired coach perform better than his predecessor?

To answer this question, I looked at the difference in win ratio (WR), defined as the number of wins divided by the number of wins plus losses, between the hired coach and the fired coach. For seasons after 2004-2005, I counted the number of losses in overtime as normal losses. For the entire sample of 40 seasons, I found that the difference in win ratio between hired and fired coach is +0.057$^{+0.26}_{-0.29}$. The error bars correspond to the 95% C.I. This is a statistically significant result. It demonstrates that, indeed, the newly hired coach ends up with a better win ratio than his predecessor.

Below, I show a distribution of the difference in WR between the hired and fired coach for both early and late cohorts. The mean values for each sample are shown by vertical dashed lines.

Below I show the evolution in the mean WR difference for early and late cohorts. Again we see no evience for a statistically significant evolution in the WR difference over time.

### Does Experience Affect the Outcome?

Given the results shown above, it looks like firing your head coach may help you out. Well now you can ask yourself the following question: which head coach should you hire?

In this section, I address this issue by looking at a few features characterizing the fired and hired coaches. Mainly, I will be looking at the coach's age; number of coached games in the NHL career WR as a coach number of stanley cups you won as a coach

Note that all the above quantities were computed at the point in time when the coach was hired.

#### Coach's Age

In the figure below, I show the age distribution of fired and hired coaches. The distributions are similar and the mean values are very close.

The figure shows that the typical head coach is around 45 years old. There is no significant difference between the ages of fired and hired coaches. I next examined how the age of a newly hired coach impacts the winning ratio difference. In the figure below, I divided the sample of 212 hired coaches into three bins of age. I adopted a binning that would allow me to have a comparable number of coaches in each bin.

The results are interesting. At a $2-\sigma$ level, hired coaches who are older ($>$42 years old) have records that are comparable to their predecessors. However, younger coaches have a positive impact at a significance level $>2-\sigma$. This implies that hiring a younger coach yields a positive gain in terms of winning ratio. The numbers above each datapoint corresponds to the number of coaches in that bin.

### Number of Games Coached in the NHL

Next, I looked at the number of games coached in the NHL prior to the hiring date. The figure below clearly shows that general managers tend to favor coaches who are less experienced that the ones they have just fired. This is certainly consistent with the age findings described in the previous couple of charts. A coach hired in-season typically has coached 100 games less than the coach he is replacing. Note that 99 coaches (47%) had no prior experience NHL experience prior to their in-season hire.

I looked at how NHL coaching experience affects the change in winning ratio. To do this, I split the sample of hired coaches into three bins. It seems intuitive to put all coaches with no prior experience into a single bin. I split remaining sample into two samples of similar sizes.

I show the results below. Inexperience has a consistent positive impact.

### Prior Winning and Championship Record

Lastly, the last two attributes I looked at were the past winning ratio and the number of Stanley Cups won as a coach.

Interestingly enough, a lack of prior success is an indicator of a better winning ratio difference. In the case of the number of Stanley Cups won, the result is consistent with the positive impact that inexperienced coaches have on their new teams.

### In Conclusion

It looks like firing a coach has a positive impact on a team’s record. Younger and inexperienced coaches tend to have a net positive impact on their new teams, whereas older coaches have an impact that is consistent with the status quo. So why not give a chance to the new guy from the minors?

In part two of my analysis, I'll take a look at the impact of these in-season coaching changes on the outcome of the regular season and playoffs. I will try to answer a very simple question: "How many more points will I get by the end of the season if I fire my coach tomorrow than if I don't?"

I will also dig deeper into the relationship between a newly hired coach’s features and his winning record. The charts above tend to show that inexperience is beneficial. However, age or number of games coached could be biased in ways that are not explored in this post. So stay tuned for more hockey analytics from DataScience on the Yhat blog!

### About DataScience:

Based in Culver City, Calif., DataScience, Inc. combines human intellect with machine-powered analysis to extract information from data that drives real business results.

For more about our data-centric views on sports as well as our professional work for clients ranging from Belkin to JustFab, visit datascience.com.

### Appendix

#### Our Products

Rodeo: a native Python editor built for doing data science on your desktop.

ScienceOps: deploy predictive models in production applications without IT.

Yhat (pronounced Y-hat) provides data science solutions that let data scientists deploy and integrate predictive models into applications without IT or custom coding.