Introduction:

In my current workplace, I do not get to use R to its fullest. The data I often receive is in Excel and with the macro’s that I have, I find it very simple to process the data within Excel. I use data like Stattleship, to teach myself the benefits of R. Without any formal training, I have put together a little document using the player data retrieved from Stattleship, using the script from Stattleship Github R. This is my attempt to determine if there is a causality between height and salary in the NBA.

During this exploration, I used the following methods:
1. Knitr and R markdown
2. GGplot
3. dplyr package
4. Connecting to Stattleship API datasource

Data discovery:

From NBA.com, the highest scorer in the 2015-16 regular season was Stephen Curry. According to the Stattleship database, he earns a salary of $11,370,786 USD.

The average height of players in the NBA is 78.82 inches and the average salary in the NBA is $3,478,939.

In comparison to Stephen Curry, if we look at the top 3 tallest players in the league, their salary is substantially less than Curry’s:

##                 name height humanized_salary
## 1   Boban Marjanovic     87        1,200,000
## 2       Tibor Pleiss     87        2,900,000
## 3 Kristaps Porzingis     87        4,131,720

Boxplot of playing position by height

We can see that the range of heights varies greatly amongst each position. As expected, the Center “C” position are the tallest players on the court.

Players height Vs salary

There appears to be a weak positive correlation between the players height vs salary.

Correlation test

## 
##  Pearson's product-moment correlation
## 
## data:  players_df$height and players_df$salary
## t = 1.913, df = 758, p-value = 0.05612
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.001806907  0.139744812
## sample estimates:
##        cor 
## 0.06931785

Using the cor.test, we can determine further that there is a weak correlation between the salary of NBA players and their height. The p value is 0.056 indicating that the result is not significant. The correlation between the datasets is 0.069.

Conclusion

The data presented above would suggest that although being taller is considered a strength for basketball players, there is no relationship between height and the salary that NBA players make. The next analysis to conduct is if avg points scored during a regular season correlates to salary earned by NBA players.

I am by no means data scientist, but love using R to explore any available data out there. Thank you so much for taking the time to review my work and feedback is always welcome.

Matthew Sluggett