After just three games this season, Phoenix Suns head coach Earl Watson had the unpleasant honor of ending the NBA’s 533-day streak of no coaches being fired. It was a record-setting period. Except for last season, at least one NBA coach has been fired in the middle of the season for the past 46 years (and a whopping 12 coaches were fired in 2016 alone). More often than not, it’s because the team is losing. That was true for Watson, whose Suns suffered three defeats before he was cut loose.

News of his ouster was shared with speculation of who would be next: Alvin Gentry of the New Orleans’ Pelicans? Jeff Hornacek of the New York Knicks? Maybe Dwane Casey of the Toronto Raptors?

Firing the coach seems to be a logical response to losing. But it’s not always the best decision a team’s management can make. Often, they’re suffering from outcome bias. Outcome bias occurs when we judge the actions of others based on the result of a decision rather than whether it was the right choice using the information available at the time. In the case of Watson and the Suns, any good coaching decisions he made were overshadowed by the Suns’ three defeats, even if they were the result of factors beyond Watson’s control.

Firing the coach seems a logical response to losing. But it’s not always the best decision a team’s management can make.

NBA coaches, just like their bosses, are susceptible to outcome bias. And it can lead them to make irrational, and sometimes poor, decisions. In a recent study, published in Management Science with Lars Lefgren and Brennan Platt, we use data from over 20,000 NBA games and find that basketball coaches are 17 percent more likely to change their starting line-up in the game following a close loss compared to a close win. This response to close losses occurs even though a close loss is not a great predictor of the team’s future success. For example, the win percentage for the five games before or after the focus game are nearly identical for a team that wins by one point and a team that loses by one point.

It’s not surprising that coaches who lose by a large margin are the most likely to change things up and that coaches that win by a fair margin are much less likely to do so. What is surprising is that there is a sharp and immediate drop right at the comparison between winning by one point and losing by one point. This 17 percent drop right at the point between winning and losing provides evidence that coaches are responding to the outcome of the game rather than the information provided in the score differential. Overreaction to close losses occurs even when the loss was determined by factors outside the control of the coach, such as how lucky the opponent’s players are at the free throw line. On average, a team gets to shoot 25 free throws per game and makes 75 percent of these shots. As with any average, this free-throw percentage hides the fact that on certain nights teams will overperform and sometimes they’ll underperform at the foul line—but we can’t predict when that is. So on some nights, luck at the free throw line beats skill on the court.

Coaches overreact to close losses even when it was determined by factors outside their control, such as how lucky the opponent’s players are at the free throw line.

For example, on February 24, 2010, the Detroit Pistons shot 45 percent from the free throw line (10 for 22). To make matters worse for the Pistons, their opponent that night, the Los Angeles Clippers, shot over 90 percent from the line (22 for 24). This combination of bad luck by the Pistons and good luck by the Clippers created a net transfer of 10 points between the two teams based entirely on how well each shot from the free throw line. The Pistons ended up losing the game by six points suggesting that the outcome of the game was determined largely by the luck experienced at the free throw line.

We find that the coaches allow these types of factors that are outside of their control to taint the evaluation of their own strategy. Because the opponent’s free-throw percentage is outside the control of the coach, the coach should not make strategic decisions for the next game based on whether the opponent did better or worse at the free-throw line. We find that if an opponent makes 80 percent of their free throws instead of 70 percent, the coach is about half a percentage point more likely to change the starters in the next game.

One might question whether it really is the case that coaches have no control over the free-throw percentage of their opponent. A savvy coach may be able direct his players to foul opponents who are poor free-throw shooters. But this is likely to only affect a small fraction of fouls committed during a game. In addition, if this were something that elite coaches were good at, we would expect to see that the opponent’s free-throw percentage would be consistent over time; this is not the case.

So on some nights, luck at the free throw line beats skill on the court.

We can do something else to test whether a team and their opponent are predictably lucky at the free-throw line: examine whether this information is reflected in the point spread that betting markets set for the game. We find that while the relative luck at the free throw line is strongly correlated with the final score difference, it has almost no correlation with the point spread for the game. This suggests that there is very little ability to predict which team will be luckier at the free throw line.

One caveat is that while the coach appears to have no impact on the free-throw percentage of the other team, he does have control over how many free-throw attempts the other team will get during the game. This measure is correlated across games for specific teams, and it seems that some coaches are able to reduce the fouls their teams commit by allocating less time to foul-prone players or putting in better defenders. However, there is no relationship between the number of free-throw attempts that a team gets during a game and its free throw percentage.

In the end, the mark of a good coach is winning by enough points that an opponent’s lucky night at the line is irrelevant. However, since so many NBA games are determined by such a small margin in the end, it’s likely that we will continue to blame coaches for outcomes that are largely outside of their control. In addition, coaches will continue to make changes from game to game based on chance outcomes. So while that buzzer-beating shot leads to heartbreak and the desire to blame someone for the loss, the real culprit may be that luck follows a bell curve.