if(!require(tidyverse)) install.packages("tidyverse")
## Loading required package: tidyverse
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.3.6 ✔ purrr 0.3.5
## ✔ tibble 3.1.8 ✔ dplyr 1.0.10
## ✔ tidyr 1.2.1 ✔ stringr 1.4.1
## ✔ readr 2.1.3 ✔ forcats 0.5.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
if(!require(sqldf)) install.packages("sqldf")
## Loading required package: sqldf
## Loading required package: gsubfn
## Loading required package: proto
## Warning in doTryCatch(return(expr), name, parentenv, handler): unable to load shared object '/Library/Frameworks/R.framework/Resources/modules//R_X11.so':
## dlopen(/Library/Frameworks/R.framework/Resources/modules//R_X11.so, 0x0006): Library not loaded: /opt/X11/lib/libSM.6.dylib
## Referenced from: <FF564E7B-F7DD-3BAE-972C-DE65F8735FC9> /Library/Frameworks/R.framework/Versions/4.2/Resources/modules/R_X11.so
## Reason: tried: '/opt/X11/lib/libSM.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/X11/lib/libSM.6.dylib' (no such file), '/opt/X11/lib/libSM.6.dylib' (no such file), '/Library/Frameworks/R.framework/Resources/lib/libSM.6.dylib' (no such file), '/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/jre/lib/server/libSM.6.dylib' (no such file)
## Warning in system2("/usr/bin/otool", c("-L", shQuote(DSO)), stdout = TRUE):
## running command ''/usr/bin/otool' -L '/Library/Frameworks/R.framework/Resources/
## library/tcltk/libs//tcltk.so'' had status 1
## Could not load tcltk. Will use slower R code instead.
## Loading required package: RSQLite
library(tidyverse)
library(sqldf)
Read the CSV files
players <- read.csv("/Users/devyanimardia/Downloads/datadavis-nba-salaries/players.csv")
salaries <- read.csv("/Users/devyanimardia/Downloads/datadavis-nba-salaries/salaries_1985to2018.csv")
Joining both datasets with player_id into salaries dataset
salaries <- salaries %>% inner_join(players, by = c("player_id" = "X_id"))
Age, Height and Weight changes to make it easily usable
#Age at end of season
salaries$birthDate <- sub(",","", salaries$birthDate)
salaries$birthDate <- as.Date(salaries$birthDate,
format = "%B %d %Y")
salaries$Current_age = as.numeric(difftime(Sys.Date(),salaries$birthDate, units = "weeks"))/52.25
salaries$AgeatSeasonEnd= as.integer(salaries$Current_age - (2022- salaries$season_end))
#Weight
salaries$weight <- as.numeric(sub("lb","", salaries$weight))
#Height
salaries$height = as.character(sub("-",".", salaries$height))
salaries <- salaries %>% separate(height, c('Feet', 'Inch'))
salaries$heightincm <- as.numeric(salaries$Feet)*30.48 + as.numeric(salaries$Inch)*2.54
head(salaries)
Converting to numeric for better usage
salaries$career_FG3. <- as.numeric(salaries$career_FG3.)
## Warning: NAs introduced by coercion
salaries$career_FG. <- as.numeric(salaries$career_FG.)
## Warning: NAs introduced by coercion
salaries$career_FT. <- as.numeric(salaries$career_FT.)
## Warning: NAs introduced by coercion
salaries$career_PER <- as.numeric(salaries$career_PER)
## Warning: NAs introduced by coercion
salaries$career_TRB <- as.numeric(salaries$career_TRB)
salaries$career_WS <- as.numeric(salaries$career_WS)
salaries$career_eFG. <- as.numeric(salaries$career_eFG.)
## Warning: NAs introduced by coercion
salaries$heightincm <- as.numeric(salaries$heightincm)
Variable name changes and slicing the salaries csv to only get the variables important for us
experimentwithseason <- salaries[c("player_id","heightincm", "weight","season_end", "AgeatSeasonEnd","team","career_AST","career_PTS","career_FG.","career_FG3.","position","shoots","salary","career_FT.","career_G","career_PER","career_TRB","career_WS","career_eFG.")]
names(experimentwithseason) = c("id","height", "weight","season_end", "AgeatSeasonEnd","team","Assits","Points","FieldGoals","FieldGoals3","position","shoots","salary","FreeThrows","Games","PlayerEfficiencyRating","TotalRebounds","WinShares","effectiveFieldGoal")
Factorize categorical variables
experimentwithseason$team.f <- factor(experimentwithseason$team)
is.factor(experimentwithseason$team.f)
## [1] TRUE
experimentwithseason$shoots.f <- factor(experimentwithseason$shoots)
is.factor(experimentwithseason$shoots.f)
## [1] TRUE
experimentwithseason$position.f <- factor(experimentwithseason$position)
is.factor(experimentwithseason$position.f)
## [1] TRUE
Creating 2015 dataframe and removing unwanted columns
df_2015 = subset(experimentwithseason, season_end == 2015)
which(is.na(df_2015))
## [1] 4390 4391 4895 4907 4933 4934 4937 5046 5167 5177 5181 5229 5253 5277 5289
## [16] 5294 5303 5304 5361 5392 7086 7105 7106 7109 7184 7428 7429 7577 9820 9821
sum(is.na(df_2015))
## [1] 30
df_2015 = subset(df_2015, season_end == 2015,select = -c(team,shoots,position))
names(df_2015) = c("id","height", "weight","season_end", "AgeatSeasonEnd","Assits","Points","FieldGoals","FieldGoals3","salary","FreeThrows","Games","PlayerEfficiencyRating","TotalRebounds","WinShares","effectiveFieldGoal","team","shoots","position")
df_2015 <- sqldf('select weight, height, AgeatSeasonEnd, team, Assits, FieldGoals, FieldGoals3, position, shoots, FreeThrows, Games, PlayerEfficiencyRating, TotalRebounds, WinShares, effectiveFieldGoal, Points, salary from experimentwithseason where season_end == 2015 group by id')
str(df_2015)
## 'data.frame': 507 obs. of 17 variables:
## $ weight : num 240 209 265 245 210 248 240 250 260 260 ...
## $ height : num 201 196 213 201 196 ...
## $ AgeatSeasonEnd : int 25 21 22 29 30 27 24 27 30 26 ...
## $ team : chr "New York Knicks" "Memphis Grizzlies" "Oklahoma City Thunder" "Houston Rockets" ...
## $ Assits : num 0.6 0.6 1 0.7 1.8 0.5 0.7 0.5 2 1 ...
## $ FieldGoals : num 44.4 40.2 58.8 47.4 45 50.3 51.3 52.7 49.1 47.1 ...
## $ FieldGoals3 : num 35 38.5 0 0 38.6 28.6 0 NA 28.3 13.3 ...
## $ position : chr "Power Forward and Small Forward" "Shooting Guard" "Center" "Power Forward" ...
## $ shoots : chr "Right" "Right" "Right" "Right" ...
## $ FreeThrows : num 75.9 60.7 55.3 62.8 82.5 79.7 48.1 73.8 81 68.2 ...
## $ Games : int 337 32 467 153 762 293 41 339 950 388 ...
## $ PlayerEfficiencyRating: num 11.2 13.1 16.7 15 11.9 14.9 12 16.6 20.9 12.5 ...
## $ TotalRebounds : num 3.5 0.9 7.4 4.3 2.9 3.9 4.3 3.3 8.4 4.8 ...
## $ WinShares : num 8.7 0.4 38.7 4.4 33.5 7.5 1.4 9.6 107 13.8 ...
## $ effectiveFieldGoal : num 51.3 45.7 58.8 47.4 51.4 50.7 51.3 52.7 49.5 47.2 ...
## $ Points : num 4.9 3.2 9.7 4.6 10.8 5.3 2.3 3.1 19.6 4.8 ...
## $ salary : int 915243 1344120 2184960 981084 7750000 981084 3000000 981084 16006000 948163 ...
head(df_2015)
Fitting an initial model with no changes
str(df_2015)
## 'data.frame': 507 obs. of 17 variables:
## $ weight : num 240 209 265 245 210 248 240 250 260 260 ...
## $ height : num 201 196 213 201 196 ...
## $ AgeatSeasonEnd : int 25 21 22 29 30 27 24 27 30 26 ...
## $ team : chr "New York Knicks" "Memphis Grizzlies" "Oklahoma City Thunder" "Houston Rockets" ...
## $ Assits : num 0.6 0.6 1 0.7 1.8 0.5 0.7 0.5 2 1 ...
## $ FieldGoals : num 44.4 40.2 58.8 47.4 45 50.3 51.3 52.7 49.1 47.1 ...
## $ FieldGoals3 : num 35 38.5 0 0 38.6 28.6 0 NA 28.3 13.3 ...
## $ position : chr "Power Forward and Small Forward" "Shooting Guard" "Center" "Power Forward" ...
## $ shoots : chr "Right" "Right" "Right" "Right" ...
## $ FreeThrows : num 75.9 60.7 55.3 62.8 82.5 79.7 48.1 73.8 81 68.2 ...
## $ Games : int 337 32 467 153 762 293 41 339 950 388 ...
## $ PlayerEfficiencyRating: num 11.2 13.1 16.7 15 11.9 14.9 12 16.6 20.9 12.5 ...
## $ TotalRebounds : num 3.5 0.9 7.4 4.3 2.9 3.9 4.3 3.3 8.4 4.8 ...
## $ WinShares : num 8.7 0.4 38.7 4.4 33.5 7.5 1.4 9.6 107 13.8 ...
## $ effectiveFieldGoal : num 51.3 45.7 58.8 47.4 51.4 50.7 51.3 52.7 49.5 47.2 ...
## $ Points : num 4.9 3.2 9.7 4.6 10.8 5.3 2.3 3.1 19.6 4.8 ...
## $ salary : int 915243 1344120 2184960 981084 7750000 981084 3000000 981084 16006000 948163 ...
model1 = lm(salary ~ ., data=df_2015)
summary(model1)
##
## Call:
## lm(formula = salary ~ ., data = df_2015)
##
## Residuals:
## Min 1Q Median 3Q Max
## -9779786 -1665209 -50222 1438045 10905494
##
## Coefficients:
## Estimate
## (Intercept) -11166159
## weight 30708
## height 33011
## AgeatSeasonEnd -19022
## teamBoston Celtics 716008
## teamBrooklyn Nets 2668154
## teamCharlotte Hornets 1257801
## teamChicago Bulls -99874
## teamCleveland Cavaliers 214673
## teamDallas Mavericks 111587
## teamDenver Nuggets 307124
## teamDetroit Pistons 346617
## teamGolden State Warriors 232712
## teamHouston Rockets 982838
## teamIndiana Pacers 1948350
## teamLos Angeles Clippers 671584
## teamLos Angeles Lakers 133088
## teamMemphis Grizzlies 1050545
## teamMiami Heat 1067486
## teamMilwaukee Bucks -190936
## teamMinnesota Timberwolves 339311
## teamNew Orleans Pelicans 1658975
## teamNew York Knicks 1990598
## teamOklahoma City Thunder 523926
## teamOrlando Magic -894234
## teamPhiladelphia 76ers 19084
## teamPhoenix Suns 626538
## teamPortland Trail Blazers 1141030
## teamSacramento Kings 1383266
## teamSan Antonio Spurs -181306
## teamToronto Raptors 886991
## teamUtah Jazz 1596699
## teamWashington Wizards 422441
## Assits 583568
## FieldGoals 94742
## FieldGoals3 -6133
## positionCenter and Power Forward 1418635
## positionCenter and Small Forward and Power Forward 2064067
## positionPoint Guard 1108058
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard -6629662
## positionPoint Guard and Shooting Guard -549611
## positionPoint Guard and Small Forward and Shooting Guard 308177
## positionPower Forward 547273
## positionPower Forward and Center 1292144
## positionPower Forward and Center and Small Forward 3121614
## positionPower Forward and Shooting Guard 1270919
## positionPower Forward and Small Forward -33912
## positionPower Forward and Small Forward and Shooting Guard 4092005
## positionShooting Guard 870902
## positionShooting Guard and Point Guard 581789
## positionShooting Guard and Small Forward 778298
## positionShooting Guard and Small Forward and Point Guard -616390
## positionShooting Guard and Small Forward and Power Forward 1003393
## positionSmall Forward 342402
## positionSmall Forward and Center and Power Forward 336255
## positionSmall Forward and Power Forward 392572
## positionSmall Forward and Power Forward and Shooting Guard 1210754
## positionSmall Forward and Shooting Guard 376919
## positionSmall Forward and Shooting Guard and Point Guard 278062
## positionSmall Forward and Shooting Guard and Power Forward 1892094
## shootsLeft Right -610988
## shootsRight -197707
## FreeThrows -23125
## Games 1445
## PlayerEfficiencyRating -98834
## TotalRebounds -86701
## WinShares 38964
## effectiveFieldGoal -110751
## Points 358095
## Std. Error
## (Intercept) 10383475
## weight 13470
## height 46211
## AgeatSeasonEnd 57890
## teamBoston Celtics 1193930
## teamBrooklyn Nets 1267861
## teamCharlotte Hornets 1188615
## teamChicago Bulls 1218677
## teamCleveland Cavaliers 1355795
## teamDallas Mavericks 1191710
## teamDenver Nuggets 1211081
## teamDetroit Pistons 1267789
## teamGolden State Warriors 1266270
## teamHouston Rockets 1210482
## teamIndiana Pacers 1274453
## teamLos Angeles Clippers 1229263
## teamLos Angeles Lakers 1200048
## teamMemphis Grizzlies 1239401
## teamMiami Heat 1221341
## teamMilwaukee Bucks 1255821
## teamMinnesota Timberwolves 1327563
## teamNew Orleans Pelicans 1223552
## teamNew York Knicks 1237423
## teamOklahoma City Thunder 1225569
## teamOrlando Magic 1167229
## teamPhiladelphia 76ers 1133940
## teamPhoenix Suns 1163525
## teamPortland Trail Blazers 1212280
## teamSacramento Kings 1244611
## teamSan Antonio Spurs 1246316
## teamToronto Raptors 1208188
## teamUtah Jazz 1222683
## teamWashington Wizards 1271318
## Assits 189318
## FieldGoals 85455
## FieldGoals3 19024
## positionCenter and Power Forward 812616
## positionCenter and Small Forward and Power Forward 3478234
## positionPoint Guard 1767650
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard 3487695
## positionPoint Guard and Shooting Guard 1622457
## positionPoint Guard and Small Forward and Shooting Guard 3679533
## positionPower Forward 842018
## positionPower Forward and Center 758003
## positionPower Forward and Center and Small Forward 2517763
## positionPower Forward and Shooting Guard 3541787
## positionPower Forward and Small Forward 1119667
## positionPower Forward and Small Forward and Shooting Guard 3612898
## positionShooting Guard 1402218
## positionShooting Guard and Point Guard 1591897
## positionShooting Guard and Small Forward 1293357
## positionShooting Guard and Small Forward and Point Guard 2272629
## positionShooting Guard and Small Forward and Power Forward 2682385
## positionSmall Forward 1127401
## positionSmall Forward and Center and Power Forward 2124698
## positionSmall Forward and Power Forward 1114855
## positionSmall Forward and Power Forward and Shooting Guard 2681818
## positionSmall Forward and Shooting Guard 1275106
## positionSmall Forward and Shooting Guard and Point Guard 2655741
## positionSmall Forward and Shooting Guard and Power Forward 1945017
## shootsLeft Right 3568170
## shootsRight 585882
## FreeThrows 24111
## Games 1200
## PlayerEfficiencyRating 106610
## TotalRebounds 155289
## WinShares 11141
## effectiveFieldGoal 73829
## Points 81429
## t value
## (Intercept) -1.075
## weight 2.280
## height 0.714
## AgeatSeasonEnd -0.329
## teamBoston Celtics 0.600
## teamBrooklyn Nets 2.104
## teamCharlotte Hornets 1.058
## teamChicago Bulls -0.082
## teamCleveland Cavaliers 0.158
## teamDallas Mavericks 0.094
## teamDenver Nuggets 0.254
## teamDetroit Pistons 0.273
## teamGolden State Warriors 0.184
## teamHouston Rockets 0.812
## teamIndiana Pacers 1.529
## teamLos Angeles Clippers 0.546
## teamLos Angeles Lakers 0.111
## teamMemphis Grizzlies 0.848
## teamMiami Heat 0.874
## teamMilwaukee Bucks -0.152
## teamMinnesota Timberwolves 0.256
## teamNew Orleans Pelicans 1.356
## teamNew York Knicks 1.609
## teamOklahoma City Thunder 0.427
## teamOrlando Magic -0.766
## teamPhiladelphia 76ers 0.017
## teamPhoenix Suns 0.538
## teamPortland Trail Blazers 0.941
## teamSacramento Kings 1.111
## teamSan Antonio Spurs -0.145
## teamToronto Raptors 0.734
## teamUtah Jazz 1.306
## teamWashington Wizards 0.332
## Assits 3.082
## FieldGoals 1.109
## FieldGoals3 -0.322
## positionCenter and Power Forward 1.746
## positionCenter and Small Forward and Power Forward 0.593
## positionPoint Guard 0.627
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard -1.901
## positionPoint Guard and Shooting Guard -0.339
## positionPoint Guard and Small Forward and Shooting Guard 0.084
## positionPower Forward 0.650
## positionPower Forward and Center 1.705
## positionPower Forward and Center and Small Forward 1.240
## positionPower Forward and Shooting Guard 0.359
## positionPower Forward and Small Forward -0.030
## positionPower Forward and Small Forward and Shooting Guard 1.133
## positionShooting Guard 0.621
## positionShooting Guard and Point Guard 0.365
## positionShooting Guard and Small Forward 0.602
## positionShooting Guard and Small Forward and Point Guard -0.271
## positionShooting Guard and Small Forward and Power Forward 0.374
## positionSmall Forward 0.304
## positionSmall Forward and Center and Power Forward 0.158
## positionSmall Forward and Power Forward 0.352
## positionSmall Forward and Power Forward and Shooting Guard 0.451
## positionSmall Forward and Shooting Guard 0.296
## positionSmall Forward and Shooting Guard and Point Guard 0.105
## positionSmall Forward and Shooting Guard and Power Forward 0.973
## shootsLeft Right -0.171
## shootsRight -0.337
## FreeThrows -0.959
## Games 1.204
## PlayerEfficiencyRating -0.927
## TotalRebounds -0.558
## WinShares 3.497
## effectiveFieldGoal -1.500
## Points 4.398
## Pr(>|t|)
## (Intercept) 0.282827
## weight 0.023131
## height 0.475409
## AgeatSeasonEnd 0.742639
## teamBoston Celtics 0.549028
## teamBrooklyn Nets 0.035937
## teamCharlotte Hornets 0.290574
## teamChicago Bulls 0.934724
## teamCleveland Cavaliers 0.874268
## teamDallas Mavericks 0.925443
## teamDenver Nuggets 0.799934
## teamDetroit Pistons 0.784679
## teamGolden State Warriors 0.854277
## teamHouston Rockets 0.417289
## teamIndiana Pacers 0.127079
## teamLos Angeles Clippers 0.585131
## teamLos Angeles Lakers 0.911747
## teamMemphis Grizzlies 0.397134
## teamMiami Heat 0.382606
## teamMilwaukee Bucks 0.879228
## teamMinnesota Timberwolves 0.798394
## teamNew Orleans Pelicans 0.175875
## teamNew York Knicks 0.108447
## teamOklahoma City Thunder 0.669239
## teamOrlando Magic 0.444040
## teamPhiladelphia 76ers 0.986581
## teamPhoenix Suns 0.590531
## teamPortland Trail Blazers 0.347134
## teamSacramento Kings 0.267035
## teamSan Antonio Spurs 0.884407
## teamToronto Raptors 0.463270
## teamUtah Jazz 0.192307
## teamWashington Wizards 0.739840
## Assits 0.002189
## FieldGoals 0.268213
## FieldGoals3 0.747313
## positionCenter and Power Forward 0.081589
## positionCenter and Small Forward and Power Forward 0.553219
## positionPoint Guard 0.531098
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard 0.058008
## positionPoint Guard and Shooting Guard 0.734967
## positionPoint Guard and Small Forward and Shooting Guard 0.933292
## positionPower Forward 0.516080
## positionPower Forward and Center 0.089001
## positionPower Forward and Center and Small Forward 0.215733
## positionPower Forward and Shooting Guard 0.719900
## positionPower Forward and Small Forward 0.975853
## positionPower Forward and Small Forward and Shooting Guard 0.258029
## positionShooting Guard 0.534881
## positionShooting Guard and Point Guard 0.714946
## positionShooting Guard and Small Forward 0.547657
## positionShooting Guard and Small Forward and Point Guard 0.786353
## positionShooting Guard and Small Forward and Power Forward 0.708544
## positionSmall Forward 0.761501
## positionSmall Forward and Center and Power Forward 0.874328
## positionSmall Forward and Power Forward 0.724920
## positionSmall Forward and Power Forward and Shooting Guard 0.651887
## positionSmall Forward and Shooting Guard 0.767684
## positionSmall Forward and Shooting Guard and Point Guard 0.916663
## positionSmall Forward and Shooting Guard and Power Forward 0.331221
## shootsLeft Right 0.864124
## shootsRight 0.735947
## FreeThrows 0.338055
## Games 0.229168
## PlayerEfficiencyRating 0.354432
## TotalRebounds 0.576925
## WinShares 0.000521
## effectiveFieldGoal 0.134344
## Points 1.39e-05
##
## (Intercept)
## weight *
## height
## AgeatSeasonEnd
## teamBoston Celtics
## teamBrooklyn Nets *
## teamCharlotte Hornets
## teamChicago Bulls
## teamCleveland Cavaliers
## teamDallas Mavericks
## teamDenver Nuggets
## teamDetroit Pistons
## teamGolden State Warriors
## teamHouston Rockets
## teamIndiana Pacers
## teamLos Angeles Clippers
## teamLos Angeles Lakers
## teamMemphis Grizzlies
## teamMiami Heat
## teamMilwaukee Bucks
## teamMinnesota Timberwolves
## teamNew Orleans Pelicans
## teamNew York Knicks
## teamOklahoma City Thunder
## teamOrlando Magic
## teamPhiladelphia 76ers
## teamPhoenix Suns
## teamPortland Trail Blazers
## teamSacramento Kings
## teamSan Antonio Spurs
## teamToronto Raptors
## teamUtah Jazz
## teamWashington Wizards
## Assits **
## FieldGoals
## FieldGoals3
## positionCenter and Power Forward .
## positionCenter and Small Forward and Power Forward
## positionPoint Guard
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard .
## positionPoint Guard and Shooting Guard
## positionPoint Guard and Small Forward and Shooting Guard
## positionPower Forward
## positionPower Forward and Center .
## positionPower Forward and Center and Small Forward
## positionPower Forward and Shooting Guard
## positionPower Forward and Small Forward
## positionPower Forward and Small Forward and Shooting Guard
## positionShooting Guard
## positionShooting Guard and Point Guard
## positionShooting Guard and Small Forward
## positionShooting Guard and Small Forward and Point Guard
## positionShooting Guard and Small Forward and Power Forward
## positionSmall Forward
## positionSmall Forward and Center and Power Forward
## positionSmall Forward and Power Forward
## positionSmall Forward and Power Forward and Shooting Guard
## positionSmall Forward and Shooting Guard
## positionSmall Forward and Shooting Guard and Point Guard
## positionSmall Forward and Shooting Guard and Power Forward
## shootsLeft Right
## shootsRight
## FreeThrows
## Games
## PlayerEfficiencyRating
## TotalRebounds
## WinShares ***
## effectiveFieldGoal
## Points ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3285000 on 417 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.5911, Adjusted R-squared: 0.5244
## F-statistic: 8.865 on 68 and 417 DF, p-value: < 2.2e-16
plot(model1)
## Warning: not plotting observations with leverage one:
## 17, 117, 130, 243, 432, 441
library(MASS)
##
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
##
## select
lambda = 0.303
box_cox = boxcox(model1)
#lambda= box_cox$x[which.max(box_cox$y)]
#lambda
modeltest1 = lm(((salary^lambda-1)/lambda)~., df_2015)
summary(modeltest1)
##
## Call:
## lm(formula = ((salary^lambda - 1)/lambda) ~ ., data = df_2015)
##
## Residuals:
## Min 1Q Median 3Q Max
## -196.21 -44.05 0.00 46.41 193.76
##
## Coefficients:
## Estimate
## (Intercept) -350.10267
## weight 0.75753
## height 1.96992
## AgeatSeasonEnd -2.77617
## teamBoston Celtics 33.17537
## teamBrooklyn Nets 31.82344
## teamCharlotte Hornets 37.85998
## teamChicago Bulls -9.66413
## teamCleveland Cavaliers 3.40872
## teamDallas Mavericks -15.63120
## teamDenver Nuggets 7.55292
## teamDetroit Pistons 4.81536
## teamGolden State Warriors -8.17402
## teamHouston Rockets 21.83730
## teamIndiana Pacers 33.78133
## teamLos Angeles Clippers -9.91898
## teamLos Angeles Lakers -21.42317
## teamMemphis Grizzlies 3.64161
## teamMiami Heat 10.49132
## teamMilwaukee Bucks -8.38764
## teamMinnesota Timberwolves 26.63895
## teamNew Orleans Pelicans 20.61840
## teamNew York Knicks 14.70361
## teamOklahoma City Thunder 12.55933
## teamOrlando Magic -21.39612
## teamPhiladelphia 76ers -3.96884
## teamPhoenix Suns 8.71119
## teamPortland Trail Blazers 26.17191
## teamSacramento Kings 17.78407
## teamSan Antonio Spurs 1.85524
## teamToronto Raptors 27.49008
## teamUtah Jazz 21.18642
## teamWashington Wizards 10.72652
## Assits 15.42526
## FieldGoals 1.75249
## FieldGoals3 -0.30718
## positionCenter and Power Forward 34.85256
## positionCenter and Small Forward and Power Forward 41.54685
## positionPoint Guard 46.19581
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard -123.31253
## positionPoint Guard and Shooting Guard 13.01583
## positionPoint Guard and Small Forward and Shooting Guard -0.99328
## positionPower Forward 24.48598
## positionPower Forward and Center 31.63963
## positionPower Forward and Center and Small Forward 60.52915
## positionPower Forward and Shooting Guard 10.29849
## positionPower Forward and Small Forward 1.31898
## positionPower Forward and Small Forward and Shooting Guard 58.45981
## positionShooting Guard 49.09958
## positionShooting Guard and Point Guard 33.04816
## positionShooting Guard and Small Forward 29.52120
## positionShooting Guard and Small Forward and Point Guard 11.97087
## positionShooting Guard and Small Forward and Power Forward 27.28612
## positionSmall Forward 21.50204
## positionSmall Forward and Center and Power Forward 20.48759
## positionSmall Forward and Power Forward 23.28404
## positionSmall Forward and Power Forward and Shooting Guard 45.83574
## positionSmall Forward and Shooting Guard 19.76949
## positionSmall Forward and Shooting Guard and Point Guard 9.80677
## positionSmall Forward and Shooting Guard and Power Forward 67.14318
## shootsLeft Right 10.08117
## shootsRight -8.71774
## FreeThrows -0.23849
## Games 0.17383
## PlayerEfficiencyRating 0.08109
## TotalRebounds -1.80576
## WinShares -0.16629
## effectiveFieldGoal -1.71779
## Points 6.11097
## Std. Error
## (Intercept) 225.41038
## weight 0.29242
## height 1.00318
## AgeatSeasonEnd 1.25671
## teamBoston Celtics 25.91852
## teamBrooklyn Nets 27.52344
## teamCharlotte Hornets 25.80313
## teamChicago Bulls 26.45574
## teamCleveland Cavaliers 29.43238
## teamDallas Mavericks 25.87032
## teamDenver Nuggets 26.29085
## teamDetroit Pistons 27.52188
## teamGolden State Warriors 27.48891
## teamHouston Rockets 26.27783
## teamIndiana Pacers 27.66656
## teamLos Angeles Clippers 26.68553
## teamLos Angeles Lakers 26.05132
## teamMemphis Grizzlies 26.90563
## teamMiami Heat 26.51357
## teamMilwaukee Bucks 27.26208
## teamMinnesota Timberwolves 28.81949
## teamNew Orleans Pelicans 26.56157
## teamNew York Knicks 26.86269
## teamOklahoma City Thunder 26.60535
## teamOrlando Magic 25.33888
## teamPhiladelphia 76ers 24.61622
## teamPhoenix Suns 25.25846
## teamPortland Trail Blazers 26.31687
## teamSacramento Kings 27.01872
## teamSan Antonio Spurs 27.05573
## teamToronto Raptors 26.22803
## teamUtah Jazz 26.54270
## teamWashington Wizards 27.59849
## Assits 4.10983
## FieldGoals 1.85512
## FieldGoals3 0.41299
## positionCenter and Power Forward 17.64074
## positionCenter and Small Forward and Power Forward 75.50749
## positionPoint Guard 38.37316
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard 75.71287
## positionPoint Guard and Shooting Guard 35.22122
## positionPoint Guard and Small Forward and Shooting Guard 79.87739
## positionPower Forward 18.27900
## positionPower Forward and Center 16.45517
## positionPower Forward and Center and Small Forward 54.65703
## positionPower Forward and Shooting Guard 76.88713
## positionPower Forward and Small Forward 24.30637
## positionPower Forward and Small Forward and Shooting Guard 78.43084
## positionShooting Guard 30.44015
## positionShooting Guard and Point Guard 34.55780
## positionShooting Guard and Small Forward 28.07692
## positionShooting Guard and Small Forward and Point Guard 49.33553
## positionShooting Guard and Small Forward and Power Forward 58.23075
## positionSmall Forward 24.47425
## positionSmall Forward and Center and Power Forward 46.12416
## positionSmall Forward and Power Forward 24.20191
## positionSmall Forward and Power Forward and Shooting Guard 58.21844
## positionSmall Forward and Shooting Guard 27.68073
## positionSmall Forward and Shooting Guard and Point Guard 57.65233
## positionSmall Forward and Shooting Guard and Power Forward 42.22353
## shootsLeft Right 77.45987
## shootsRight 12.71866
## FreeThrows 0.52341
## Games 0.02605
## PlayerEfficiencyRating 2.31436
## TotalRebounds 3.37110
## WinShares 0.24186
## effectiveFieldGoal 1.60272
## Points 1.76771
## t value
## (Intercept) -1.553
## weight 2.591
## height 1.964
## AgeatSeasonEnd -2.209
## teamBoston Celtics 1.280
## teamBrooklyn Nets 1.156
## teamCharlotte Hornets 1.467
## teamChicago Bulls -0.365
## teamCleveland Cavaliers 0.116
## teamDallas Mavericks -0.604
## teamDenver Nuggets 0.287
## teamDetroit Pistons 0.175
## teamGolden State Warriors -0.297
## teamHouston Rockets 0.831
## teamIndiana Pacers 1.221
## teamLos Angeles Clippers -0.372
## teamLos Angeles Lakers -0.822
## teamMemphis Grizzlies 0.135
## teamMiami Heat 0.396
## teamMilwaukee Bucks -0.308
## teamMinnesota Timberwolves 0.924
## teamNew Orleans Pelicans 0.776
## teamNew York Knicks 0.547
## teamOklahoma City Thunder 0.472
## teamOrlando Magic -0.844
## teamPhiladelphia 76ers -0.161
## teamPhoenix Suns 0.345
## teamPortland Trail Blazers 0.994
## teamSacramento Kings 0.658
## teamSan Antonio Spurs 0.069
## teamToronto Raptors 1.048
## teamUtah Jazz 0.798
## teamWashington Wizards 0.389
## Assits 3.753
## FieldGoals 0.945
## FieldGoals3 -0.744
## positionCenter and Power Forward 1.976
## positionCenter and Small Forward and Power Forward 0.550
## positionPoint Guard 1.204
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard -1.629
## positionPoint Guard and Shooting Guard 0.370
## positionPoint Guard and Small Forward and Shooting Guard -0.012
## positionPower Forward 1.340
## positionPower Forward and Center 1.923
## positionPower Forward and Center and Small Forward 1.107
## positionPower Forward and Shooting Guard 0.134
## positionPower Forward and Small Forward 0.054
## positionPower Forward and Small Forward and Shooting Guard 0.745
## positionShooting Guard 1.613
## positionShooting Guard and Point Guard 0.956
## positionShooting Guard and Small Forward 1.051
## positionShooting Guard and Small Forward and Point Guard 0.243
## positionShooting Guard and Small Forward and Power Forward 0.469
## positionSmall Forward 0.879
## positionSmall Forward and Center and Power Forward 0.444
## positionSmall Forward and Power Forward 0.962
## positionSmall Forward and Power Forward and Shooting Guard 0.787
## positionSmall Forward and Shooting Guard 0.714
## positionSmall Forward and Shooting Guard and Point Guard 0.170
## positionSmall Forward and Shooting Guard and Power Forward 1.590
## shootsLeft Right 0.130
## shootsRight -0.685
## FreeThrows -0.456
## Games 6.672
## PlayerEfficiencyRating 0.035
## TotalRebounds -0.536
## WinShares -0.688
## effectiveFieldGoal -1.072
## Points 3.457
## Pr(>|t|)
## (Intercept) 0.121139
## weight 0.009918
## height 0.050231
## AgeatSeasonEnd 0.027713
## teamBoston Celtics 0.201261
## teamBrooklyn Nets 0.248249
## teamCharlotte Hornets 0.143058
## teamChicago Bulls 0.715077
## teamCleveland Cavaliers 0.907855
## teamDallas Mavericks 0.546030
## teamDenver Nuggets 0.774038
## teamDetroit Pistons 0.861192
## teamGolden State Warriors 0.766342
## teamHouston Rockets 0.406440
## teamIndiana Pacers 0.222770
## teamLos Angeles Clippers 0.710306
## teamLos Angeles Lakers 0.411351
## teamMemphis Grizzlies 0.892403
## teamMiami Heat 0.692532
## teamMilwaukee Bucks 0.758489
## teamMinnesota Timberwolves 0.355845
## teamNew Orleans Pelicans 0.438042
## teamNew York Knicks 0.584423
## teamOklahoma City Thunder 0.637131
## teamOrlando Magic 0.398931
## teamPhiladelphia 76ers 0.871991
## teamPhoenix Suns 0.730357
## teamPortland Trail Blazers 0.320560
## teamSacramento Kings 0.510764
## teamSan Antonio Spurs 0.945364
## teamToronto Raptors 0.295191
## teamUtah Jazz 0.425208
## teamWashington Wizards 0.697724
## Assits 0.000199
## FieldGoals 0.345368
## FieldGoals3 0.457424
## positionCenter and Power Forward 0.048849
## positionCenter and Small Forward and Power Forward 0.582453
## positionPoint Guard 0.229328
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard 0.104135
## positionPoint Guard and Shooting Guard 0.711909
## positionPoint Guard and Small Forward and Shooting Guard 0.990084
## positionPower Forward 0.181115
## positionPower Forward and Center 0.055189
## positionPower Forward and Center and Small Forward 0.268744
## positionPower Forward and Shooting Guard 0.893512
## positionPower Forward and Small Forward 0.956750
## positionPower Forward and Small Forward and Shooting Guard 0.456469
## positionShooting Guard 0.107504
## positionShooting Guard and Point Guard 0.339467
## positionShooting Guard and Small Forward 0.293666
## positionShooting Guard and Small Forward and Point Guard 0.808402
## positionShooting Guard and Small Forward and Power Forward 0.639610
## positionSmall Forward 0.380147
## positionSmall Forward and Center and Power Forward 0.657140
## positionSmall Forward and Power Forward 0.336570
## positionSmall Forward and Power Forward and Shooting Guard 0.431550
## positionSmall Forward and Shooting Guard 0.475505
## positionSmall Forward and Shooting Guard and Point Guard 0.865013
## positionSmall Forward and Shooting Guard and Power Forward 0.112551
## shootsLeft Right 0.896513
## shootsRight 0.493454
## FreeThrows 0.648879
## Games 8.02e-11
## PlayerEfficiencyRating 0.972065
## TotalRebounds 0.592479
## WinShares 0.492125
## effectiveFieldGoal 0.284429
## Points 0.000602
##
## (Intercept)
## weight **
## height .
## AgeatSeasonEnd *
## teamBoston Celtics
## teamBrooklyn Nets
## teamCharlotte Hornets
## teamChicago Bulls
## teamCleveland Cavaliers
## teamDallas Mavericks
## teamDenver Nuggets
## teamDetroit Pistons
## teamGolden State Warriors
## teamHouston Rockets
## teamIndiana Pacers
## teamLos Angeles Clippers
## teamLos Angeles Lakers
## teamMemphis Grizzlies
## teamMiami Heat
## teamMilwaukee Bucks
## teamMinnesota Timberwolves
## teamNew Orleans Pelicans
## teamNew York Knicks
## teamOklahoma City Thunder
## teamOrlando Magic
## teamPhiladelphia 76ers
## teamPhoenix Suns
## teamPortland Trail Blazers
## teamSacramento Kings
## teamSan Antonio Spurs
## teamToronto Raptors
## teamUtah Jazz
## teamWashington Wizards
## Assits ***
## FieldGoals
## FieldGoals3
## positionCenter and Power Forward *
## positionCenter and Small Forward and Power Forward
## positionPoint Guard
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard
## positionPoint Guard and Shooting Guard
## positionPoint Guard and Small Forward and Shooting Guard
## positionPower Forward
## positionPower Forward and Center .
## positionPower Forward and Center and Small Forward
## positionPower Forward and Shooting Guard
## positionPower Forward and Small Forward
## positionPower Forward and Small Forward and Shooting Guard
## positionShooting Guard
## positionShooting Guard and Point Guard
## positionShooting Guard and Small Forward
## positionShooting Guard and Small Forward and Point Guard
## positionShooting Guard and Small Forward and Power Forward
## positionSmall Forward
## positionSmall Forward and Center and Power Forward
## positionSmall Forward and Power Forward
## positionSmall Forward and Power Forward and Shooting Guard
## positionSmall Forward and Shooting Guard
## positionSmall Forward and Shooting Guard and Point Guard
## positionSmall Forward and Shooting Guard and Power Forward
## shootsLeft Right
## shootsRight
## FreeThrows
## Games ***
## PlayerEfficiencyRating
## TotalRebounds
## WinShares
## effectiveFieldGoal
## Points ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 71.32 on 417 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.6241, Adjusted R-squared: 0.5628
## F-statistic: 10.18 on 68 and 417 DF, p-value: < 2.2e-16
plot(modeltest1)
## Warning: not plotting observations with leverage one:
## 17, 117, 130, 243, 432, 441
Forward Selection
n = nrow(df_2015)
out.null=lm(salary ~1, df_2015)
out.full=lm(salary~.,df_2015)
full=formula(lm( salary~., df_2015))
#out.forward= step(out.null,scope=list(lower=~1,upper=full), k= 2,direction="forward",trace= TRUE)
#out.forward= step(out.null,scope=list(lower=~1,upper=full), k= log(n),direction="forward",trace= TRUE)
Backward Elimination
#out.backward=step(out.full ,scope=list(lower=~1,upper=full),direction="backward",trace=TRUE ,k=log(n))
#out.backward=step(out.full ,scope=list(lower=~1,upper=full),direction="backward",trace=TRUE ,k= 2)
model_3_forwardsel_param = lm(salary ~ WinShares + Points + weight + Assits, data=df_2015)
summary(model_3_forwardsel_param)
##
## Call:
## lm(formula = salary ~ WinShares + Points + weight + Assits, data = df_2015)
##
## Residuals:
## Min 1Q Median 3Q Max
## -10114789 -1678362 -235095 1260728 12872070
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -8660051 1506080 -5.750 1.55e-08 ***
## WinShares 50316 6441 7.812 3.32e-14 ***
## Points 269064 45412 5.925 5.81e-09 ***
## weight 36240 6458 5.612 3.32e-08 ***
## Assits 483838 136538 3.544 0.000432 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3198000 on 502 degrees of freedom
## Multiple R-squared: 0.5481, Adjusted R-squared: 0.5445
## F-statistic: 152.2 on 4 and 502 DF, p-value: < 2.2e-16
plot(model_3_forwardsel_param)
model_6_back_param = lm(salary ~ height + weight + AgeatSeasonEnd + Assits + Points +
FieldGoals + FieldGoals3 + FreeThrows + Games + PlayerEfficiencyRating +
TotalRebounds + WinShares + effectiveFieldGoal, data=df_2015)
summary(model_6_back_param)
##
## Call:
## lm(formula = salary ~ height + weight + AgeatSeasonEnd + Assits +
## Points + FieldGoals + FieldGoals3 + FreeThrows + Games +
## PlayerEfficiencyRating + TotalRebounds + WinShares + effectiveFieldGoal,
## data = df_2015)
##
## Residuals:
## Min 1Q Median 3Q Max
## -10065250 -1775415 -200472 1326447 12741222
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -9094259.6 6125602.7 -1.485 0.13831
## height 24585.7 34565.6 0.711 0.47726
## weight 30516.2 11135.2 2.741 0.00637 **
## AgeatSeasonEnd -1690.7 54811.8 -0.031 0.97541
## Assits 512526.5 156293.1 3.279 0.00112 **
## Points 352515.5 69938.3 5.040 6.63e-07 ***
## FieldGoals 102281.3 77256.8 1.324 0.18617
## FieldGoals3 -8013.5 17178.1 -0.466 0.64108
## FreeThrows -18480.9 21857.0 -0.846 0.39824
## Games 801.7 1079.5 0.743 0.45808
## PlayerEfficiencyRating -97524.9 97330.9 -1.002 0.31686
## TotalRebounds -107102.5 139773.7 -0.766 0.44391
## WinShares 46414.6 9869.9 4.703 3.38e-06 ***
## effectiveFieldGoal -110818.8 64593.6 -1.716 0.08689 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3243000 on 472 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.5491, Adjusted R-squared: 0.5367
## F-statistic: 44.21 on 13 and 472 DF, p-value: < 2.2e-16
plot(model_6_back_param)
#The frequent positions with the positions which are used in categorical variables
df_2015_frequentpos <- df_2015 %>% filter(position %in% c('Point Guard','Center','Shooting Guard','Power Forward','Small Forward'))
#Best model
lambda=0.222
model_9 = lm(((salary^lambda-1)/lambda)~ ., data = df_2015_frequentpos)
plot(model_9)
summary(model_9)
##
## Call:
## lm(formula = ((salary^lambda - 1)/lambda) ~ ., data = df_2015_frequentpos)
##
## Residuals:
## Min 1Q Median 3Q Max
## -58.754 -13.130 0.528 12.739 51.175
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -136.90705 89.34936 -1.532 0.12709
## weight 0.35515 0.13484 2.634 0.00912 **
## height 0.82438 0.42846 1.924 0.05582 .
## AgeatSeasonEnd -0.80676 0.51582 -1.564 0.11945
## teamBoston Celtics 3.13624 10.36393 0.303 0.76251
## teamBrooklyn Nets 4.50006 10.97918 0.410 0.68235
## teamCharlotte Hornets 7.04333 10.42153 0.676 0.49995
## teamChicago Bulls 13.09071 10.93367 1.197 0.23266
## teamCleveland Cavaliers -3.01573 14.33043 -0.210 0.83354
## teamDallas Mavericks -4.71529 10.19648 -0.462 0.64429
## teamDenver Nuggets -3.93283 9.96281 -0.395 0.69346
## teamDetroit Pistons -4.08635 9.86366 -0.414 0.67913
## teamGolden State Warriors -14.72024 12.22931 -1.204 0.23019
## teamHouston Rockets 7.93911 10.91340 0.727 0.46782
## teamIndiana Pacers 7.08953 10.94669 0.648 0.51799
## teamLos Angeles Clippers 3.34676 12.32528 0.272 0.78627
## teamLos Angeles Lakers -21.34515 10.46397 -2.040 0.04273 *
## teamMemphis Grizzlies -3.55491 10.32585 -0.344 0.73102
## teamMiami Heat -4.82534 11.48694 -0.420 0.67490
## teamMilwaukee Bucks -4.03770 10.79458 -0.374 0.70878
## teamMinnesota Timberwolves 15.82427 10.86386 1.457 0.14685
## teamNew Orleans Pelicans 10.79075 11.93828 0.904 0.36719
## teamNew York Knicks -2.48749 11.03774 -0.225 0.82194
## teamOklahoma City Thunder -3.69021 10.22692 -0.361 0.71862
## teamOrlando Magic -10.57641 10.37969 -1.019 0.30950
## teamPhiladelphia 76ers -3.52310 9.70985 -0.363 0.71712
## teamPhoenix Suns -4.12690 10.16810 -0.406 0.68529
## teamPortland Trail Blazers -1.79921 10.32657 -0.174 0.86187
## teamSacramento Kings 2.20772 10.37157 0.213 0.83166
## teamSan Antonio Spurs -10.22790 10.44450 -0.979 0.32868
## teamToronto Raptors 2.25863 10.13961 0.223 0.82396
## teamUtah Jazz -0.59565 9.93235 -0.060 0.95224
## teamWashington Wizards 5.89720 12.05107 0.489 0.62515
## Assits 4.58091 1.71165 2.676 0.00808 **
## FieldGoals 0.38325 0.73985 0.518 0.60504
## FieldGoals3 0.07321 0.14893 0.492 0.62358
## positionPoint Guard 19.09751 14.71567 1.298 0.19592
## positionPower Forward 5.20567 5.90424 0.882 0.37904
## positionShooting Guard 21.75895 11.36635 1.914 0.05706 .
## positionSmall Forward 7.10442 8.81841 0.806 0.42144
## shootsRight -5.94826 5.79618 -1.026 0.30606
## FreeThrows -0.05271 0.18939 -0.278 0.78108
## Games 0.06212 0.01098 5.657 5.48e-08 ***
## PlayerEfficiencyRating 0.41492 0.84440 0.491 0.62372
## TotalRebounds -1.78549 1.41987 -1.258 0.21009
## WinShares 0.10904 0.12676 0.860 0.39075
## effectiveFieldGoal -0.76291 0.66550 -1.146 0.25306
## Points 0.94573 0.70773 1.336 0.18303
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 20.44 on 193 degrees of freedom
## (18 observations deleted due to missingness)
## Multiple R-squared: 0.6935, Adjusted R-squared: 0.6189
## F-statistic: 9.292 on 47 and 193 DF, p-value: < 2.2e-16
z = experimentwithseason %>% separate_rows(position, sep = " and ") %>% filter(season_end == 2015)
df_2015_2 = subset(z, season_end == 2015,select = -c(id,team,shoots,position))
names(df_2015_2) = c("height", "weight","season_end", "age_atendofseason","Assits","Points","FieldGoals","FieldGoals3","salary","FreeThrows","Games","PlayerEfficiencyRating","TotalRebounds","WinShares","effectiveFieldGoal","team","shoots","position")
model12 = lm(salary ~ .,df_2015_2)
summary(model12)
##
## Call:
## lm(formula = salary ~ ., data = df_2015_2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -9129514 -1740032 -101929 1515814 11209293
##
## Coefficients: (1 not defined because of singularities)
## Estimate
## (Intercept) -1.474e+07
## height 5.797e+04
## weight 2.279e+04
## season_end NA
## age_atendofseason -7.429e+04
## Assits 4.845e+05
## Points 3.707e+05
## FieldGoals 7.048e+04
## FieldGoals3 -2.219e+04
## FreeThrows -2.504e+04
## Games 1.641e+03
## PlayerEfficiencyRating -8.590e+04
## TotalRebounds -9.895e+04
## WinShares 4.032e+04
## effectiveFieldGoal -6.389e+04
## teamBoston Celtics 1.356e+06
## teamBrooklyn Nets 3.349e+06
## teamCharlotte Hornets 2.063e+06
## teamChicago Bulls -5.169e+05
## teamCleveland Cavaliers 2.697e+05
## teamDallas Mavericks -3.849e+05
## teamDenver Nuggets 1.078e+06
## teamDetroit Pistons 1.144e+06
## teamGolden State Warriors 1.145e+06
## teamHouston Rockets 8.888e+05
## teamIndiana Pacers 2.392e+06
## teamLos Angeles Clippers 2.939e+05
## teamLos Angeles Lakers 4.364e+05
## teamMemphis Grizzlies 1.351e+06
## teamMiami Heat 1.513e+06
## teamMilwaukee Bucks 3.774e+05
## teamMinnesota Timberwolves 2.149e+05
## teamNew Orleans Pelicans 1.934e+06
## teamNew York Knicks 3.178e+06
## teamOklahoma City Thunder 1.175e+06
## teamOrlando Magic -4.625e+05
## teamPhiladelphia 76ers 4.436e+05
## teamPhoenix Suns 1.061e+06
## teamPortland Trail Blazers 1.847e+06
## teamSacramento Kings 1.870e+06
## teamSan Antonio Spurs 5.193e+05
## teamToronto Raptors 1.344e+06
## teamUtah Jazz 2.426e+06
## teamWashington Wizards 5.494e+05
## shootsLeft Right -5.599e+05
## shootsRight 5.109e+04
## positionCenter and Power Forward 1.129e+06
## positionCenter and Small Forward and Power Forward 2.207e+06
## positionPoint Guard 1.677e+06
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard -6.911e+06
## positionPoint Guard and Shooting Guard 3.203e+05
## positionPoint Guard and Small Forward and Shooting Guard 9.721e+05
## positionPower Forward 8.522e+05
## positionPower Forward and Center 1.429e+06
## positionPower Forward and Center and Small Forward 3.375e+06
## positionPower Forward and Shooting Guard 1.889e+06
## positionPower Forward and Small Forward -2.575e+02
## positionPower Forward and Small Forward and Shooting Guard 3.926e+06
## positionShooting Guard 1.084e+06
## positionShooting Guard and Point Guard 1.145e+06
## positionShooting Guard and Small Forward 1.149e+06
## positionShooting Guard and Small Forward and Point Guard -2.466e+05
## positionShooting Guard and Small Forward and Power Forward 1.349e+06
## positionSmall Forward 5.689e+05
## positionSmall Forward and Center and Power Forward 7.547e+04
## positionSmall Forward and Power Forward 4.631e+05
## positionSmall Forward and Power Forward and Shooting Guard 1.475e+06
## positionSmall Forward and Shooting Guard 8.801e+05
## positionSmall Forward and Shooting Guard and Point Guard 8.672e+05
## positionSmall Forward and Shooting Guard and Power Forward 2.549e+06
## Std. Error
## (Intercept) 8.247e+06
## height 3.546e+04
## weight 1.024e+04
## season_end NA
## age_atendofseason 4.577e+04
## Assits 1.520e+05
## Points 6.599e+04
## FieldGoals 6.858e+04
## FieldGoals3 1.621e+04
## FreeThrows 2.020e+04
## Games 9.320e+02
## PlayerEfficiencyRating 8.860e+04
## TotalRebounds 1.225e+05
## WinShares 8.291e+03
## effectiveFieldGoal 5.800e+04
## teamBoston Celtics 9.300e+05
## teamBrooklyn Nets 9.934e+05
## teamCharlotte Hornets 9.107e+05
## teamChicago Bulls 9.317e+05
## teamCleveland Cavaliers 9.682e+05
## teamDallas Mavericks 9.117e+05
## teamDenver Nuggets 9.408e+05
## teamDetroit Pistons 1.033e+06
## teamGolden State Warriors 9.639e+05
## teamHouston Rockets 8.989e+05
## teamIndiana Pacers 9.489e+05
## teamLos Angeles Clippers 9.092e+05
## teamLos Angeles Lakers 9.219e+05
## teamMemphis Grizzlies 9.395e+05
## teamMiami Heat 9.238e+05
## teamMilwaukee Bucks 9.625e+05
## teamMinnesota Timberwolves 1.031e+06
## teamNew Orleans Pelicans 9.183e+05
## teamNew York Knicks 9.520e+05
## teamOklahoma City Thunder 9.755e+05
## teamOrlando Magic 9.000e+05
## teamPhiladelphia 76ers 8.745e+05
## teamPhoenix Suns 8.609e+05
## teamPortland Trail Blazers 9.437e+05
## teamSacramento Kings 9.640e+05
## teamSan Antonio Spurs 9.774e+05
## teamToronto Raptors 9.553e+05
## teamUtah Jazz 9.728e+05
## teamWashington Wizards 9.182e+05
## shootsLeft Right 2.510e+06
## shootsRight 4.314e+05
## positionCenter and Power Forward 6.471e+05
## positionCenter and Small Forward and Power Forward 2.121e+06
## positionPoint Guard 1.434e+06
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard 1.891e+06
## positionPoint Guard and Shooting Guard 1.272e+06
## positionPoint Guard and Small Forward and Shooting Guard 2.284e+06
## positionPower Forward 7.737e+05
## positionPower Forward and Center 6.175e+05
## positionPower Forward and Center and Small Forward 1.558e+06
## positionPower Forward and Shooting Guard 2.549e+06
## positionPower Forward and Small Forward 8.711e+05
## positionPower Forward and Small Forward and Shooting Guard 2.243e+06
## positionShooting Guard 1.165e+06
## positionShooting Guard and Point Guard 1.263e+06
## positionShooting Guard and Small Forward 1.020e+06
## positionShooting Guard and Small Forward and Point Guard 1.358e+06
## positionShooting Guard and Small Forward and Power Forward 1.706e+06
## positionSmall Forward 9.698e+05
## positionSmall Forward and Center and Power Forward 1.191e+06
## positionSmall Forward and Power Forward 8.741e+05
## positionSmall Forward and Power Forward and Shooting Guard 1.710e+06
## positionSmall Forward and Shooting Guard 1.016e+06
## positionSmall Forward and Shooting Guard and Point Guard 1.694e+06
## positionSmall Forward and Shooting Guard and Power Forward 1.280e+06
## t value
## (Intercept) -1.787
## height 1.635
## weight 2.225
## season_end NA
## age_atendofseason -1.623
## Assits 3.187
## Points 5.617
## FieldGoals 1.028
## FieldGoals3 -1.369
## FreeThrows -1.239
## Games 1.761
## PlayerEfficiencyRating -0.970
## TotalRebounds -0.808
## WinShares 4.863
## effectiveFieldGoal -1.102
## teamBoston Celtics 1.458
## teamBrooklyn Nets 3.371
## teamCharlotte Hornets 2.265
## teamChicago Bulls -0.555
## teamCleveland Cavaliers 0.279
## teamDallas Mavericks -0.422
## teamDenver Nuggets 1.146
## teamDetroit Pistons 1.107
## teamGolden State Warriors 1.188
## teamHouston Rockets 0.989
## teamIndiana Pacers 2.521
## teamLos Angeles Clippers 0.323
## teamLos Angeles Lakers 0.473
## teamMemphis Grizzlies 1.438
## teamMiami Heat 1.638
## teamMilwaukee Bucks 0.392
## teamMinnesota Timberwolves 0.208
## teamNew Orleans Pelicans 2.106
## teamNew York Knicks 3.338
## teamOklahoma City Thunder 1.205
## teamOrlando Magic -0.514
## teamPhiladelphia 76ers 0.507
## teamPhoenix Suns 1.232
## teamPortland Trail Blazers 1.957
## teamSacramento Kings 1.940
## teamSan Antonio Spurs 0.531
## teamToronto Raptors 1.407
## teamUtah Jazz 2.494
## teamWashington Wizards 0.598
## shootsLeft Right -0.223
## shootsRight 0.118
## positionCenter and Power Forward 1.744
## positionCenter and Small Forward and Power Forward 1.040
## positionPoint Guard 1.170
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard -3.654
## positionPoint Guard and Shooting Guard 0.252
## positionPoint Guard and Small Forward and Shooting Guard 0.426
## positionPower Forward 1.101
## positionPower Forward and Center 2.314
## positionPower Forward and Center and Small Forward 2.167
## positionPower Forward and Shooting Guard 0.741
## positionPower Forward and Small Forward 0.000
## positionPower Forward and Small Forward and Shooting Guard 1.750
## positionShooting Guard 0.930
## positionShooting Guard and Point Guard 0.907
## positionShooting Guard and Small Forward 1.127
## positionShooting Guard and Small Forward and Point Guard -0.182
## positionShooting Guard and Small Forward and Power Forward 0.791
## positionSmall Forward 0.587
## positionSmall Forward and Center and Power Forward 0.063
## positionSmall Forward and Power Forward 0.530
## positionSmall Forward and Power Forward and Shooting Guard 0.862
## positionSmall Forward and Shooting Guard 0.866
## positionSmall Forward and Shooting Guard and Point Guard 0.512
## positionSmall Forward and Shooting Guard and Power Forward 1.992
## Pr(>|t|)
## (Intercept) 0.074332
## height 0.102487
## weight 0.026363
## season_end NA
## age_atendofseason 0.104985
## Assits 0.001498
## Points 2.75e-08
## FieldGoals 0.304371
## FieldGoals3 0.171358
## FreeThrows 0.215643
## Games 0.078672
## PlayerEfficiencyRating 0.332605
## TotalRebounds 0.419328
## WinShares 1.41e-06
## effectiveFieldGoal 0.270961
## teamBoston Celtics 0.145318
## teamBrooklyn Nets 0.000787
## teamCharlotte Hornets 0.023798
## teamChicago Bulls 0.579187
## teamCleveland Cavaliers 0.780675
## teamDallas Mavericks 0.673025
## teamDenver Nuggets 0.252366
## teamDetroit Pistons 0.268503
## teamGolden State Warriors 0.235127
## teamHouston Rockets 0.323079
## teamIndiana Pacers 0.011921
## teamLos Angeles Clippers 0.746584
## teamLos Angeles Lakers 0.636122
## teamMemphis Grizzlies 0.150754
## teamMiami Heat 0.101905
## teamMilwaukee Bucks 0.695078
## teamMinnesota Timberwolves 0.834953
## teamNew Orleans Pelicans 0.035570
## teamNew York Knicks 0.000886
## teamOklahoma City Thunder 0.228712
## teamOrlando Magic 0.607474
## teamPhiladelphia 76ers 0.612127
## teamPhoenix Suns 0.218306
## teamPortland Trail Blazers 0.050760
## teamSacramento Kings 0.052748
## teamSan Antonio Spurs 0.595390
## teamToronto Raptors 0.159838
## teamUtah Jazz 0.012865
## teamWashington Wizards 0.549778
## shootsLeft Right 0.823568
## shootsRight 0.905768
## positionCenter and Power Forward 0.081569
## positionCenter and Small Forward and Power Forward 0.298557
## positionPoint Guard 0.242442
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard 0.000276
## positionPoint Guard and Shooting Guard 0.801319
## positionPoint Guard and Small Forward and Shooting Guard 0.670564
## positionPower Forward 0.271090
## positionPower Forward and Center 0.020947
## positionPower Forward and Center and Small Forward 0.030576
## positionPower Forward and Shooting Guard 0.458883
## positionPower Forward and Small Forward 0.999764
## positionPower Forward and Small Forward and Shooting Guard 0.080491
## positionShooting Guard 0.352480
## positionShooting Guard and Point Guard 0.364652
## positionShooting Guard and Small Forward 0.260040
## positionShooting Guard and Small Forward and Point Guard 0.855979
## positionShooting Guard and Small Forward and Power Forward 0.429162
## positionSmall Forward 0.557645
## positionSmall Forward and Center and Power Forward 0.949510
## positionSmall Forward and Power Forward 0.596412
## positionSmall Forward and Power Forward and Shooting Guard 0.388813
## positionSmall Forward and Shooting Guard 0.386831
## positionSmall Forward and Shooting Guard and Point Guard 0.608741
## positionSmall Forward and Shooting Guard and Power Forward 0.046778
##
## (Intercept) .
## height
## weight *
## season_end
## age_atendofseason
## Assits **
## Points ***
## FieldGoals
## FieldGoals3
## FreeThrows
## Games .
## PlayerEfficiencyRating
## TotalRebounds
## WinShares ***
## effectiveFieldGoal
## teamBoston Celtics
## teamBrooklyn Nets ***
## teamCharlotte Hornets *
## teamChicago Bulls
## teamCleveland Cavaliers
## teamDallas Mavericks
## teamDenver Nuggets
## teamDetroit Pistons
## teamGolden State Warriors
## teamHouston Rockets
## teamIndiana Pacers *
## teamLos Angeles Clippers
## teamLos Angeles Lakers
## teamMemphis Grizzlies
## teamMiami Heat
## teamMilwaukee Bucks
## teamMinnesota Timberwolves
## teamNew Orleans Pelicans *
## teamNew York Knicks ***
## teamOklahoma City Thunder
## teamOrlando Magic
## teamPhiladelphia 76ers
## teamPhoenix Suns
## teamPortland Trail Blazers .
## teamSacramento Kings .
## teamSan Antonio Spurs
## teamToronto Raptors
## teamUtah Jazz *
## teamWashington Wizards
## shootsLeft Right
## shootsRight
## positionCenter and Power Forward .
## positionCenter and Small Forward and Power Forward
## positionPoint Guard
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard ***
## positionPoint Guard and Shooting Guard
## positionPoint Guard and Small Forward and Shooting Guard
## positionPower Forward
## positionPower Forward and Center *
## positionPower Forward and Center and Small Forward *
## positionPower Forward and Shooting Guard
## positionPower Forward and Small Forward
## positionPower Forward and Small Forward and Shooting Guard .
## positionShooting Guard
## positionShooting Guard and Point Guard
## positionShooting Guard and Small Forward
## positionShooting Guard and Small Forward and Point Guard
## positionShooting Guard and Small Forward and Power Forward
## positionSmall Forward
## positionSmall Forward and Center and Power Forward
## positionSmall Forward and Power Forward
## positionSmall Forward and Power Forward and Shooting Guard
## positionSmall Forward and Shooting Guard
## positionSmall Forward and Shooting Guard and Point Guard
## positionSmall Forward and Shooting Guard and Power Forward *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3259000 on 736 degrees of freedom
## (26 observations deleted due to missingness)
## Multiple R-squared: 0.5901, Adjusted R-squared: 0.5522
## F-statistic: 15.58 on 68 and 736 DF, p-value: < 2.2e-16
plot(model12)
box_cox = boxcox(model1)
lambda= box_cox$x[which.max(box_cox$y)]
lambda
## [1] 0.2222222
modeltest2 = lm(((salary^lambda-1)/lambda)~., df_2015_2)
summary(modeltest2)
##
## Call:
## lm(formula = ((salary^lambda - 1)/lambda) ~ ., data = df_2015_2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -56.92 -13.82 0.00 15.56 60.04
##
## Coefficients: (1 not defined because of singularities)
## Estimate
## (Intercept) -1.182e+02
## height 7.199e-01
## weight 2.526e-01
## season_end NA
## age_atendofseason -1.327e+00
## Assits 4.937e+00
## Points 1.543e+00
## FieldGoals 2.250e-01
## FieldGoals3 -2.349e-01
## FreeThrows -6.984e-02
## Games 6.235e-02
## PlayerEfficiencyRating 5.546e-01
## TotalRebounds -7.358e-01
## WinShares -1.051e-01
## effectiveFieldGoal -1.461e-01
## teamBoston Celtics 1.895e+01
## teamBrooklyn Nets 1.615e+01
## teamCharlotte Hornets 1.674e+01
## teamChicago Bulls -2.231e+00
## teamCleveland Cavaliers 1.467e+00
## teamDallas Mavericks -5.703e+00
## teamDenver Nuggets 1.043e+01
## teamDetroit Pistons 8.029e+00
## teamGolden State Warriors 5.349e+00
## teamHouston Rockets 7.264e+00
## teamIndiana Pacers 1.605e+01
## teamLos Angeles Clippers -3.212e+00
## teamLos Angeles Lakers 5.564e-01
## teamMemphis Grizzlies 4.077e+00
## teamMiami Heat 7.996e+00
## teamMilwaukee Bucks 3.733e+00
## teamMinnesota Timberwolves 8.947e+00
## teamNew Orleans Pelicans 1.170e+01
## teamNew York Knicks 1.150e+01
## teamOklahoma City Thunder 1.197e+01
## teamOrlando Magic 4.160e-01
## teamPhiladelphia 76ers 7.415e+00
## teamPhoenix Suns 7.874e+00
## teamPortland Trail Blazers 1.392e+01
## teamSacramento Kings 9.008e+00
## teamSan Antonio Spurs 8.152e+00
## teamToronto Raptors 1.489e+01
## teamUtah Jazz 1.280e+01
## teamWashington Wizards 2.194e+00
## shootsLeft Right 1.038e+01
## shootsRight 1.901e+00
## positionCenter and Power Forward 1.117e+01
## positionCenter and Small Forward and Power Forward 1.301e+01
## positionPoint Guard 1.866e+01
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard -3.630e+01
## positionPoint Guard and Shooting Guard 1.041e+01
## positionPoint Guard and Small Forward and Shooting Guard 1.260e+01
## positionPower Forward 1.127e+01
## positionPower Forward and Center 1.165e+01
## positionPower Forward and Center and Small Forward 2.161e+01
## positionPower Forward and Shooting Guard 3.846e+00
## positionPower Forward and Small Forward 2.630e+00
## positionPower Forward and Small Forward and Shooting Guard 1.673e+01
## positionShooting Guard 1.897e+01
## positionShooting Guard and Point Guard 1.392e+01
## positionShooting Guard and Small Forward 1.480e+01
## positionShooting Guard and Small Forward and Point Guard 5.983e+00
## positionShooting Guard and Small Forward and Power Forward 1.289e+01
## positionSmall Forward 1.018e+01
## positionSmall Forward and Center and Power Forward 5.039e+00
## positionSmall Forward and Power Forward 1.043e+01
## positionSmall Forward and Power Forward and Shooting Guard 1.814e+01
## positionSmall Forward and Shooting Guard 1.287e+01
## positionSmall Forward and Shooting Guard and Point Guard 5.228e+00
## positionSmall Forward and Shooting Guard and Power Forward 2.725e+01
## Std. Error
## (Intercept) 5.580e+01
## height 2.399e-01
## weight 6.930e-02
## season_end NA
## age_atendofseason 3.097e-01
## Assits 1.029e+00
## Points 4.465e-01
## FieldGoals 4.640e-01
## FieldGoals3 1.097e-01
## FreeThrows 1.367e-01
## Games 6.306e-03
## PlayerEfficiencyRating 5.995e-01
## TotalRebounds 8.285e-01
## WinShares 5.610e-02
## effectiveFieldGoal 3.924e-01
## teamBoston Celtics 6.292e+00
## teamBrooklyn Nets 6.721e+00
## teamCharlotte Hornets 6.162e+00
## teamChicago Bulls 6.304e+00
## teamCleveland Cavaliers 6.551e+00
## teamDallas Mavericks 6.168e+00
## teamDenver Nuggets 6.365e+00
## teamDetroit Pistons 6.991e+00
## teamGolden State Warriors 6.522e+00
## teamHouston Rockets 6.082e+00
## teamIndiana Pacers 6.420e+00
## teamLos Angeles Clippers 6.152e+00
## teamLos Angeles Lakers 6.238e+00
## teamMemphis Grizzlies 6.357e+00
## teamMiami Heat 6.250e+00
## teamMilwaukee Bucks 6.513e+00
## teamMinnesota Timberwolves 6.976e+00
## teamNew Orleans Pelicans 6.213e+00
## teamNew York Knicks 6.441e+00
## teamOklahoma City Thunder 6.601e+00
## teamOrlando Magic 6.089e+00
## teamPhiladelphia 76ers 5.917e+00
## teamPhoenix Suns 5.825e+00
## teamPortland Trail Blazers 6.385e+00
## teamSacramento Kings 6.522e+00
## teamSan Antonio Spurs 6.613e+00
## teamToronto Raptors 6.464e+00
## teamUtah Jazz 6.582e+00
## teamWashington Wizards 6.213e+00
## shootsLeft Right 1.698e+01
## shootsRight 2.919e+00
## positionCenter and Power Forward 4.378e+00
## positionCenter and Small Forward and Power Forward 1.435e+01
## positionPoint Guard 9.700e+00
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard 1.280e+01
## positionPoint Guard and Shooting Guard 8.609e+00
## positionPoint Guard and Small Forward and Shooting Guard 1.546e+01
## positionPower Forward 5.235e+00
## positionPower Forward and Center 4.178e+00
## positionPower Forward and Center and Small Forward 1.054e+01
## positionPower Forward and Shooting Guard 1.724e+01
## positionPower Forward and Small Forward 5.894e+00
## positionPower Forward and Small Forward and Shooting Guard 1.518e+01
## positionShooting Guard 7.880e+00
## positionShooting Guard and Point Guard 8.544e+00
## positionShooting Guard and Small Forward 6.899e+00
## positionShooting Guard and Small Forward and Point Guard 9.190e+00
## positionShooting Guard and Small Forward and Power Forward 1.154e+01
## positionSmall Forward 6.561e+00
## positionSmall Forward and Center and Power Forward 8.061e+00
## positionSmall Forward and Power Forward 5.914e+00
## positionSmall Forward and Power Forward and Shooting Guard 1.157e+01
## positionSmall Forward and Shooting Guard 6.877e+00
## positionSmall Forward and Shooting Guard and Point Guard 1.146e+01
## positionSmall Forward and Shooting Guard and Power Forward 8.659e+00
## t value
## (Intercept) -2.119
## height 3.001
## weight 3.645
## season_end NA
## age_atendofseason -4.286
## Assits 4.800
## Points 3.455
## FieldGoals 0.485
## FieldGoals3 -2.142
## FreeThrows -0.511
## Games 9.886
## PlayerEfficiencyRating 0.925
## TotalRebounds -0.888
## WinShares -1.873
## effectiveFieldGoal -0.372
## teamBoston Celtics 3.012
## teamBrooklyn Nets 2.402
## teamCharlotte Hornets 2.716
## teamChicago Bulls -0.354
## teamCleveland Cavaliers 0.224
## teamDallas Mavericks -0.925
## teamDenver Nuggets 1.638
## teamDetroit Pistons 1.148
## teamGolden State Warriors 0.820
## teamHouston Rockets 1.194
## teamIndiana Pacers 2.499
## teamLos Angeles Clippers -0.522
## teamLos Angeles Lakers 0.089
## teamMemphis Grizzlies 0.641
## teamMiami Heat 1.279
## teamMilwaukee Bucks 0.573
## teamMinnesota Timberwolves 1.283
## teamNew Orleans Pelicans 1.883
## teamNew York Knicks 1.786
## teamOklahoma City Thunder 1.813
## teamOrlando Magic 0.068
## teamPhiladelphia 76ers 1.253
## teamPhoenix Suns 1.352
## teamPortland Trail Blazers 2.180
## teamSacramento Kings 1.381
## teamSan Antonio Spurs 1.233
## teamToronto Raptors 2.304
## teamUtah Jazz 1.944
## teamWashington Wizards 0.353
## shootsLeft Right 0.611
## shootsRight 0.651
## positionCenter and Power Forward 2.552
## positionCenter and Small Forward and Power Forward 0.906
## positionPoint Guard 1.924
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard -2.837
## positionPoint Guard and Shooting Guard 1.209
## positionPoint Guard and Small Forward and Shooting Guard 0.815
## positionPower Forward 2.153
## positionPower Forward and Center 2.788
## positionPower Forward and Center and Small Forward 2.051
## positionPower Forward and Shooting Guard 0.223
## positionPower Forward and Small Forward 0.446
## positionPower Forward and Small Forward and Shooting Guard 1.102
## positionShooting Guard 2.407
## positionShooting Guard and Point Guard 1.629
## positionShooting Guard and Small Forward 2.145
## positionShooting Guard and Small Forward and Point Guard 0.651
## positionShooting Guard and Small Forward and Power Forward 1.117
## positionSmall Forward 1.552
## positionSmall Forward and Center and Power Forward 0.625
## positionSmall Forward and Power Forward 1.763
## positionSmall Forward and Power Forward and Shooting Guard 1.568
## positionSmall Forward and Shooting Guard 1.871
## positionSmall Forward and Shooting Guard and Point Guard 0.456
## positionSmall Forward and Shooting Guard and Power Forward 3.148
## Pr(>|t|)
## (Intercept) 0.034433
## height 0.002783
## weight 0.000287
## season_end NA
## age_atendofseason 2.06e-05
## Assits 1.92e-06
## Points 0.000581
## FieldGoals 0.627932
## FieldGoals3 0.032523
## FreeThrows 0.609575
## Games < 2e-16
## PlayerEfficiencyRating 0.355145
## TotalRebounds 0.374751
## WinShares 0.061503
## effectiveFieldGoal 0.709716
## teamBoston Celtics 0.002684
## teamBrooklyn Nets 0.016548
## teamCharlotte Hornets 0.006755
## teamChicago Bulls 0.723566
## teamCleveland Cavaliers 0.822884
## teamDallas Mavericks 0.355461
## teamDenver Nuggets 0.101794
## teamDetroit Pistons 0.251175
## teamGolden State Warriors 0.412340
## teamHouston Rockets 0.232758
## teamIndiana Pacers 0.012658
## teamLos Angeles Clippers 0.601741
## teamLos Angeles Lakers 0.928940
## teamMemphis Grizzlies 0.521514
## teamMiami Heat 0.201169
## teamMilwaukee Bucks 0.566733
## teamMinnesota Timberwolves 0.200059
## teamNew Orleans Pelicans 0.060034
## teamNew York Knicks 0.074563
## teamOklahoma City Thunder 0.070212
## teamOrlando Magic 0.945549
## teamPhiladelphia 76ers 0.210580
## teamPhoenix Suns 0.176856
## teamPortland Trail Blazers 0.029546
## teamSacramento Kings 0.167693
## teamSan Antonio Spurs 0.218109
## teamToronto Raptors 0.021496
## teamUtah Jazz 0.052233
## teamWashington Wizards 0.724095
## shootsLeft Right 0.541274
## shootsRight 0.515119
## positionCenter and Power Forward 0.010905
## positionCenter and Small Forward and Power Forward 0.365101
## positionPoint Guard 0.054740
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard 0.004678
## positionPoint Guard and Shooting Guard 0.227057
## positionPoint Guard and Small Forward and Shooting Guard 0.415366
## positionPower Forward 0.031627
## positionPower Forward and Center 0.005432
## positionPower Forward and Center and Small Forward 0.040635
## positionPower Forward and Shooting Guard 0.823574
## positionPower Forward and Small Forward 0.655637
## positionPower Forward and Small Forward and Shooting Guard 0.270775
## positionShooting Guard 0.016333
## positionShooting Guard and Point Guard 0.103754
## positionShooting Guard and Small Forward 0.032254
## positionShooting Guard and Small Forward and Point Guard 0.515252
## positionShooting Guard and Small Forward and Power Forward 0.264216
## positionSmall Forward 0.121201
## positionSmall Forward and Center and Power Forward 0.532133
## positionSmall Forward and Power Forward 0.078341
## positionSmall Forward and Power Forward and Shooting Guard 0.117407
## positionSmall Forward and Shooting Guard 0.061764
## positionSmall Forward and Shooting Guard and Point Guard 0.648339
## positionSmall Forward and Shooting Guard and Power Forward 0.001713
##
## (Intercept) *
## height **
## weight ***
## season_end
## age_atendofseason ***
## Assits ***
## Points ***
## FieldGoals
## FieldGoals3 *
## FreeThrows
## Games ***
## PlayerEfficiencyRating
## TotalRebounds
## WinShares .
## effectiveFieldGoal
## teamBoston Celtics **
## teamBrooklyn Nets *
## teamCharlotte Hornets **
## teamChicago Bulls
## teamCleveland Cavaliers
## teamDallas Mavericks
## teamDenver Nuggets
## teamDetroit Pistons
## teamGolden State Warriors
## teamHouston Rockets
## teamIndiana Pacers *
## teamLos Angeles Clippers
## teamLos Angeles Lakers
## teamMemphis Grizzlies
## teamMiami Heat
## teamMilwaukee Bucks
## teamMinnesota Timberwolves
## teamNew Orleans Pelicans .
## teamNew York Knicks .
## teamOklahoma City Thunder .
## teamOrlando Magic
## teamPhiladelphia 76ers
## teamPhoenix Suns
## teamPortland Trail Blazers *
## teamSacramento Kings
## teamSan Antonio Spurs
## teamToronto Raptors *
## teamUtah Jazz .
## teamWashington Wizards
## shootsLeft Right
## shootsRight
## positionCenter and Power Forward *
## positionCenter and Small Forward and Power Forward
## positionPoint Guard .
## positionPoint Guard and Power Forward and Small Forward and Shooting Guard **
## positionPoint Guard and Shooting Guard
## positionPoint Guard and Small Forward and Shooting Guard
## positionPower Forward *
## positionPower Forward and Center **
## positionPower Forward and Center and Small Forward *
## positionPower Forward and Shooting Guard
## positionPower Forward and Small Forward
## positionPower Forward and Small Forward and Shooting Guard
## positionShooting Guard *
## positionShooting Guard and Point Guard
## positionShooting Guard and Small Forward *
## positionShooting Guard and Small Forward and Point Guard
## positionShooting Guard and Small Forward and Power Forward
## positionSmall Forward
## positionSmall Forward and Center and Power Forward
## positionSmall Forward and Power Forward .
## positionSmall Forward and Power Forward and Shooting Guard
## positionSmall Forward and Shooting Guard .
## positionSmall Forward and Shooting Guard and Point Guard
## positionSmall Forward and Shooting Guard and Power Forward **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 22.05 on 736 degrees of freedom
## (26 observations deleted due to missingness)
## Multiple R-squared: 0.6085, Adjusted R-squared: 0.5724
## F-statistic: 16.83 on 68 and 736 DF, p-value: < 2.2e-16
plot(modeltest2)
m = sqldf('select height, avg(salary) as meansal, season_end from experimentwithseason group by height, season_end order by meansal, season_end')
m = sqldf('select height, avg(salary) as meansal, season_end from experimentwithseason where height> 200 group by height, season_end order by meansal, season_end')
ggplot(m, aes(height, meansal)) + geom_col()
ggplot(m, aes(season_end, meansal, fill = height)) + geom_col()
expafter006 = subset(experimentwithseason, season_end > 2000,select = -c(id))
expafter006 %>% group_by(team) %>% count() %>% arrange(desc(n)) %>% ggplot(aes(n, team)) + geom_col()
expafter006 %>% group_by(season_end) %>% count() %>% ggplot(aes(season_end, n)) + geom_col()
expafter006 %>% group_by(season_end, team) %>% count() %>% ggplot(aes(season_end, n, fill = team))+ geom_col(col = "black", size = 0.2)
shapiro.test(residuals(model_9))
##
## Shapiro-Wilk normality test
##
## data: residuals(model_9)
## W = 0.99759, p-value = 0.977
shapiro.test(residuals(model1))
##
## Shapiro-Wilk normality test
##
## data: residuals(model1)
## W = 0.96905, p-value = 1.324e-08