Interactive Exploration of NBA Lineup Data

Tom Walsh
Posted on Feb 15, 2016

Contributed by Tom Welsh. He is currently in the NYC Data Science Academy 12 week full time Data Science Bootcamp program taking place between January 11th to April 1st, 2016. This post is based on his second class project - R Shiny (due on the 4th week of the program).

My first project explored the relationship between the performance of NBA lineups (5-man combinations of players) and the 5 players who made up those lineups. A full breakdown of how I put together this dataset can be found at the link above. However, this initial investigation really created more questions than answers.

For my second project, I created a tool that would allow a user to try to answer some of these questions themselves. With so many possible variables to explore, the aim was to pass control to the user.

The Data

The data set consists of both Lineup Stats and Player Stats pulled from stats.nba.com. The Lineup Stats are the statistical output of specific 5-man combinations. An example is here. You can hover over the columns for definitions of the stats and click over to other tabs to see more of them and play with the various filters. An example Lineup Stat would be that the lineup of Bismack Biyombo, Cory Joseph, Kyle Lowry, Patrick Patterson, and Terrence Ross makes 11.6 3-pointers per 100 plays. Their FG3M.lineup is 11.6.

For each lineup, I pulled in the full-season stats of the 5 individuals within that lineup and averaged them. For our example lineup, Bismack Biyombo makes zero 3-pointers per 100 plays (he has other skills), Cory Joseph makes 0.5, Kyle Lowry makes 3.4, Patrick Patterson makes 2.5, and Terrence Ross makes 3.3. Their FG3M.player is 1.94.

In basketball, there's only 1 ball, so for offensive stats, it's usually more relevant to look at usage-weighted values. We scale the offensive stats based upon how likely each player is to be the one using the possession. Biyombo uses only 11.7% of his team's possessions when on the floor, Joseph uses 16.8%, Lowry uses 25.8%, Patterson uses 13.1%, and Ross uses 17.0%. That only adds up to 84.5% of available possessions, and this lineup doesn't simply suffer shot-clock violations on the remaining 15.5% of their possessions. So, we re-scale their stats, and their FG3M.usage is calculated as 2.19 ((11.7*0 + 16.8*0.5 + 25.8*3.4 + 13.1*2.5 + 17.0*3.3)/84.5).

Lineups

On the first tab, we can explore the relationships between the Lineup Stats and the Player Stats in either raw or usage-weighted form. It's very important to choose appropriate settings (basketball knowledge required) or else the results will likely be meaningless or at least very difficult to interpret. For example, usage-weighting is not particularly applicable to defensive rebounding.

The initial view displays NET_RATING.lineup on the Y axis and NET_RATING.player on the X axis. We see an increasing slope, which makes sense (we would intuitively expect lineups of higher net rating players to be have stronger net ratings). There is some explanatory text, which can be collapsed once you've read it. Below that, to the right, we see the size of our filtered data set, and the results of a linear fit on this data. Please note that no numerical EDA has been done, so the validity of the fit is questionable. This should be seen merely as a starting point for further analysis, rather than a statement of statistical fact. To the left, we can change our Player Stat on the X axis and our Lineup Stat on the Y axis. There is also a checkbox to switch between raw and usage-weighted Player Stats. Below, a slider allows us to filter our data set based upon the number of minutes played by a lineup.

3 pointers

Let's explore the relationship between the 3 pointers made by a lineup, and the 3 pointers made by the players in that lineup. We'll set the Lineup Stat to FG3M and the Player Stat to FG3M and click the Use Usage-Weighted Stats toggle to use usage-weighted stats. Surprisingly, there doesn't seem to be any relationship. Maybe it's just the lineups with very small numbers of minutes throwing our data off, so we can shift the left side of the slider over to 100, and see that while this has significantly reduced our number of data points, we still don't see a relationship.

When we think about this, this makes some intuitive sense. 3 point attempts (and hence makes) may be the result of ball movement, and free-flowing offense, rather than the particular proclivity for and talent at shooting of the individuals in that lineup. So, let's explore a few more possibilities.

Most 3 pointers seem to be assisted, so let's change the Player Stat to AST. We now see a slight downward trend (which may or may not be significant... personally, I hope it isn't). The data seems to suggest that there probably isn't a positive correlation. This seems quite surprising, though, because we might have expected that players who generate lots of assists would also generate lots of 3 pointers for their teammates. However, our data doesn't seem to bear this out.

Another hypothesis is that 3 point opportunities come as a result of the defense collapsing due to penetration. Let's see what happens when we set Player Stat to PCT_POINTS_PAINT (percentage of points in the paint). We finally see a possible positive relationship, although more investigation is needed to determine if it stands up to statistical scrutiny. Intuitively, though, this suggests that having players who score their points in the paint seems to lead to 3 point attempts (surprisingly, though, PTS_PAINT doesn't seem to have this relationship... more investigation is definitely needed).

You can use this tab to explore many similar questions.

Diminishing Returns

Our next tab is inspired by some of Eli Witus' work. The layout is similar to the previous tab, but our plots are slightly different, for investigating diminishing returns.

Our initial plot looks at true shooting percentage(TS_PCT). On the Y axis, we see the difference between the lineup's true shooting percentage and the "null hypothesis" true shooting percentage (what we would expect in the absence of diminishing returns). On the X axis we see the extent by which the players in that lineup have increased or reduced their usage. The increasing slope here suggests that as players are forced to decrease their usage, their true shooting percentage increases.

If we want to look at offensive rebounding(OREB_PCT), usage-weighting no longer makes sense. Let's select OREB_PCT as the Stat, uncheck the Use Usage-Weighted Stats checkbox, and check the Sum Player Stats checkbox. Our null hypothesis is now that a lineup's offensive rebounding percentage should be equal to the sum of the offensive rebounding percentages of its players. The Y axis now display the difference between reality and this expectation. The X axis now displays the null hypothesis offensive rebounding as well. What we see is that the more offensive rebounding we have in our lineup, the greater the diminishing returns.

Distributions

The final tab allows for visual inspection of the distributions of our data. It's useful when you see a strange shape in the plots on the other two tabs and wonder where there's actually an interesting shape in the data or if you're just looking at random noise due to small numbers of data points.

About Author

Tom Walsh

Tom Walsh

Tom Walsh (M.Sc. Computer Science, University of Toronto) developed a desire to get deeper into the data while leading a team of developers at BSports building Scouting Information Systems for Major League Baseball teams. A course on Basketball...
View all posts by Tom Walsh >

Leave a Comment

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python python machine learning python scrapy python web scraping python webscraping Python Workshop R R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp