Shot Chart and Play by Play Visualization

Home for all your discussion of basketball statistical analysis.
kpascual
Posts: 50
Joined: Thu Mar 01, 2012 7:02 pm

Shot Chart and Play by Play Visualization

Post by kpascual »

Hello everyone,

I'm Ken, first time poster here on APBR. I've spent the past couple months mashing up ESPN and NBA.com's shot chart and play by play data, hoping to create some interactive visualizations of all this data. I've posted the viz at http://vorped.com.

I was wondering if you guys could provide some feedback. It's really a first stab, and I would say it's marginally more useful than what you get on NBA.com/ESPN.com, but please let me know if you think anything can be done better. You'll need a modern browser (IE9, latest Firefox/Safari/Chrome updates) to view it.

I was also thinking of providing the underlying shot chart-play by play data via an API, so we can all benefit from spending less time on the data collection and more time on analysis. Thanks!
EvanZ
Posts: 912
Joined: Thu Apr 14, 2011 10:41 pm
Location: The City
Contact:

Re: Shot Chart and Play by Play Visualization

Post by EvanZ »

What would be very useful is if you made the shot data public (i.e. in a big fat spreadsheet type format). Please. :)
kpascual
Posts: 50
Joined: Thu Mar 01, 2012 7:02 pm

Re: Shot Chart and Play by Play Visualization

Post by kpascual »

I would love to provide a big fat spreadsheet, but doing so would eat up my poor bandwidth. But what the hell, I'll try to post it later today, after the sloan conference, probably in a compressed format.
cice963
Posts: 1
Joined: Sun Mar 11, 2012 6:18 pm

Re: Shot Chart and Play by Play Visualization

Post by cice963 »

What would be really cool is player season shot charts similar to what the MLB has for batting. The NBA did keep "hot spot" charts on their website, but they do not do that anymore. Break the court down into zones, and show the percentage per each zone. Maybe a chart similar to the one used here http://82games.com/locations.htm
kpascual
Posts: 50
Joined: Thu Mar 01, 2012 7:02 pm

Re: Shot Chart and Play by Play Visualization

Post by kpascual »

I took your suggestion, and created a shot chart with zones for every player. You can also filter by game and by period. Let me know what you guys think.

Here's Lebron James, for example. http://vorped.com/bball/index.php/player/shotchart/837
YaoPau
Posts: 48
Joined: Mon Apr 25, 2011 9:56 pm

Re: Shot Chart and Play by Play Visualization

Post by YaoPau »

You know what would be a cool project... combining shot location data and play-by-play data to find each team's average points per possession depending on the location of the initial shot. There's so much discussion on eFG% and oreb rates based on shot location, but I haven't seen a project that combines the two, and it seems like all the data is there to do it.

Really cool site by the way, I'm glad you put this together.
EvanZ
Posts: 912
Joined: Thu Apr 14, 2011 10:41 pm
Location: The City
Contact:

Re: Shot Chart and Play by Play Visualization

Post by EvanZ »

I just started learning D3 myself. I need to get some cool visualizations like this going.
Crow
Posts: 10536
Joined: Thu Apr 14, 2011 11:10 pm

Re: Shot Chart and Play by Play Visualization

Post by Crow »

I share YaoPau's interest.


There was this older presentation:

http://www.amstat.org/Chapters/boston/n ... hirley.pdf

using a markov Chain model.

Perhaps, if someone was really gungho they could blend YaoPau's suggestion for initial shot locations with prior state information and possibly next opponent possession results information. That would be a pretty complete analysis of play sequences.
kpascual
Posts: 50
Joined: Thu Mar 01, 2012 7:02 pm

Re: Shot Chart and Play by Play Visualization

Post by kpascual »

@YaoPau
Actually, in the backend I have combined the shot chart and play by play data. You can sort of see this in the game shot chart viz, where if you click on a random shot circle, it'll scroll the play-by-play listing to the point the play happened. I haven't totally figured out all the visual cues that would make these features apparent.

But back to your question, yes, in theory, this project will allow you to calculate eFG by shot location. And with a little more work, you could get offensive rebound rates too.

