Basketball Analytics: Predicting Win Shares
By: Oscar Sanchez
Tags: Machine Learning, Sports, Python, Data Science, NBA

Analysis

Objective: Can we predict individual win shares of NBA players using other basketball metrics?

The data used for this analysis is from the 2016–17 and 2017–2018 NBA Season, using Basketball-Reference. Essentially, I used data from the 2016–2017 NBA season to create our model and stats from the most recent season to predict win shares. I performed a supervised regression machine learning analysis:

Supervised : The data had win shares and all other basketball metrics included to train and test the models

: The data had win shares and all other basketball metrics included to train and test the models Regression: Win Shares is a continuous variable

Today, there are plenty of new basketball metrics used by fans and analysts worldwide to compare and measure players. In order to predict Win Shares, I used a mix of basic and advanced NBA stats:

Exploratory Data Analysis

What did the distribution of win shares originally look like?

Before continuing the analysis, I used basic EDA to see what our data can tell us first hand. First, I took a quick look at the distribution win shares:

Right away, we see that the distribution of win shares is skewed to the right. The majority of NBA players during the 2016–2017 NBA season had win shares of less than 5. This makes sense since only a selected few, mostly composed of NBA All Stars, will have very high win shares. For example, the win shares leader of the 2016–2017 NBA season was James Harden,the runner-up for MVP, with 15 win shares. So, it’s an elite status to have a high win shares.

The odd takeaway from the distribution is the number of players with 0 win shares. After further analysis, I was able to find that there was a high number of players that barely played at all. Although these players are on NBA rosters, that doesn’t mean they will not have significant impact to both the team and their own individual stats. Therefore, I updated the data to only include players that had played at least 30 games and averaged at least 25 minutes of playing time per game. Here’s what the distribution of win shares looks like after cleaning out the data:

There’s a lot less players with 0 win shares now! The distribution of win shares is still right-skewed, but looks a bit more normally distributed.

Were all the features I chose good predictors of win shares?

I analyzed this question by using the Pearson Correlation Coefficient, which measures the linear correlation between the features and target (win shares). It has a value between -1 and +1, where a value close to -1 represents a negatively strong relationship and a value close to +1 represents a positively strong relationship:

This discovery was surprising! Of the 13 basketball metrics I originally chose to predict win shares, 4 of them did not have a strong enough correlation (strong = greater than 0.5 & less than -0.5). Therefore, I excluded those metrics from my model.

I was stunned to see 3-Point percentage (3P%) have not only a weak correlation, but also a negative correlation. In today’s NBA, almost every team and player relies heavily on the 3P, so I assumed 3P% would play an important part in the analysis. Another interesting finding was the weak relationship between games played (G) and win shares. One would assume that the more games a player is involved in, the higher their win shares would be. However, just because a player is involved in a game, doesn’t mean they will have success. Assists (AST) was another metric that I assumed would have a strong relationship with win shares.

Were the remaining features highly correlation with one another?

For the next part of the analysis, I wanted to see whether the features were strongly correlated with one another, or multicollinearity. Multicollinearity generally occurs when there are high correlations between two or more predictor variables. Remember, features having a strong correlation with win shares is good, but features being strongly correlated with other features might not be that helpful. It can even make it tougher to interpret the models we will be creating.

Based on the PairPlot above, I found some issues between the features:

VORP vs BPM: has a very strong positive relationship (correlation of 0.98). Box Plus Minus (BPM) is a player’s contribution per 100 possesions over the league average when the player was on the court. Value Over Replacement Player (VORP) takes BPM and translates it into minutes based contribution to a team. In order to calculate VORP, you need to use BPM. Therefore, they are highly correlated.

has a very strong positive relationship (correlation of 0.98). Box Plus Minus (BPM) is a player’s contribution per 100 possesions over the league average when the player was on the court. Value Over Replacement Player (VORP) takes BPM and translates it into minutes based contribution to a team. In order to calculate VORP, you need to use BPM. Therefore, they are highly correlated. Shooting Percentage Metrics: We had three shooting percentage metrics left in the analysis. Field goal percentage (FG%) is a ratio of field goals made to field goals attempted. Effective field goal percentage (eFG%) adjusts field goal percentage to account for the fact that three-point field goals count for three points while field goals only count for two points. True shooting percentage (TS%) measures a player’s shooting efficiency by calculating two- and three-point field goals and free throws. I felt that these metrics were closely related (TS% and eFG% had a correlation of 0.90). Therefore, I decided to only use TS% since it had the highest correlation with win shares.

After exploring the data, I was left with the following basketball metrics as the features that were used for creating the models: