# NBA Shot Charts via Kernel Density Estimation

Shot charts have been used for decades, used to identify locations where players make field goals and to identify locations where players give up field goals. Decades ago, each player has their own chart with four quarters. Typically if a field goal is made, the player has a ‘o’ is placed on the relative location on the chart. In the case of a missed field goal attempt, an ‘x’ is placed. The charts are easy to implement but become tedious to evaluate.

For example Portland’s LaMarcus Aldridge led the NBA with 659 field goals, followed by Golden State’s Stephen Curry with 653 field goals and Houston’s James Harden with 647 field goals. Each player attempted 1415, 1341, and 1470 field goals respectively. With the high volume of field goal attempts, placing all the shots onto a single shot chart leads to trouble identifying locations where the players expect to make baskets.

Instead, applying a kernel density estimator, we obtain a fluid shot chart that identifies “hot spots” where a player tends to make a higher volume of field goals. For LaMarcus Aldridge, we find that the 6’11” right-handed shooter makes a living on the left side of the court. The resulting shot chart is a smoothed distribution of field goals made over the course of the 2014-15 NBA season.

Distribution of made field goals for Portland Trail Blazers’ LaMarcus Aldridge during the 2014-15 NBA season.

A kernel density estimator is a function that takes in the shot location and distributes variation about that location, giving it weight. A common function that spreads weight is the two-dimensional Gaussian distribution with mean centered at the shot location and a width, h, called a bandwidth. The bandwidth can be determined through a plethora of methods: plug-in estimatorApproximate Mean Integrated Square ErrorRule of ThumbMarkov Chain Monte Carlo Estimate. We simply used a rule of thumb estimator; which in this case is approximately one foot bandwidth.

Once the bandwidth is determined for the selected kernel density estimator, we average all these functions to obtain a distribution. That is, in the case of LaMarcus Aldridge, we compute the 659 Gaussian distributions, each centered at a different field goal location and average. With some scaling relative to the distance from the center of the basket, we obtain the shot chart above.

This methodology has existed for well over a decade. While informative and attractive to viewers, we can improve on the visualization of the shot charts. For instance, just because a player makes a lot of baskets at one location, leading to a hot spot, does not imply that the player maintains a high field goal percentage at that location. LaMarcus Aldridge’s 2014-15 field goal percentage is 0.466. Incorporating missed attempts into the shot chart, and setting locations where Aldridge maintained a .500 field goal percentage to reddish tones and above while setting locations below .400 as bluish tones; we obtain Field Goal Percentage (FGP) map.

Map of LaMarcus Aldridge’s Field Goal Percentage (0.466) over the 2014-15 NBA Season.

From the FGP map, we see that Aldridge makes majority of his lay-ups and dunks, but also has his highest FG percentage locations from the right eighteen foot extended elbow and the left corner three; a favorite location for Aldridge’s current team, the San Antonio Spurs.

We can also apply this technique to team shooting, developing a model for locations at which a team is capable of making field goals throughout the course of a game. To illustrate this, we take the 3,326 field goals made by the San Antonio Spurs during their 2013-14 NBA Championship season.

Distribution San Antonio Spurs’ Field Goals Made over the entire 2013 – 14 NBA Season.

From the Spurs’ distribution of made field goals we see this team attacks the rim and kicks out to the corner for three point baskets. There is a slight mid-range game, as well as a relatively even distributed three point range; however the Spurs’ plans straight forward: Get the ball into the key and look to the corners. How they get there is the hard part to defend and will be left for a future post.

There are the basics to developing an NBA shot chart using a kernel density estimator. Later this week, we will take a look at animations of shot charts, taking a look at the evolution of a player; as well as looking at different ways to use a shot chart.

Nominations for the example player are open.