Nylon Calculus: Basketball’s optimal stopping problem

Shot-selection is a lot like parking a car on a crowded street — do you take what’s there or look for a better option? Which teams are solving this “optimal stopping problem”?

There’s not a lot to like about living through a global pandemic. So if you’re looking for a book to distract yourself until life calms down and basketball comes back, I would highly recommend “Algorithms to Live By: The Computer Science of Human Decisions.” It’s the fruit of a partnership between two smart guys: Tom Griffiths, a professor of psychology and cognitive science at UC Berkeley, and Brian Christian, a computer scientist and bestselling author. In the book, the pair describe some of the world’s most popular computer algorithms, explaining how each one works and why it’s relevant to our everyday decision making. Much of the conversation could also be applied to decision making on the basketball court; in particular, to a player’s decision of whether or not to shoot.

The decision to end a play by attempting a shot is a version of the optimal stopping problem, a class of decisions that Christian and Griffiths cover in great detail. In the book, they focus on a different example of optimal stopping — a driver looking for a place to park on a crowded street.

“Assume you’re on an infinitely long road, with parking spots evenly spaced, and your goal is to minimize the distance you end up walking to your destination……”

It’s such a familiar experience — should I take this open spot or keep searching for a closer one? The authors suggest that we can find the RIGHT answer with the help of an algorithm, one called the Look-then-Leap rule.

“The optimally stopping driver should pass up all vacant spots occurring more than a certain distance from the destination and then take the first space that appears thereafter.”

If your street has a parking-spot occupancy rate of 99%, then the authors estimate you should take the first spot you find within a quarter-mile of your destination. George Costanza might be appalled, but that’s just math.

Algorithms can help with other optimal stopping problems, too. When have you dated enough people to recognize who your best match is? How many apartments should you tour before you commit to putting down a deposit? How many applicants should you interview before hiring a secretary? In each instance, the challenge is the same:

“Your goal is reducing the twin, Scylla-and-Charybdis regrets of the ‘one that got away’ and the ‘stone left unturned’ to the absolute minimum.”

A basketball possession poses the same dilemma. Five offensive players are working together to create their best opportunity to score, but how do they know when they have found it?

Well, they could try using the look-then-leap algorithm that Christian and Griffiths applied to the parking spot search. Apparently, 37 percent is some kind of magic number whenever you are in one of these looking and leaping situations. The 37 percent rule says you should just look at the first 37 percent of the opportunities — to gather information about the range of possibilities — and then be ready to leap at the next opportunity that is better than all the previous ones.

Within the constraints of the NBA’s 24-second shot clock, the 37 percent rule would have a team pass up any scoring chance created during the first 9 seconds of the possession and then fire away at the next shot that was better than all the previous opportunities. At least, that would be the optimal solution to the problem if your team was playing the first basketball possession ever.

Fortunately, we already have a pretty solid understanding of what makes a good or bad shot opportunity. Are you near the basket? Are you open? Are your feet set? These factors determine shot quality. And, because we have this information, it’s no longer a look-then-leap situation; it’s now a so-called ‘full information’ optimal stopping problem.

In a full-information stopping problem, there is a relationship between the number of opportunities remaining and the threshold above which we should judge the current opportunity to be worthwhile. Christian and Griffiths describe how this threshold rule works using the example of hiring a new employee:

“The math shows that when there are a lot of applicants left in the pool, you should pass up even a very good applicant in the hopes of finding someone still better than that – but as your options dwindle, you should be prepared to hire anyone who’s simply better than average.”

Taking it back to the hardwood: when there is a lot of time left on the shot clock, a team should pass up even a very good shot in the hopes of finding a great one — but as the clock winds down, they should be prepared to take any shot that is simply better than average. And, in fact, we know that’s pretty much how it happens! Take a look at how shooting percentages vary based on the amount of time left on the shot clock.

The black line shows the league average effective field goal percentage by shot-clock range: 59 percent on shots taken early in the possession (from 24 to 18 seconds), 53 percent on shots taken in the middle of the possession (from 18 to 7 seconds), and 45 percent on shots taken at the end of the possession (from 7 to 0 seconds). Just like we would expect based on our optimal stopping theory — the most makeable shots come early in the clock and teams take what they can get as the buzzer approaches.

