<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vinnie T on Medium]]></title>
        <description><![CDATA[Stories by Vinnie T on Medium]]></description>
        <link>https://medium.com/@vinnietoor?source=rss-3061704ec6ab------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VUPx87GppCuS51dvY9Ctdg@2x.jpeg</url>
            <title>Stories by Vinnie T on Medium</title>
            <link>https://medium.com/@vinnietoor?source=rss-3061704ec6ab------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 23:59:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vinnietoor/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[NBA Player Salary Predictions]]></title>
            <link>https://medium.com/@vinnietoor/nba-player-salary-project-131046d48803?source=rss-3061704ec6ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/131046d48803</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[nba]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Vinnie T]]></dc:creator>
            <pubDate>Wed, 12 Apr 2017 22:46:19 GMT</pubDate>
            <atom:updated>2017-04-17T21:01:34.026Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*Jzb1fT8mAFRO9D8-BBhBGA.jpeg" /></figure><h3><strong>Business Problem:</strong></h3><p>Every year, the NBA increases salary cap for each team. This has lead to players signing contracts bigger than ever before. There are many rules and regulations that apply to player contracts, however, the main question that needs to be addressed is, are the players performing at the same level as their salary indicates?</p><h3><strong>Project Goals</strong>:</h3><p>The purpose of this project is to create a model that uses player statistics to predict a salary. This model will help team team owners and General Managers to further assess if any given player is truly worth the salary they are considering paying. In addition to team owners and GMs, future NBA players can use this model to gauge a cluster of statistic categories that they need to focus on in order to hit a certain dollar amount.</p><h3><strong>The Data:</strong></h3><p>I scraped data from two different websites. All of the player statistics came from www.basketball.realgm.com and all the salary data came from www.espn.com.</p><p>I decided to use the past 5 years worth of statistics. Scraping data from www.basketball.realgm.com left me with many “NaN” values due to some players not being “qualified” for certain advanced statistics. According to www.basketball.realgm.com, a “qualified” player is one who is on pace to play in at least 70 games a season for the major statistical categories such as Points, Rebounds, Assists, Steals, and Blocks. A “qualified” player for the Field Goals Made category must be on pace to make 300 Field Goals in a season. A “qualified” player in the Three Point Field Goals Made category must be on pace to make 55 three pointers in a season. And finally a “qualified” player in the Minutes and Advanced categories must be on pace to play 500 minutes in a season.</p><p>Since I wanted to use as many players as I could in the past five years, I did not want to drop the players that were not “qualified” in certain categories. Instead I replaced their “NaN” values with zeros, with the assumption that if they are not on pace to play 500 minutes or at least 70 games, then a zero in that category would be representative of their lack of stats and lack of minutes played.</p><p>After scraping for the past five years and cleaning all my columns, I was left with a dataset of 1890 rows and 56 columns. Each row consisted of the average stats for one player during a specific year. This is a relatively small dataset however, my plan was to create a model first and then worry about throwing in more data after I had a model that was working well. I split my data using the sklearn.model_selection.test-train-split method. 70% of my data was my training set and the remaining 30% was the testing set.</p><h3>Data Dictionary</h3><h4>Basic Stats</h4><ul><li>Salary : Player salary for given year</li><li>Position: Player’s position</li><li>Year : Year of stats</li><li>ASTtoTOV : Average Assists to Turnover Ratio (Ball Security)</li><li>STLtoTOV : Average Steals to Turnover Ratio (Defensive aggression vs. Ball Security)</li><li>FTAtoFGA : Average Free Throws Attempted to Field Goals Attempted (Draw Foul Rate)</li><li>3p% : Average of Three Point percentage per game</li><li>3PA : Average of Three Pointers Attempted per game</li><li>3PM : Average of Three Pointers Made per game</li><li>AST : Average of Assists per game</li><li>BLK : Average of Blocks per game</li><li>DRB : Average of Defensive Rebounds per game</li><li>FG% : Average of Field Goal Percentage per game</li><li>FGA : Average of Field Goal Attempts per game</li><li>FGM : Average of Field Goals Made per game</li><li>FT% : Average of Free Throw Percentage per game</li><li>FTA : Average of Free Throw Attempts per game</li><li>FTM : Average of Free Throws Made per game</li><li>GP : Games Played during the season</li><li>MIN : Average of minutes played per game</li><li>ORB : Average of Offensive Rebounds per game</li><li>PF : Average of Personal Fouls per game</li><li>PTS : Average of Points per game</li><li>Player : Name of Player</li><li>REB : Average of Offensive and Defensive Rebounds per game</li><li>STL : Average of Steals per game</li><li>TOV : Average of Turnovers per game</li><li>Team : Team name of Player</li></ul><h4>Advanced and Misc Stats</h4><ul><li>AST% : Assist Percentage (A measurement of the percentage of assists a player records in relation to the team’s overall total while he is in the game)</li><li>BLK% : Block Percentage (A measurement of the percentage of blocks a player records in relation to the opponents two point field goal attemps)</li><li>DRB% : Defensive Rebound Percentage (A measurement of the percentage of defensive rebounds a player secures that are available to his team)</li><li>Drtg : Defensive Rating (The number of points a player allows per 100 possessions)</li><li>FIC : Floor Impact Counter (A formula to encompass all aspects of the box score into a single statistic. The intent of the statistic is similar to other efficiency stats, but assists, shot creation and offensive rebounding are given greater importance)</li><li>ORB% : Offensive Rebound Percentage (A measurement of the percentage of offensive rebounds a player secures that are available to his team)</li><li>Ortg : Offensive Rating (The number of points a player produces per 100 possessions)</li><li>PER : Player Efficieny Rating (for more information: <a href="https://en.wikipedia.org/wiki/Player_efficiency_rating">https://en.wikipedia.org/wiki/Player_efficiency_rating</a>)</li><li>PPR : Pure Point Rating (100 x (League Pace / Team Pace) x ([(Assists x 2/3) — Turnovers] / Minutes)</li><li>STL% : A measurement of the percentage of steals a player records in relation to the team’s overall total while he is in the game</li><li>TOV% : A measurement of the percentage of turnovers a player records in relation to the team’s overall total while he is in the game.</li><li>TRB% : A measurement of the percentage of both offensive and defensive rebounds a player secures that are available to his team</li><li>TS% : True Shooting Percentage (A measurement of efficiency as a shooter in field goal attempts, three-point field goal attempts and free throws)</li><li>TotalS% : Total shooting percentage (The sum of a player’s field goal, free throw and three-point percentage)</li><li>USG% : Usage Percentage (A measurement of the percentage of plays utilized by a player while he is in the game)</li><li>eDiff : Efficiency Differential (The difference between a team or player’s ORtg and DRtg)</li><li>eFG% : Effective Field Goal Percentage (A measurement of efficiency as a shooter in all field goal attempts with three-point attempts weighted fairly)</li><li>20ast : Count of games with 20 assists or more during season</li><li>40pts : Count of games with 40 points or more during season</li><li>5blk : Count of games with 5 blocks or more during season</li><li>5stl : Count of games with 5 steals or more during season</li><li>DBLDBL : Double Double (At least 10 during a single game in two categories from points, rebounds, assists, blocks and steals)</li><li>HOB : Hands on Buckets (Number of buckets a player is directly involved in whether as the scorer or passer. The formula is field goals plus assists divided by team field goals)</li><li>TRPLDBL : Triple Double (At least 10 during a single game in three categories from points, rebounds, assists, blocks and steals)</li><li>high_game : Showing the highest point total for one game during the season</li><li>techs : Count of technical fouls for the season</li></ul><p><strong>For data scraping and cleaning refer to</strong>: <a href="https://github.com/vinnietoor/DSI-SF-4-vinnietoor/blob/master/capstone_stuff/scraping_and_cleaning.ipynb">https://github.com/vinnietoor/DSI-SF-4-vinnietoor/blob/master/capstone_stuff/scraping_and_cleaning.ipynb</a> <strong>and</strong> <a href="https://github.com/vinnietoor/DSI-SF-4-vinnietoor/blob/master/capstone_stuff/merge_5_years_data_and_cleaning.ipynb">https://github.com/vinnietoor/DSI-SF-4-vinnietoor/blob/master/capstone_stuff/merge_5_years_data_and_cleaning.ipynb</a></p><h3>Exploratory Data Analysis</h3><h4>Heatmap</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*hcvzUjSm-FMgspez2hs41w.png" /><figcaption>Heatmap of all categories</figcaption></figure><p>I wanted to take a look at how my categories were interacting with each other so I created this Heatmap. The dark red squares indicate a strong positive correlation while the dark blue squares indicate a strong negative correlation. As you can see there are many dark red squares in my Heatmap indicating a lot of multicollinearity in my data.</p><h4>Salary vs. Points</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*_hJ06GdgGSYTpEMZ7Clzbg.png" /><figcaption>Avg Points vs. Salary</figcaption></figure><p>Here I wanted to take a deeper look into some of the categories that I felt would be indicative of Salary. In this plot, Salary is on the x-axis and Points is on the y-axis. There is a lot of extra noise in this scatter plot however an upward trend can still be identified with the points. A pearsonr score of 0.63 further validates that Points is in fact a strong predictor of Salary.</p><h4>Salary vs. Hands on Buckets</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*YQVURYeKQaJjPtMM2QvSHw.png" /><figcaption>Hands On Buckets vs. Salary</figcaption></figure><p>Here I am taking a look at another variable that I felt would also have a strong correlation with Salary. Hands on Buckets is a stat that calculates the number of buckets a player is directly involved in whether as the scorer or passer. This is indicative of how important a player is offensively to their team. With a pearsonr of 0.53, the plot shows a bit of an upward trend with Salary however there is a lot of noise and many points clustered at zero on the y-axis. This is due to filling in zeros for the players who were not “qualified” for this advanced stat.</p><h4>Salary vs. Minutes Played</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*wfOtEABRqA9VhxeZtZ26SA.png" /></figure><p>For my last scatter plot I wanted to take a look at how minutes played correlated with Salary. Intuitively it makes sense to me that a player is going to get paid more if the team plans to give that player a lot of playing time. The scatter plot shows a pearsonr of 0.57. This validates that minutes does in fact have a strong correlation with salary however there is a lot of noise in this plot. Many players who are playing a lot of minutes are not necessarily making a lot of money relatively speaking.</p><p>These plots have given me a good idea of a few of the variables that would have strong correlations with Salary. Next, I’d like to take a look at how Salary is being broken down over the different five different positions.</p><h4>Salary distributed across Positions</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*oPgK0sGcKBS47YR0Uv_ukA.png" /><figcaption>Salary vs. Position</figcaption></figure><p>Here I see that the Power Forward tree is the most dense in the $10-$15 Million range. For a young developing player, if he is blessed with the size and strength to be able to play with other big men in the NBA, it would be financially beneficial to focus on skills of a Power Forward in addition to those of a center. In today’s NBA we are seeing Power Forwards becoming quicker, leaner, more athletic, and more skillful than ever before. Focusing on ball handling, agility/athleticism, and shooting range in addition to the big man skills of rebounding, blocking shots, and the ability to score in the post are all important to being a top tier Power Forward.</p><p>Among the guard positions it seems that Point Guards have a more consistent distribution of Salary than Small Forwards and Shooting Guards. As a young basketball player who does not have the same size as Power Forwards and Centers, it may be financially beneficial to focus on skills such as ball handling, passing, shooting, quickness, and court IQ that would make them a point guard. Since not many players are able to perform these skills at a high efficient level, Point Guards are obviously going to be valued higher than the other guard positions.</p><p>Now that I have a good idea of how Salary is being distributed among the different positions and some of the categories that are highly correlated with Salary, I’d like to take a look at how much money the NBA teams have spent on their players in the past 5 years.</p><h4>Total Money Spent on Salary in Past 5 Years</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*wQXwUBS0LMv0vBhvbh9Cbw.png" /></figure><p>New York, San Antonio, and Miami are all among the biggest markets in the nation. Not surprising that they are spending the most money in the league on their player salaries.</p><p>It is important to notice the small amount of money Philadelphia is spending on player salaries. This is probably due to the fact that they are the worst team in the league for the past few years resulting in a roster full of new draft picks. Until these new draft picks get out of their rookie contracts(assuming they decide to resign with Philadelphia) and until the team improves their win record, Philadelphia will continue to spend far less than the other teams in the league.</p><p>It might be important to market this predictive model for the teams that are spending the most money on salaries for their players. Especially the teams who are spending a lot of money but are not seeing the success in winning games (Ex. New York Knicks)</p><h3><strong>Now lets begin modeling!</strong></h3><p>To start off, I set two variables. My target variable was Salary and my predictor variable was all the statistical categories. I then normalized all my predictor variables by using the sklearn.preprocessing.StandardScaler library. I used the sklearn.model_selection.train_test_split method to subset my data. 70% of my data was used as a training set and the remaining 30% was used as the test set. I ran 4 different regression models on my data; Linear, Lasso, Ridge, and ElasticNet regression.</p><h4>Linear regression is putting a very heavy weight on Points</h4><p>Although Points is definitely an important indicator of a player’s worth, it should not have so high of a weight that the other statistical categories are almost irrelevant.</p><p>Many would argue that the Points category is in fact the most important category for player statistics however for this model, I am looking for a predictor that is going to be more uniform with its weighting.</p><p>It is important to note the cross validated score of 0.47 however. Regardless of how I feel about the model, it is performing decently.</p><h4>Ridge regression has less variance in weighting of categories</h4><p>The ridge regression model puts a larger weight on Field Goals Made and Defensive Rebounds with Points scored being a close third coefficient.</p><p>The ridge model is using categories with weights that make sense intuitively. Defensive Rebounds, Field Goals Made, Points, All Rebounds, and Assists are the top 5 coefficients.</p><p>Since Rebounds, Assists, and Points are 3 of the 5 major categories in basketball, it makes sense that these three have high weights for predicting salary.</p><p>Also, it is important to note that the cross validated score of the Ridge model is 0.48 which is not significantly different than the Linear Regression Model. Both models have a cross validated score of about 0.36 on the test data set.</p><h4>Lasso regression model is zeroing out too many variables</h4><p>Although the lasso model is using three of the five major categories, it is zeroing out almost 40% of the categories. This is not ideal because the model is completely omitting some statistics that intuitively would be correlated with salary including Overall Rebounds and team specific statistical categories like percentage of total team rebounds and percentage of total team assists.</p><p>The lasso model is also performing very similar to the Linear Regression and Ridge models with a score of 0.49 and the test set is scoring consistent with the other two models as well with a score of 0.36.</p><h4>ElasticNet model is weighting the L1 ratio at 1.0.</h4><p>This 1.0 L1 ratio essentially makes the ElasticNet model the same as the Lasso Regression model.</p><h4>Lasso, Ridge, and Linear Regression Coefficients</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*NctyBxhN8nNC5VRP-AMUEA.png" /></figure><p>This plot is showing the weight that each model is putting on the different categories. The bar plot above has been masked to only show the categories where one of the models is weighting a category over 0.75. Categories with weights less than 0.75 are not shown.</p><h4>Regression Models summary:</h4><p>All four of the models are scoring around the same with a score of about 0.45.</p><p>The ridge regression model makes the most sense intuitively because it is weighting the statistical categories uniformly rather than putting a heavy weight on just one or two categories like the linear regression did.</p><p>Also the Ridge handles the multicollinearity of my dataset a lot better than the Lasso does. The ridge weights all the categories appropriately while the Lasso completely zeroes out almost half my predictors, many of which are important to consider when predicting salary.</p><h4>Residuals:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*7iJnT6EAmlOc8FHR9eJhtA.png" /></figure><h4>Residual Notes</h4><p>My residual plots are all pretty much the same considering my scores were all around the same as well.</p><p>The residuals are plotted in between -1 and 1 which is ideal. It indicates my model has little variance however it also leads me to question the bias of my model.</p><p>The residuals for my Lasso and ElasticNet are identical because the ElasticNet weighted 100% of its regression on the Lasso model.</p><h4><strong>Predicted Salary vs. Actual Salary</strong></h4><p>The training data set predicted salary with a Pearson R of 0.7 and the test data set predicted salary with a Pearson R of 0.66. Not a bad score but there is room for improvement in my model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/0*KkknvG_dJ_CqExYb." /><figcaption>Training Data: Pearson R = 0.7</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/0*Aa_KNrQUHJTXXgwr." /><figcaption>Test Data: Pearson R = 0.66</figcaption></figure><h3>Let’s take a closer look at the model!</h3><p>The model predicts Salary most accurately for players who were drafted within the past 5 years of their given year of salary. Model predicted worst for players who have been in the NBA for many years, are the face of their organization in some cases, and have outlier salaries compared to the rest of the NBA(Kobe Bryant, Amar’e Stoudemire).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/0*YFqS2fUyXQLGTgcV." /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/0*ueg1uRBv19hP0yLD." /></figure><h3>Next Steps…</h3><p>LOTS more data!!!</p><p>Create features for team market size, player popularity, player age, player consistency/variance, player injuries, years in the league.</p><p>Set rules for model that mirror NBA cap rules</p><p>Dive further into EDA</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=131046d48803" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>