<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/searching-for-unicorns-and-other-nba-myths/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://nycdatascience.com/blog/student-works/nba-unicorns-shiny/"> R – NYC Data Science Academy Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><img sizes="(max-width: 653px) 100vw, 653px" src="https://i1.wp.com/nycdatascience.com/blog/wp-content/uploads/2018/06/blog_plot2-1.png?w=450&ssl=1" alt="" class="wp-post-image" data-recalc-dims="1"></p>
<h3>A visual exploration of the 2017-2018 NBA landscape</h3>
<p><span>The modern NBA landscape is rapidly changing. </span></p>
<p><span>Steph Curry has redefined the lead guard prototype with jaw-dropping shooting range coupled with unprecedented scoring efficiency for a guard. The likes of Marc Gasol, Al Horford and Kristaps Porzingis are paving the way for a younger generation of modern big men as defensive rim protectors who can space the floor on offense as three-point threats. Then there are the new-wave facilitators – LeBron James, Draymond Green, Ben Simmons – enormous athletes who can guard any position on defense and push the ball down court in transition.</span></p>
<p><span>For fans, analysts and NBA front offices alike, these are the prototypical players that make our mouths water. So what do they have in common? </span></p>
<p><span>For one, they are elite statistical outliers</span><i><span> in at least two categories</span></i><span>, and this serves as the primary motivation for my exploratory analysis tool: </span><i><span>To identify NBA players in the 2017-2018 season that exhibited unique skill sets based on statistical correlations.</span></i></p>
<p>To access the tool, <a rel="nofollow" href="https://sjfmarks.shinyapps.io/nba_shiny_dash/" target="_blank">click here</a>.</p>
<h3>The Data</h3>
<p><span>The tool uses box score data from the 2017-2018 NBA season (source: Kaggle) and focuses on the following categories: Points, rebounds, assists, turnovers, steals, blocks, 3-pointers made, FG% and FT%. I also used Dean Oliver’s formula for estimating a players total possessions (outlined </span><a rel="nofollow" href="https://www.basketball-reference.com/about/ratings.html" target="_blank"><span>here</span></a><span>).</span></p>
<p><span>To assess all players on an equal scale, I normalized the box score data for each player. For ease of interpretability, I chose to use “per 36 minute” normalization, which take a player’s per-minute production and extrapolates it to 36 minutes of playing time. In this way, the values displayed in the scatterplot represent each player’s production per 36 minutes of playing time.</span></p>
<p><span>To ensure that the per-36 minute calculations did not generate any outliers due to small statistical samples, I removed all players with fewer than nine games in the season, as well as players who averaged three minutes or less per game.</span></p>
<h3>Using the tool: A demonstration</h3>
<p><span><a rel="nofollow" href="https://sjfmarks.shinyapps.io/nba_shiny_dash/" target="_blank">The tool is a Shiny application</a> intended to be used for exploratory analysis and player discovery. To most effectively understand and interpret the charts, you can follow these steps:</span></p>
<h5><em>Step 1: Assess the correlation matrix</em></h5>
<p><span>The correlation matrix uses the </span><a rel="nofollow" href="https://en.wikipedia.org/wiki/Pearson_correlation_coefficient" target="_blank"><span>Pearson correlation coefficient</span></a><span> as a reference to guide your use of the dynamic scatter plot. Each dot represents the league-wide correlation between two statistical categories.</span></p>
<p><a rel="nofollow" href="https://i1.wp.com/nycdatascience.com/blog/wp-content/uploads/2018/06/nbacorrplot.png" target="_blank"><img sizes="(max-width: 300px) 100vw, 300px" src="https://i1.wp.com/nycdatascience.com/blog/wp-content/uploads/2018/06/nbacorrplot-300x285.png?resize=300%2C285" alt="" width="300" class="wp-image-33836" data-recalc-dims="1" height="285"></a></p>
<p><span>The col</span><span>or scale indicates the direction of the correlation. That is, blue dots represent negatively correlated statistics, and red dots positively correlated statistics. The </span><span>size of the dot indicates the magnitude of the correlation – that is, how strong the relationship is between the two statistics across the entire league. Large dots represent high correlation between two statistics, while small dots indicate that the two </span><span>statistics do not have a linear relationship.</span></p>
<h5><em>Step 2: Select two statistics to plot for exploration</em></h5>
<p><span>We can get a flavor of these relationships as we move to the scatterplot. (<a rel="nofollow" href="https://sjfmarks.shinyapps.io/nba_shiny_dash/" target="_blank">Follow along using the app</a>.) For the purpose of identifying truly unique players, let’s look at a pairing of negatively correlated statistics with high magnitude (i.e. a blue, large dot): 3-pointers made (“3PM”) vs. Field goal percentage (“FG%”). </span></p>
<h5><em>Step 3: Explore</em></h5>
<p><span>It makes sense intuitively why these are negatively correlated – a player making a lot of threes is also attempting a lot of long-distance, low-percentage shots. Given the value of floor-spacing in today’s NBA, a high-volume 3-point shooter who is also an efficient scorer possesses unique abilities. So, let’s select FG% for our x-axis and 3PM for our y-axis (using the dropdowns in the menu bar), and see what we find…</span></p>
<div><a rel="nofollow" href="https://plot.ly/~sjfmarks/1" target="_blank"><img src="https://i1.wp.com/plot.ly/~sjfmarks/1.png?w=456&ssl=1" data-recalc-dims="1"></a></div>
<p><span>The two dotted lines within the scatterplot represent the 50th percentile for each statistic. In the case of FG% vs. 3PM, we turn to the upper right quadrant, which represents the players who are above average in both FG% and 3-pointers made. To focus our analysis, we can zoom in on this quadrant for a close look. </span></p>
<p><span>To zoom, simply select and drag across the plotted space you want to zoom in to, in this case the upper right quadrant. You can also filter by position by simply selecting specific positions in the legend.</span></p>
<div><a rel="nofollow" href="https://plot.ly/~sjfmarks/3" target="_blank"><img src="https://i1.wp.com/plot.ly/~sjfmarks/3.png?w=456&ssl=1" data-recalc-dims="1"></a></div>
<p><span>Scroll over a point to see who the player is, as well as their per-36 statistics. At the top of our plot, no surprises here: Steph Curry. While his 4.7 threes per 36 minutes leads the league, what truly separates him is his 50% efficiency from the field. But we already know that Steph is an exceptional anomaly, so who what else can we find?</span></p>
<p><span>While several superstars can also be found at the top of our plot – Kevin Durant, Kyrie Irving, and Klay Thompson stand out – we have quite a few role players up there as well: Kyle Korver, J.J. Redick, Kelly Olynyk and Joe Ingles. These are quality reserves who may not wow us with their overall statistical profiles, but play a crucial, high-value role on teams by spacing the floor without sacrificing scoring efficiency.</span></p>
<h5><strong><i>Step 4: Repeat</i></strong></h5>
<p><span>I recommend starting your exploration on the blue-dots of the correlation matrix – blocks vs. threes, rebounds vs. threes, assists vs. blocks, for example. These are where you can identify players with the most unique skill pairings across the league. (Note: When plotting turnovers, be sure to focus </span><i><span>below</span></i><span> the median line, as it is better to have low turnovers than high.)</span></p>
<p><span>For fantasy basketball enthusiasts, this is a great tool to identify players with specific statistical strengths to construct a well-balanced team, or complement your roster core.</span></p>
<h3><span>Conclusion</span></h3>
<p><span>I really enjoyed building this tool and exploring its visualization of the NBA landscape. From an interpretability standpoint, however, it is not ideal that we can only focus on one player at time. To improve on this, I plan include an additional table that provides a deeper look at players that fall above the median line for both X and Y statistics. In this way, we can further analyze these players across a larger range of performance variables.</span></p>
<p> </p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://nycdatascience.com/blog/student-works/nba-unicorns-shiny/"> R – NYC Data Science Academy Blog</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/jsZMVOvQiLs" height="1"></a></div>