The gray lines show the stats for the league’s 30 teams. At first glance, all of the lines look roughly similar — they all decrease from left to right — but there are some important differences between the teams. The slopes of the individual line segments actually vary quite a bit, indicating that teams have had differing levels of success during the three stages of the shot clock and, by implication, differing approaches to optimal stopping.

For example, the Toronto Raptors had much more success when they shot early in the clock (62 effective field goal percentage on shots taken from 24 to 18 seconds left) than when they shot late in the clock (42 effective field goal percentage on shots taken from 7 to 0 seconds left). So it makes sense that they also attempted a larger fraction of their total team shots early in the clock (22 percent of all team shots) than any other team in the league.

In contrast, teams like the Houston Rockets and the Los Angeles Clippers seem to be unfazed by the ticking shot clock, as they experienced much smaller decrements in shooting (i.e., drops of less than 10 percentage points in effective field goal percentage) when comparing early- to late-clock scenarios. The Rockets had the third-highest shooting at the end of the clock (48 effective field goal percentage from 7 to 0 seconds) and the Clippers had the sixth highest-highest (47 percent).

To test whether these teams are achieving optimal stopping, I’m going to use a very simple (and hopefully intuitive) measure of shot quality based on the NBA’s shot-tracking data. Below I call this an equal-weighting formula because it simply adds 1 point for any condition (like being wide open) that makes a shot easier and subtracts 1 point for any condition (like pulling-up off the dribble) that makes a shot harder. There’s no statistical model here, no individual shot data, or regression coefficients; but the scoring rubric is supported by the actual league-wide shooting percentages on these types of shots (e.g., 58 effective field goal percentage on wide-open shots vs. 47 percent on very-tightly covered shots during the 2019-20 season).

In essence, the formula boils down to this: the higher the score, the better the shot. For example, we would assign a value of +3 to a wide-open attempt taken from inside of 10 feet without dribbling, whereas a very-tightly-guarded pull-up jumper taken after 7 or more dribbles would earn a score of -3. Traditionally, the goal of running an offense has been to move these shot-quality sliders from the blue areas to the red ones — searching for open, easy shots.

Now that we have a way to assess shot quality we can return to basketball’s optimal stopping problem. How does shot quality change with the time remaining on the shot clock? Does it match the threshold rule? Is every team in the league optimizing its shot selection throughout the shot clock?

As we might have expected from the shooting percentage charts we looked at before, league-average shot quality scores decreased from early in the shot clock (+0.59) to late (+0.05). But, apparently, not every team has the same thresholds for shot quality. For example — based on our simple shot-quality scores — the Rockets settled for the second-worst early-clock shots (+0.35) and the Clippers took the fourth-worst (+0.38).

Obviously, to some extent, these shot-quality scores might just reflect personal preferences. The Rockets offense revolves around James Harden’s pull-up jumper. So, what might look like bad shots to my formula could actually be totally acceptable opportunities from the Rockets’ perspective. But these patterns may also be evidence of some sub-optimal shot selection.

The Clippers have the NBA’s third-lowest point-per-possession average in transition (1.07 PPP) and we could take veteran guard Lou Williams (0.93 PPP on 2.7 transition chances per game) as an example of the team’s struggle for efficiency on the break. Per PBPstats.com, of the 55 players who shot 500+ 2-pointers this season, Williams had the fourth-lowest 2-point percentage (44 percent) and the seventh-lowest shot quality. Williams is a tough shot taker and a tough-shot taking is definitely a valuable asset for an offense to have, but not necessarily when it comes at the beginning of the shot clock and especially not if it means sacrificing an opportunity to attempt an easier shot. It’s possible that, in some instances, Williams may be “parking the car” too soon and that the Clippers might be better served by circling the block a few more times before pulling over.

I really don’t mean to sideswipe Williams, because I haven’t looked carefully at his transition opportunities and — at least anecdotally — lots of his early-clock pull-up jumpers do seem to come in 2-for-1 situations. But regardless of the specific underlying causes of the Clippers transition issues — conceptually, an examination of shot quality trends by shot clock range of this type should allow teams to check their shot selection and help them to tackle basketball’s version of the optimal stopping problem.