@Crow
I think that's an interesting idea, and it's something I've thought about adding. One question I have, and maybe you guys can help think this through, is how to define a possession. For example, how do you handle an offensive rebound? Is that a new possession, or a continuation of the past possession? What about defensive fouls that don't result in free throws? And blocks?

I remember seeing one of the presentations at Sloan treat them one way, and reading other papers treating them differently. I can see reasons for both, but am interested in what you all think.

I might just be overthinking these edge cases, but at first glance it seems important to clearly define a "possession" in order to do this kind of analysis.
Crow
Posts: 10536
Joined: Thu Apr 14, 2011 11:10 pm

Re: Shot Chart and Play by Play Visualization

Post by Crow »

the standard definition of a possession includes all activity before a change in ball control.

but, change your choice to "plays" and the action after an offensive rebound is a new play.

you can make a study either way or both ways.
YaoPau
Posts: 48
Joined: Mon Apr 25, 2011 9:56 pm

Re: Shot Chart and Play by Play Visualization

Post by YaoPau »

Crow's right. Either way I meant a shot + offensive rebound + another shot = 1 total possession.

As far as I know, the general thinking is that close shots and corner 3's are the best shots you can take because their eFG% is above average, and baseline 2pt jumpshots are the worst shots because of their low eFG%.

But it might be the case that a low eFG% area has a higher than average oreb% associated with it, which would make it a more efficient shot than we've thought. Non-baseline 3s go in at like 31-32% on average iirc, which isn't particularly efficient, but we've seen studies showing those shots lead to a higher oreb%. This could probably be done for individual players too... as I bet Derrick Rose's misses are offensive rebounded at a higher rate than the average player because he draws so much help defense on penetration.

Crow takes this a step further by saying what the opposing team does afterwards counts too. Maybe straight-on 3s get rebounded at a higher rate, but maybe they also lead to more opponent fast breaks.
kpascual
Posts: 50
Joined: Thu Mar 01, 2012 7:02 pm

Re: Shot Chart and Play by Play Visualization

Post by kpascual »

So I did the analysis regarding shot efficiency by initial shot zone, and taking into account offensive rebounds. EDIT: This data is from the 2010-2011 and 2011-2012 regular seasons.

Like you guys said, the straight-away 3 has the highest offensive rebound rate, followed by both 3pt wing zones. But looking at how many points get converted on those possessions from those initial shot zones, they're still less efficient than other zones.

You can also see below that that zones with the lowest offensive rebound rates are the long 2's, which is not new because that's what this year's winning Sloan paper also found.

Code: Select all

Shotzones are defined as in the 82games article (1-5 = 3pters, 6-10 long 2's, 11-14 paint)

EDIT: Previously made error attributing 3 point shots, here is the update:

| initial_shotzone | avg_pts_converted | off_reb_rate | possession_count |
+------------------+-------------------+--------------+------------------+
|                3 |            1.2151 |       0.2130 |             8954 |
|                4 |            1.2675 |       0.1941 |            19705 |
|                2 |            1.2366 |       0.1896 |            19178 |
|                5 |            1.4657 |       0.1886 |             9111 |
|               12 |            1.0513 |       0.1871 |            10755 |
|               11 |            1.0428 |       0.1838 |            10245 |
|                1 |            1.4506 |       0.1804 |             9584 |
|               13 |            1.3845 |       0.1732 |            46691 |
|               14 |            1.4341 |       0.1682 |            54561 |
|               10 |            0.9923 |       0.1656 |            15914 |
|                6 |            0.9770 |       0.1641 |            16317 |
|                7 |            0.9662 |       0.1484 |            23500 |
|                9 |            0.9681 |       0.1468 |            24322 |
|                8 |            0.9770 |       0.1397 |            17378 |


I also started working on looking at prior results within the context of a posession, and while not complete, here's what I found so far. I assumed the following 6 possession results (made ft, missed ft, made shot, missed shot, turnover, period start/end), and looked at the point conversion efficiency for each starting result.

Code: Select all


| start_result | avg_pts_converted | off_reb_rate | possession_count |
+--------------+-------------------+--------------+------------------+
| turnover     |            1.1714 |       0.1589 |            60221 |
| missed shot  |            1.1028 |       0.1537 |           133356 |
| made ft      |            1.0511 |       0.1689 |            33037 |
| missed ft    |            1.0500 |       0.1704 |             8024 |
| made shot    |            1.0396 |       0.1589 |           157809 |
| period start |            0.9628 |       0.1489 |             9013 |
+--------------+-------------------+--------------+------------------+

Obviously turnovers will have the highest point conversion, since by nature a team will follow up with more easy buckets than after the other play states.

I did think it was interesting to see which teams were best at converting after a missed shot (2011-2012 regular season):

Code: Select all

| start_result | name                   | avg_pts_converted | off_reb_rate | possession_count |
+--------------+------------------------+-------------------+--------------+------------------+
| missed shot  | San Antonio Spurs      |            1.1635 |       0.1337 |             4666 |
| missed shot  | Los Angeles Lakers     |            1.1499 |       0.1586 |             4811 |
| missed shot  | Phoenix Suns           |            1.1429 |       0.1449 |             4480 |
| missed shot  | Miami Heat             |            1.1361 |       0.1483 |             4598 |
| missed shot  | Denver Nuggets         |            1.1343 |       0.1455 |             4632 |
| missed shot  | Houston Rockets        |            1.1235 |       0.1688 |             4460 |
| missed shot  | Sacramento Kings       |            1.1188 |       0.1237 |             4268 |
| missed shot  | Chicago Bulls          |            1.1178 |       0.1801 |             4770 |
| missed shot  | Golden State Warriors  |            1.1142 |       0.1481 |             4212 |
| missed shot  | Orlando Magic          |            1.1132 |       0.1641 |             4637 |
| missed shot  | Oklahoma City Thunder  |            1.1125 |       0.1501 |             4676 |
| missed shot  | Portland Trailblazers  |            1.1083 |       0.1495 |             4100 |
| missed shot  | Dallas Mavericks       |            1.1077 |       0.1362 |             4641 |
| missed shot  | New York Knicks        |            1.1073 |       0.1494 |             4363 |
| missed shot  | Indiana Pacers         |            1.1046 |       0.1537 |             4606 |
| missed shot  | Boston Celtics         |            1.1041 |       0.1237 |             4494 |
| missed shot  | Utah Jazz              |            1.1025 |       0.1552 |             4285 |
| missed shot  | Los Angeles Clippers   |            1.0992 |       0.1724 |             4333 |
| missed shot  | New Orleans Hornets    |            1.0933 |       0.1509 |             4321 |
| missed shot  | Minnesota Timberwolves |            1.0911 |       0.1628 |             4576 |
| missed shot  | Atlanta Hawks          |            1.0906 |       0.1486 |             4515 |
| missed shot  | Toronto Raptors        |            1.0900 |       0.1563 |             4287 |
| missed shot  | Philadelphia 76ers     |            1.0839 |       0.1511 |             4719 |
| missed shot  | Memphis Grizzlies      |            1.0823 |       0.1679 |             4229 |
| missed shot  | Cleveland Cavaliers    |            1.0777 |       0.1651 |             4386 |
| missed shot  | New Jersey Nets        |            1.0732 |       0.1626 |             4287 |
| missed shot  | Washington Wizards     |            1.0649 |       0.1554 |             4298 |
| missed shot  | Detroit Pistons        |            1.0642 |       0.1695 |             4018 |
| missed shot  | Charlotte Bobcats      |            1.0558 |       0.1635 |             4269 |
| missed shot  | Milwaukee Bucks        |            1.0385 |       0.1521 |             4419 |

... versus those who were better after a made shot:

Code: Select all

| start_result | name                   | avg_pts_converted | off_reb_rate | possession_count |
+--------------+------------------------+-------------------+--------------+------------------+
| made shot    | San Antonio Spurs      |            1.0909 |       0.1500 |             5399 |
| made shot    | Portland Trailblazers  |            1.0846 |       0.1688 |             5120 |
| made shot    | Oklahoma City Thunder  |            1.0821 |       0.1565 |             5386 |
| made shot    | Phoenix Suns           |            1.0710 |       0.1470 |             5634 |
| made shot    | New York Knicks        |            1.0698 |       0.1446 |             5361 |
| made shot    | Los Angeles Lakers     |            1.0677 |       0.1706 |             5286 |
| made shot    | Houston Rockets        |            1.0659 |       0.1592 |             5521 |
| made shot    | Denver Nuggets         |            1.0644 |       0.1568 |             5496 |
| made shot    | Dallas Mavericks       |            1.0629 |       0.1420 |             5132 |
| made shot    | Memphis Grizzlies      |            1.0558 |       0.1811 |             5058 |
| made shot    | Orlando Magic          |            1.0544 |       0.1740 |             5041 |
| made shot    | Indiana Pacers         |            1.0535 |       0.1637 |             5236 |
| made shot    | Miami Heat             |            1.0535 |       0.1522 |             5032 |
| made shot    | Chicago Bulls          |            1.0518 |       0.1861 |             4960 |
| made shot    | Utah Jazz              |            1.0485 |       0.1664 |             5192 |
| made shot    | Los Angeles Clippers   |            1.0409 |       0.1754 |             5090 |
| made shot    | Golden State Warriors  |            1.0388 |       0.1450 |             5185 |
| made shot    | Minnesota Timberwolves |            1.0354 |       0.1753 |             5534 |
| made shot    | Atlanta Hawks          |            1.0307 |       0.1436 |             5236 |
| made shot    | Detroit Pistons        |            1.0255 |       0.1648 |             5377 |
| made shot    | Philadelphia 76ers     |            1.0230 |       0.1479 |             5077 |
| made shot    | New Jersey Nets        |            1.0187 |       0.1591 |             5337 |
| made shot    | Milwaukee Bucks        |            1.0170 |       0.1649 |             5107 |
| made shot    | Boston Celtics         |            1.0146 |       0.1336 |             4798 |
| made shot    | Sacramento Kings       |            1.0126 |       0.1262 |             5649 |
| made shot    | New Orleans Hornets    |            1.0106 |       0.1657 |             4997 |
| made shot    | Toronto Raptors        |            1.0076 |       0.1607 |             5258 |
| made shot    | Cleveland Cavaliers    |            1.0034 |       0.1610 |             5527 |
| made shot    | Charlotte Bobcats      |            0.9685 |       0.1502 |             5298 |
| made shot    | Washington Wizards     |            0.9641 |       0.1761 |             5485 |

Last edited by kpascual on Fri May 18, 2012 2:59 pm, edited 1 time in total.
YaoPau
Posts: 48
Joined: Mon Apr 25, 2011 9:56 pm

Re: Shot Chart and Play by Play Visualization

Post by YaoPau »

First of all, awesome of you for doing this, this is something I can learn a lot from.

The finding that really surprises me is that zones 6-10 rated much higher than zones 2-3 (and basically 4 too). A couple years ago NBA Hotspots had their shooting % from each zone, and zones 2-4 had a eFG% of around .540, while zones 6-10 had an eFG% around .405.

Considering zones 2-4 have the highest oreb rate of any shot, I'd expect the average pts converted to be at least in the 1.08 area. What am I doing wrong.
kpascual
Posts: 50
Joined: Thu Mar 01, 2012 7:02 pm

Re: Shot Chart and Play by Play Visualization

Post by kpascual »

@bbstats The "start result" refers to how the other team's prior possession ended. So basically this is saying that offenses are worse on the next possession when the other team made a shot as opposed to when they miss, which is pretty obvious I suppose.

@YaoPau It's entirely possible that I made a mistake somewhere in the data collection. I'll go take a look later today, and I can post a slice of my dataset and share with you.

EDIT: And yup, I've found a bug in my code, where 3pt shots were being categorized as 2's, not 3's. I'm re-populating the data, and will update the prior post.
Thanks again, and let me know if you find anything else that doesn't make sense... this helps me write better code.
Post Reply