R Environment Preparation

Read in .csv and bring in necessary libraries (NBA player data 2000-16)

setwd("~/Documents/Spring 2019/Data Mining/R Files")
load("seasonstats.Rdata")
#seasonstats <- seasonstats

library(forecast)
library(gains)
library(caret)
library(e1071)

Dataset: Must have played more than 10 games and at least 20 minutes/game

Delete non-numeric columns

seasonstats <- seasonstats[,c(6:52)]

Deleting records with few N/As and where median wouldn’t be logical

dim(seasonstats[(  is.na(seasonstats$AST) |
                   is.na(seasonstats$PTS)), ])
## [1]  0 47
seasonstats <- (seasonstats[!(is.na(seasonstats$TwoPP) |
                               is.na(seasonstats$ThreePP)), ])

Imputing the median for FT%if null as deleting/puttiong 0s doesn’t make sense

seasonstats$FTp[is.na(seasonstats$FTp)] <- 
  median(seasonstats$FTp, na.rm = TRUE)
summary(seasonstats)
##        Tm             G               GS              FG       
##  TOT    : 323   Min.   :11.00   Min.   : 0.00   Min.   : 12.0  
##  CHI    : 146   1st Qu.:55.00   1st Qu.:19.00   1st Qu.:187.0  
##  MIL    : 144   Median :71.00   Median :46.00   Median :279.0  
##  DEN    : 143   Mean   :64.34   Mean   :44.43   Mean   :304.8  
##  NYK    : 142   3rd Qu.:79.00   3rd Qu.:72.00   3rd Qu.:400.0  
##  TOR    : 140   Max.   :85.00   Max.   :83.00   Max.   :978.0  
##  (Other):3128                                                  
##       FGA             ThreeP         ThreePA           TwoP      
##  Min.   :  31.0   Min.   :  0.0   Min.   :  1.0   Min.   :  8.0  
##  1st Qu.: 427.0   1st Qu.:  7.0   1st Qu.: 27.0   1st Qu.:137.0  
##  Median : 624.5   Median : 45.0   Median :132.0   Median :218.0  
##  Mean   : 675.9   Mean   : 55.4   Mean   :154.1   Mean   :249.4  
##  3rd Qu.: 882.0   3rd Qu.: 89.0   3rd Qu.:245.0   3rd Qu.:333.8  
##  Max.   :2173.0   Max.   :402.0   Max.   :886.0   Max.   :956.0  
##                                                                  
##      TwoPA              FT             FTA             ORB        
##  Min.   :  26.0   Min.   :  3.0   Min.   :  5.0   Min.   :  0.00  
##  1st Qu.: 299.0   1st Qu.: 75.0   1st Qu.: 99.0   1st Qu.: 30.00  
##  Median : 464.0   Median :125.0   Median :164.5   Median : 58.00  
##  Mean   : 521.7   Mean   :155.8   Mean   :201.5   Mean   : 79.53  
##  3rd Qu.: 694.8   3rd Qu.:206.0   3rd Qu.:268.0   3rd Qu.:111.00  
##  Max.   :1664.0   Max.   :756.0   Max.   :972.0   Max.   :440.00  
##                                                                   
##       DRB             TRB              AST             STL        
##  Min.   : 15.0   Min.   :  17.0   Min.   :  8.0   Min.   :  2.00  
##  1st Qu.:136.0   1st Qu.: 171.2   1st Qu.: 84.0   1st Qu.: 37.00  
##  Median :206.0   Median : 267.0   Median :142.0   Median : 56.00  
##  Mean   :235.1   Mean   : 314.7   Mean   :187.8   Mean   : 61.55  
##  3rd Qu.:303.0   3rd Qu.: 410.8   3rd Qu.:247.0   3rd Qu.: 80.00  
##  Max.   :894.0   Max.   :1226.0   Max.   :925.0   Max.   :225.00  
##                                                                   
##       BLK              TOV              PF             PTS        
##  Min.   :  0.00   Min.   :  5.0   Min.   : 12.0   Min.   :  34.0  
##  1st Qu.: 10.00   1st Qu.: 68.0   1st Qu.:107.0   1st Qu.: 497.0  
##  Median : 20.00   Median :103.0   Median :152.0   Median : 749.0  
##  Mean   : 34.01   Mean   :112.5   Mean   :151.1   Mean   : 820.7  
##  3rd Qu.: 42.00   3rd Qu.:148.0   3rd Qu.:194.0   3rd Qu.:1073.8  
##  Max.   :294.00   Max.   :374.0   Max.   :371.0   Max.   :2832.0  
##                                                                   
##        MP            PER             TSP            ThreePAr     
##  Min.   : 231   Min.   : 3.00   Min.   :0.3590   Min.   :0.0010  
##  1st Qu.:1433   1st Qu.:12.50   1st Qu.:0.5040   1st Qu.:0.0510  
##  Median :1931   Median :14.90   Median :0.5320   Median :0.2370  
##  Mean   :1901   Mean   :15.25   Mean   :0.5314   Mean   :0.2351  
##  3rd Qu.:2427   3rd Qu.:17.50   3rd Qu.:0.5590   3rd Qu.:0.3700  
##  Max.   :3485   Max.   :31.70   Max.   :0.7080   Max.   :0.8730  
##                                                                  
##       FTr              ORBP             DRBP            TRBP       
##  Min.   :0.0360   Min.   : 0.000   Min.   : 4.20   Min.   : 2.400  
##  1st Qu.:0.2020   1st Qu.: 2.100   1st Qu.: 9.70   1st Qu.: 6.000  
##  Median :0.2710   Median : 3.600   Median :12.60   Median : 8.200  
##  Mean   :0.2899   Mean   : 4.763   Mean   :14.01   Mean   : 9.381  
##  3rd Qu.:0.3570   3rd Qu.: 7.000   3rd Qu.:17.50   3rd Qu.:12.200  
##  Max.   :1.2190   Max.   :18.300   Max.   :35.90   Max.   :25.600  
##                                                                    
##       ASTP            STLP            BLKP             TOVP      
##  Min.   : 1.40   Min.   :0.100   Min.   : 0.000   Min.   : 2.60  
##  1st Qu.: 8.80   1st Qu.:1.200   1st Qu.: 0.400   1st Qu.:10.70  
##  Median :13.20   Median :1.600   Median : 0.900   Median :12.80  
##  Mean   :16.17   Mean   :1.678   Mean   : 1.322   Mean   :13.11  
##  3rd Qu.:22.18   3rd Qu.:2.000   3rd Qu.: 1.700   3rd Qu.:15.10  
##  Max.   :55.90   Max.   :4.800   Max.   :10.200   Max.   :33.80  
##                                                                  
##       USGP            OWS              DWS               WS        
##  Min.   : 6.40   Min.   :-3.300   Min.   :-0.600   Min.   :-2.100  
##  1st Qu.:17.00   1st Qu.: 0.800   1st Qu.: 0.900   1st Qu.: 2.000  
##  Median :20.20   Median : 1.900   Median : 1.600   Median : 3.700  
##  Mean   :20.45   Mean   : 2.415   Mean   : 1.886   Mean   : 4.302  
##  3rd Qu.:23.50   3rd Qu.: 3.500   3rd Qu.: 2.600   3rd Qu.: 6.000  
##  Max.   :38.70   Max.   :14.800   Max.   : 9.100   Max.   :20.300  
##                                                                    
##       WS48              OBPM              DBPM              BPM         
##  Min.   :-0.0520   Min.   :-7.2000   Min.   :-5.4000   Min.   :-7.3000  
##  1st Qu.: 0.0660   1st Qu.:-1.2000   1st Qu.:-1.4000   1st Qu.:-1.6000  
##  Median : 0.0990   Median : 0.2000   Median :-0.3000   Median : 0.0000  
##  Mean   : 0.1005   Mean   : 0.3267   Mean   :-0.1538   Mean   : 0.1727  
##  3rd Qu.: 0.1330   3rd Qu.: 1.6000   3rd Qu.: 0.9000   3rd Qu.: 1.7000  
##  Max.   : 0.3220   Max.   :12.4000   Max.   : 7.0000   Max.   :13.0000  
##                                                                         
##       VORP            FGP            ThreePP           TwoPP       
##  Min.   :-2.10   Min.   :0.2860   Min.   :0.0000   Min.   :0.2870  
##  1st Qu.: 0.10   1st Qu.:0.4160   1st Qu.:0.2650   1st Qu.:0.4430  
##  Median : 0.90   Median :0.4420   Median :0.3370   Median :0.4710  
##  Mean   : 1.27   Mean   :0.4475   Mean   :0.2965   Mean   :0.4721  
##  3rd Qu.: 2.00   3rd Qu.:0.4740   3rd Qu.:0.3780   3rd Qu.:0.5000  
##  Max.   :11.60   Max.   :0.7100   Max.   :1.0000   Max.   :0.7130  
##                                                                    
##       eFGP             FTP           isAllStar     
##  Min.   :0.3150   Min.   :0.3110   Min.   :0.0000  
##  1st Qu.:0.4610   1st Qu.:0.7210   1st Qu.:0.0000  
##  Median :0.4880   Median :0.7820   Median :0.0000  
##  Mean   :0.4896   Mean   :0.7674   Mean   :0.1049  
##  3rd Qu.:0.5160   3rd Qu.:0.8290   3rd Qu.:0.0000  
##  Max.   :0.7110   Max.   :1.0000   Max.   :1.0000  
## 

Calculated Variables for per-game analysis

seasonstats$TOVGame <- seasonstats$TOV / seasonstats$G
seasonstats$STLGame <- seasonstats$STL / seasonstats$G
seasonstats$BLKGame <- seasonstats$BLK / seasonstats$G
seasonstats$PTSGame <- seasonstats$PTS / seasonstats$G
seasonstats$TRBGame <- seasonstats$TRB / seasonstats$G
seasonstats$ASTGame <- seasonstats$AST / seasonstats$G
seasonstats$FTGame <- seasonstats$FT / seasonstats$G
seasonstats$FTAGame <- seasonstats$FTA / seasonstats$G
seasonstats$PFGame <- seasonstats$PF / seasonstats$G
seasonstats$TwoPGame <- seasonstats$TwoP / seasonstats$G
seasonstats$TwoPAGame <- seasonstats$TwoPA / seasonstats$G
seasonstats$ThreePAGame <- seasonstats$ThreePA / seasonstats$G
seasonstats$ThreePGame <- seasonstats$ThreeP / seasonstats$G

Updated to per game stats and deleted G and GS (would skew data so use USG% instead)

seasonstats <- seasonstats[,c(19:60)]
seasonstats <- seasonstats[,c(1,4:42)]
seasonstatsmodel <- seasonstats

Logistic Model - focus on high sensitivity (positivity accuracy) vs high specificity

set.seed(2016)
train.rows <- sample(nrow(seasonstatsmodel), nrow(seasonstatsmodel) * 0.6)
seasonstatsmodel.train <- seasonstatsmodel[train.rows, ]
seasonstatsmodel.valid <- seasonstatsmodel[-train.rows, ]
seasonstatsmodel.glm <- glm(isAllStar ~ ., family = "binomial", data = seasonstatsmodel.train)
summary(seasonstatsmodel.glm)
## 
## Call:
## glm(formula = isAllStar ~ ., family = "binomial", data = seasonstatsmodel.train)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -2.15460  -0.23592  -0.09018  -0.03491   2.85729  
## 
## Coefficients: (1 not defined because of singularities)
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -1.603e+01  6.770e+00  -2.369  0.01786 *  
## PF          -9.122e-03  5.289e-03  -1.725  0.08456 .  
## PER         -2.196e-01  3.193e-01  -0.688  0.49168    
## TSP         -7.048e+00  2.617e+01  -0.269  0.78769    
## ThreePAr    -2.687e+01  1.849e+01  -1.453  0.14615    
## FTr          6.886e+00  3.810e+00   1.807  0.07072 .  
## ORBP         3.826e-01  4.082e-01   0.937  0.34869    
## DRBP         2.592e-01  4.073e-01   0.636  0.52454    
## TRBP        -7.867e-01  8.166e-01  -0.963  0.33538    
## ASTP        -2.197e-01  8.550e-02  -2.570  0.01017 *  
## STLP        -3.523e-01  1.282e+00  -0.275  0.78342    
## BLKP         1.726e-01  5.848e-01   0.295  0.76786    
## TOVP         7.690e-02  1.460e-01   0.527  0.59852    
## USGP         5.509e-01  1.860e-01   2.961  0.00307 ** 
## OWS         -1.173e-01  1.936e+00  -0.061  0.95170    
## DWS          2.684e-01  1.939e+00   0.138  0.88990    
## WS           3.685e-01  1.938e+00   0.190  0.84919    
## WS48        -7.825e+00  1.454e+01  -0.538  0.59042    
## OBPM        -1.426e+00  1.899e+00  -0.751  0.45272    
## DBPM        -1.556e+00  1.901e+00  -0.819  0.41287    
## BPM          1.847e+00  1.893e+00   0.976  0.32918    
## VORP        -3.100e-01  3.797e-01  -0.816  0.41425    
## FGP         -1.395e+02  9.575e+01  -1.457  0.14515    
## ThreePP      7.663e-01  9.057e-01   0.846  0.39748    
## TwoPP        1.404e+01  1.318e+01   1.065  0.28680    
## eFGP         1.380e+02  9.057e+01   1.524  0.12759    
## FTP          2.198e-02  3.724e+00   0.006  0.99529    
## TOVGame     -1.333e+00  8.094e-01  -1.647  0.09958 .  
## STLGame      6.993e-01  1.911e+00   0.366  0.71443    
## BLKGame      1.441e-01  1.246e+00   0.116  0.90793    
## PTSGame     -3.955e-01  8.994e-01  -0.440  0.66009    
## TRBGame      5.941e-01  3.745e-01   1.586  0.11265    
## ASTGame      1.565e+00  3.897e-01   4.016 5.91e-05 ***
## FTGame       1.368e+00  1.242e+00   1.101  0.27092    
## FTAGame     -9.181e-01  6.801e-01  -1.350  0.17705    
## PFGame       1.518e-01  4.475e-01   0.339  0.73439    
## TwoPGame     1.277e+00  2.079e+00   0.614  0.53903    
## TwoPAGame   -2.842e-01  4.632e-01  -0.614  0.53951    
## ThreePAGame  4.180e-01  1.099e+00   0.380  0.70369    
## ThreePGame          NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 1769.64  on 2498  degrees of freedom
## Residual deviance:  794.89  on 2460  degrees of freedom
## AIC: 872.89
## 
## Number of Fisher Scoring iterations: 8
pred.glm.train <- predict(seasonstatsmodel.glm, type = "response")
pred.glm.valid <- predict(seasonstatsmodel.glm, newdata = seasonstatsmodel.valid, type = "response")
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == :
## prediction from a rank-deficient fit may be misleading
confusionMatrix(as.factor(ifelse(pred.glm.train >= 0.5, "1", "0")), as.factor(seasonstatsmodel.train$isAllStar), 
                positive = "1")
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction    0    1
##          0 2164  123
##          1   51  161
##                                         
##                Accuracy : 0.9304        
##                  95% CI : (0.9197, 0.94)
##     No Information Rate : 0.8864        
##     P-Value [Acc > NIR] : 8.990e-14     
##                                         
##                   Kappa : 0.6114        
##                                         
##  Mcnemar's Test P-Value : 7.346e-08     
##                                         
##             Sensitivity : 0.56690       
##             Specificity : 0.97698       
##          Pos Pred Value : 0.75943       
##          Neg Pred Value : 0.94622       
##              Prevalence : 0.11365       
##          Detection Rate : 0.06443       
##    Detection Prevalence : 0.08483       
##       Balanced Accuracy : 0.77194       
##                                         
##        'Positive' Class : 1             
## 

Logistic Model - focus on high sensitivity (positivity accuracy) vs high specificity

set.seed(2016)
train.rows <- sample(nrow(seasonstatsmodel), nrow(seasonstatsmodel) * 0.6)
seasonstatsmodel.train <- seasonstatsmodel[train.rows, ]
seasonstatsmodel.valid <- seasonstatsmodel[-train.rows, ]
seasonstatsmodel.glm <- glm(isAllStar ~ ., family = "binomial", data = seasonstatsmodel.train)
summary(seasonstatsmodel.glm)
## 
## Call:
## glm(formula = isAllStar ~ ., family = "binomial", data = seasonstatsmodel.train)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -2.15460  -0.23592  -0.09018  -0.03491   2.85729  
## 
## Coefficients: (1 not defined because of singularities)
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -1.603e+01  6.770e+00  -2.369  0.01786 *  
## PF          -9.122e-03  5.289e-03  -1.725  0.08456 .  
## PER         -2.196e-01  3.193e-01  -0.688  0.49168    
## TSP         -7.048e+00  2.617e+01  -0.269  0.78769    
## ThreePAr    -2.687e+01  1.849e+01  -1.453  0.14615    
## FTr          6.886e+00  3.810e+00   1.807  0.07072 .  
## ORBP         3.826e-01  4.082e-01   0.937  0.34869    
## DRBP         2.592e-01  4.073e-01   0.636  0.52454    
## TRBP        -7.867e-01  8.166e-01  -0.963  0.33538    
## ASTP        -2.197e-01  8.550e-02  -2.570  0.01017 *  
## STLP        -3.523e-01  1.282e+00  -0.275  0.78342    
## BLKP         1.726e-01  5.848e-01   0.295  0.76786    
## TOVP         7.690e-02  1.460e-01   0.527  0.59852    
## USGP         5.509e-01  1.860e-01   2.961  0.00307 ** 
## OWS         -1.173e-01  1.936e+00  -0.061  0.95170    
## DWS          2.684e-01  1.939e+00   0.138  0.88990    
## WS           3.685e-01  1.938e+00   0.190  0.84919    
## WS48        -7.825e+00  1.454e+01  -0.538  0.59042    
## OBPM        -1.426e+00  1.899e+00  -0.751  0.45272    
## DBPM        -1.556e+00  1.901e+00  -0.819  0.41287    
## BPM          1.847e+00  1.893e+00   0.976  0.32918    
## VORP        -3.100e-01  3.797e-01  -0.816  0.41425    
## FGP         -1.395e+02  9.575e+01  -1.457  0.14515    
## ThreePP      7.663e-01  9.057e-01   0.846  0.39748    
## TwoPP        1.404e+01  1.318e+01   1.065  0.28680    
## eFGP         1.380e+02  9.057e+01   1.524  0.12759    
## FTP          2.198e-02  3.724e+00   0.006  0.99529    
## TOVGame     -1.333e+00  8.094e-01  -1.647  0.09958 .  
## STLGame      6.993e-01  1.911e+00   0.366  0.71443    
## BLKGame      1.441e-01  1.246e+00   0.116  0.90793    
## PTSGame     -3.955e-01  8.994e-01  -0.440  0.66009    
## TRBGame      5.941e-01  3.745e-01   1.586  0.11265    
## ASTGame      1.565e+00  3.897e-01   4.016 5.91e-05 ***
## FTGame       1.368e+00  1.242e+00   1.101  0.27092    
## FTAGame     -9.181e-01  6.801e-01  -1.350  0.17705    
## PFGame       1.518e-01  4.475e-01   0.339  0.73439    
## TwoPGame     1.277e+00  2.079e+00   0.614  0.53903    
## TwoPAGame   -2.842e-01  4.632e-01  -0.614  0.53951    
## ThreePAGame  4.180e-01  1.099e+00   0.380  0.70369    
## ThreePGame          NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 1769.64  on 2498  degrees of freedom
## Residual deviance:  794.89  on 2460  degrees of freedom
## AIC: 872.89
## 
## Number of Fisher Scoring iterations: 8
pred.glm.train <- predict(seasonstatsmodel.glm, type = "response")
pred.glm.valid <- predict(seasonstatsmodel.glm, newdata = seasonstatsmodel.valid, type = "response")
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == :
## prediction from a rank-deficient fit may be misleading
confusionMatrix(as.factor(ifelse(pred.glm.train >= 0.5, "1", "0")), as.factor(seasonstatsmodel.train$isAllStar), 
                positive = "1")
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction    0    1
##          0 2164  123
##          1   51  161
##                                         
##                Accuracy : 0.9304        
##                  95% CI : (0.9197, 0.94)
##     No Information Rate : 0.8864        
##     P-Value [Acc > NIR] : 8.990e-14     
##                                         
##                   Kappa : 0.6114        
##                                         
##  Mcnemar's Test P-Value : 7.346e-08     
##                                         
##             Sensitivity : 0.56690       
##             Specificity : 0.97698       
##          Pos Pred Value : 0.75943       
##          Neg Pred Value : 0.94622       
##              Prevalence : 0.11365       
##          Detection Rate : 0.06443       
##    Detection Prevalence : 0.08483       
##       Balanced Accuracy : 0.77194       
##                                         
##        'Positive' Class : 1             
## 
#Initial model has low sensitivity so need to change that:
#Define a cost function with input "obs" being the observed response,
# "pred.p" being predicted probability, and "pcut" being the threshold
#Allows us to weight getting high sensitivity vs high specficity
costfunc <- function(obs, pred.p, pcut){
  weight1 <- 10 # define the weight for "true=1 but pred=0" (false negative)
  weight0 <- 1 # define the weight for "true=0 but pred=1" (false positive)
  c1 <- (obs == 1) & (pred.p < pcut) # count for "true=1 but pred=0" (false negative)
  c0 <- (obs == 0) & (pred.p >= pcut) # count for "true=0 but pred=1" (false positive)
  cost <- mean(weight1 * c1 + weight0 * c0) # misclassification with weight
  return(cost)
} 
#Define a sequence from 0.01 to 1 by 0.01
p.seq <- seq(from = 0.01, to = 1, by = 0.01)
# Loop for all potential cutoff values to see which provides the smallest cost
# Define a 0 vector first to save the values of cost from all cutoffs
cost <- rep(0, length(p.seq))
for (i in 1:length(p.seq)) {cost[i] <- costfunc(obs = seasonstatsmodel$isAllStar, pred.p = pred.glm.train, pcut = p.seq[i])
}
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 1) & (pred.p < pcut): longer object length is not a multiple
## of shorter object length
## Warning in (obs == 0) & (pred.p >= pcut): longer object length is not a multiple
## of shorter object length
#Find optimal pcut
optimal.pcut.glm <- p.seq[which(cost == min(cost))]
#Higher sensitivity seen - will try this cutoff with logistic model(s)
confusionMatrix(as.factor(ifelse(pred.glm.train >= optimal.pcut.glm, "1", "0")), as.factor(seasonstatsmodel.train$isAllStar), 
                positive = "1")
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction    0    1
##          0 1273    0
##          1  942  284
##                                           
##                Accuracy : 0.623           
##                  95% CI : (0.6037, 0.6421)
##     No Information Rate : 0.8864          
##     P-Value [Acc > NIR] : 1               
##                                           
##                   Kappa : 0.235           
##                                           
##  Mcnemar's Test P-Value : <2e-16          
##                                           
##             Sensitivity : 1.0000          
##             Specificity : 0.5747          
##          Pos Pred Value : 0.2316          
##          Neg Pred Value : 1.0000          
##              Prevalence : 0.1136          
##          Detection Rate : 0.1136          
##    Detection Prevalence : 0.4906          
##       Balanced Accuracy : 0.7874          
##                                           
##        'Positive' Class : 1               
## 
cost <- costfunc(obs = seasonstatsmodel.train$isAllStar, pred.p = pred.glm.train, pcut = optimal.pcut.glm)

Perform forward selection,backward selection, and stepwise selection

#Forward regression - 2nd best
seasonstatsmodel.glm.null <- glm(isAllStar ~ 1, data = seasonstatsmodel.train, family = "binomial")
seasonstatsmodel.glm.full <- glm(isAllStar ~ ., data = seasonstatsmodel.train, family = "binomial")
seasonstatsmodel.glm.fwd <- step(seasonstatsmodel.glm.null, scope = list(seasonstatsmodel.glm.null, upper = seasonstatsmodel.glm), direction = "forward")
## Start:  AIC=1771.64
## isAllStar ~ 1
## 
##               Df Deviance     AIC
## + PER          1   980.61  984.61
## + PTSGame      1  1065.55 1069.55
## + VORP         1  1138.59 1142.59
## + WS           1  1142.93 1146.93
## + FTAGame      1  1170.56 1174.56
## + FTGame       1  1173.40 1177.40
## + TwoPGame     1  1187.60 1191.60
## + BPM          1  1197.55 1201.55
## + OWS          1  1220.61 1224.61
## + TwoPAGame    1  1234.21 1238.21
## + WS48         1  1259.83 1263.83
## + USGP         1  1276.25 1280.25
## + OBPM         1  1287.65 1291.65
## + TOVGame      1  1356.88 1360.88
## + DWS          1  1470.20 1474.20
## + ASTGame      1  1557.47 1561.47
## + TRBGame      1  1579.00 1583.00
## + STLGame      1  1595.39 1599.39
## + ASTP         1  1631.79 1635.79
## + FTr          1  1637.62 1641.62
## + TSP          1  1652.17 1656.17
## + BLKGame      1  1688.22 1692.22
## + FGP          1  1692.92 1696.92
## + TwoPP        1  1704.34 1708.34
## + DRBP         1  1707.67 1711.67
## + DBPM         1  1715.46 1719.46
## + PF           1  1715.58 1719.58
## + TRBP         1  1728.75 1732.75
## + ThreePAr     1  1735.75 1739.75
## + eFGP         1  1736.56 1740.56
## + BLKP         1  1746.57 1750.57
## + PFGame       1  1746.83 1750.83
## + STLP         1  1751.43 1755.43
## + FTP          1  1752.65 1756.65
## + ThreePAGame  1  1754.87 1758.87
## + ThreePGame   1  1755.28 1759.28
## + ORBP         1  1763.93 1767.93
## + TOVP         1  1765.41 1769.41
## <none>            1769.64 1771.64
## + ThreePP      1  1768.02 1772.02
## 
## Step:  AIC=984.61
## isAllStar ~ PER
## 
##               Df Deviance    AIC
## + TOVGame      1   916.99 922.99
## + PTSGame      1   921.55 927.55
## + VORP         1   937.50 943.50
## + ASTGame      1   940.73 946.73
## + FTGame       1   943.60 949.60
## + FTAGame      1   944.22 950.22
## + TwoPAGame    1   948.22 954.22
## + DWS          1   951.60 957.60
## + STLGame      1   953.69 959.69
## + WS           1   954.31 960.31
## + TwoPGame     1   959.31 965.31
## + ASTP         1   960.28 966.28
## + FGP          1   960.29 966.29
## + TwoPP        1   960.59 966.59
## + ORBP         1   960.93 966.93
## + USGP         1   960.93 966.93
## + eFGP         1   965.13 971.13
## + BPM          1   967.17 973.17
## + ThreePAGame  1   967.67 973.67
## + ThreePGame   1   970.32 976.32
## + TSP          1   971.05 977.05
## + TRBP         1   971.12 977.12
## + BLKP         1   971.21 977.21
## + ThreePP      1   971.33 977.33
## + OWS          1   973.62 979.62
## + TOVP         1   974.30 980.30
## + OBPM         1   974.35 980.35
## + DRBP         1   976.25 982.25
## + PF           1   976.79 982.79
## + ThreePAr     1   977.77 983.77
## + STLP         1   977.83 983.83
## + BLKGame      1   978.28 984.28
## <none>             980.61 984.61
## + WS48         1   978.62 984.62
## + FTP          1   979.26 985.26
## + DBPM         1   979.78 985.78
## + FTr          1   980.08 986.08
## + PFGame       1   980.56 986.56
## + TRBGame      1   980.61 986.61
## 
## Step:  AIC=922.99
## isAllStar ~ PER + TOVGame
## 
##               Df Deviance    AIC
## + WS           1   882.31 890.31
## + DWS          1   884.29 892.29
## + VORP         1   885.76 893.76
## + PTSGame      1   900.48 908.48
## + BPM          1   903.15 911.15
## + TOVP         1   904.89 912.89
## + OWS          1   905.87 913.87
## + WS48         1   907.76 915.76
## + TwoPAGame    1   909.40 917.40
## + DBPM         1   910.57 918.57
## + TwoPGame     1   912.03 920.03
## + FTGame       1   912.20 920.20
## + STLGame      1   912.66 920.66
## + FTAGame      1   913.00 921.00
## + ThreePP      1   913.47 921.47
## + ThreePGame   1   913.64 921.64
## + ThreePAGame  1   913.75 921.75
## + TwoPP        1   913.81 921.81
## + ASTGame      1   914.03 922.03
## + ORBP         1   914.03 922.03
## + FGP          1   914.23 922.23
## + TRBGame      1   914.88 922.88
## <none>             916.99 922.99
## + PF           1   915.58 923.58
## + eFGP         1   915.94 923.94
## + TSP          1   916.09 924.09
## + OBPM         1   916.16 924.16
## + ThreePAr     1   916.16 924.16
## + PFGame       1   916.23 924.23
## + BLKP         1   916.57 924.57
## + FTP          1   916.61 924.61
## + FTr          1   916.80 924.80
## + TRBP         1   916.82 924.82
## + USGP         1   916.88 924.88
## + BLKGame      1   916.90 924.90
## + DRBP         1   916.92 924.92
## + STLP         1   916.99 924.99
## + ASTP         1   916.99 924.99
## 
## Step:  AIC=890.31
## isAllStar ~ PER + TOVGame + WS
## 
##               Df Deviance    AIC
## + TOVP         1   867.57 877.57
## + PTSGame      1   867.65 877.65
## + TwoPAGame    1   868.09 878.09
## + TwoPGame     1   873.37 883.37
## + TSP          1   874.17 884.17
## + USGP         1   874.61 884.61
## + OWS          1   875.20 885.20
## + DWS          1   875.21 885.21
## + PF           1   875.47 885.47
## + TwoPP        1   876.34 886.34
## + eFGP         1   876.71 886.71
## + FGP          1   877.95 887.95
## + FTAGame      1   879.65 889.65
## + FTGame       1   879.93 889.93
## + DBPM         1   880.25 890.25
## <none>             882.31 890.31
## + VORP         1   880.34 890.34
## + TRBGame      1   880.36 890.36
## + WS48         1   880.37 890.37
## + PFGame       1   880.85 890.85
## + ThreePP      1   881.01 891.01
## + ThreePAGame  1   881.05 891.05
## + FTr          1   881.18 891.18
## + ThreePGame   1   881.32 891.32
## + STLGame      1   881.40 891.40
## + ORBP         1   881.48 891.48
## + BPM          1   881.51 891.51
## + OBPM         1   881.67 891.67
## + DRBP         1   881.74 891.74
## + ASTGame      1   881.86 891.86
## + BLKGame      1   881.91 891.91
## + STLP         1   881.99 891.99
## + ASTP         1   882.19 892.19
## + FTP          1   882.24 892.24
## + TRBP         1   882.28 892.28
## + BLKP         1   882.30 892.30
## + ThreePAr     1   882.30 892.30
## 
## Step:  AIC=877.57
## isAllStar ~ PER + TOVGame + WS + TOVP
## 
##               Df Deviance    AIC
## + OWS          1   858.95 870.95
## + DWS          1   859.01 871.01
## + PF           1   859.17 871.17
## + DBPM         1   860.42 872.42
## + ASTGame      1   863.84 875.84
## + BPM          1   864.37 876.37
## + TSP          1   864.82 876.82
## + VORP         1   865.29 877.29
## + TwoPAGame    1   865.32 877.32
## + TRBGame      1   865.40 877.40
## <none>             867.57 877.57
## + PFGame       1   865.62 877.62
## + DRBP         1   865.87 877.87
## + OBPM         1   866.01 878.01
## + TwoPP        1   866.40 878.40
## + eFGP         1   866.48 878.48
## + BLKGame      1   866.48 878.48
## + ASTP         1   866.52 878.52
## + FTP          1   866.55 878.55
## + TRBP         1   866.82 878.82
## + TwoPGame     1   866.84 878.84
## + STLGame      1   866.88 878.88
## + BLKP         1   866.89 878.89
## + PTSGame      1   866.98 878.98
## + WS48         1   867.05 879.05
## + FGP          1   867.12 879.12
## + ThreePP      1   867.21 879.21
## + FTGame       1   867.36 879.36
## + ThreePAr     1   867.42 879.42
## + USGP         1   867.42 879.42
## + ThreePAGame  1   867.53 879.53
## + ThreePGame   1   867.54 879.54
## + ORBP         1   867.54 879.54
## + FTr          1   867.54 879.54
## + FTAGame      1   867.55 879.55
## + STLP         1   867.57 879.57
## 
## Step:  AIC=870.95
## isAllStar ~ PER + TOVGame + WS + TOVP + OWS
## 
##               Df Deviance    AIC
## + PF           1   845.48 859.48
## + ASTGame      1   848.58 862.58
## + ASTP         1   854.41 868.41
## + PFGame       1   854.42 868.42
## + PTSGame      1   854.69 868.69
## + ThreePP      1   856.54 870.54
## + ORBP         1   856.63 870.63
## <none>             858.95 870.95
## + BPM          1   857.75 871.75
## + ThreePGame   1   857.83 871.83
## + TwoPP        1   857.84 871.84
## + TRBP         1   857.86 871.86
## + BLKP         1   857.91 871.91
## + FGP          1   857.96 871.96
## + ThreePAGame  1   858.05 872.05
## + OBPM         1   858.10 872.10
## + BLKGame      1   858.37 872.37
## + ThreePAr     1   858.38 872.38
## + VORP         1   858.44 872.44
## + WS48         1   858.47 872.47
## + USGP         1   858.51 872.51
## + DRBP         1   858.57 872.57
## + TwoPAGame    1   858.65 872.65
## + FTP          1   858.71 872.71
## + STLGame      1   858.78 872.78
## + STLP         1   858.78 872.78
## + TSP          1   858.80 872.80
## + DBPM         1   858.82 872.82
## + eFGP         1   858.83 872.83
## + FTr          1   858.89 872.89
## + TRBGame      1   858.91 872.91
## + FTGame       1   858.92 872.92
## + DWS          1   858.93 872.93
## + FTAGame      1   858.93 872.93
## + TwoPGame     1   858.95 872.95
## 
## Step:  AIC=859.48
## isAllStar ~ PER + TOVGame + WS + TOVP + OWS + PF
## 
##               Df Deviance    AIC
## + PTSGame      1   841.17 857.17
## + ASTGame      1   842.33 858.33
## + TwoPAGame    1   842.52 858.52
## + PFGame       1   842.80 858.80
## <none>             845.48 859.48
## + TRBGame      1   843.80 859.80
## + TwoPGame     1   843.97 859.97
## + STLP         1   844.44 860.44
## + DRBP         1   844.82 860.82
## + WS48         1   844.96 860.96
## + DBPM         1   844.96 860.96
## + TRBP         1   845.01 861.01
## + ASTP         1   845.08 861.08
## + ThreePAr     1   845.09 861.09
## + ThreePP      1   845.16 861.16
## + BLKGame      1   845.20 861.20
## + FTAGame      1   845.21 861.21
## + OBPM         1   845.22 861.22
## + FTr          1   845.28 861.28
## + FTGame       1   845.29 861.29
## + TwoPP        1   845.30 861.30
## + FTP          1   845.30 861.30
## + ThreePAGame  1   845.35 861.35
## + USGP         1   845.36 861.36
## + BLKP         1   845.37 861.37
## + TSP          1   845.38 861.38
## + ORBP         1   845.39 861.39
## + STLGame      1   845.42 861.42
## + DWS          1   845.44 861.44
## + eFGP         1   845.44 861.44
## + ThreePGame   1   845.45 861.45
## + VORP         1   845.46 861.46
## + FGP          1   845.47 861.47
## + BPM          1   845.47 861.47
## 
## Step:  AIC=857.17
## isAllStar ~ PER + TOVGame + WS + TOVP + OWS + PF + PTSGame
## 
##               Df Deviance    AIC
## + ASTGame      1   833.42 851.42
## + ASTP         1   838.76 856.76
## + TwoPAGame    1   839.11 857.11
## <none>             841.17 857.17
## + PFGame       1   839.19 857.19
## + TSP          1   839.40 857.40
## + TRBGame      1   839.62 857.62
## + DBPM         1   840.00 858.00
## + eFGP         1   840.19 858.19
## + USGP         1   840.22 858.22
## + ThreePAr     1   840.34 858.34
## + TwoPP        1   840.47 858.47
## + TwoPGame     1   840.50 858.50
## + DRBP         1   840.56 858.56
## + ThreePAGame  1   840.56 858.56
## + WS48         1   840.57 858.57
## + TRBP         1   840.59 858.59
## + STLP         1   840.68 858.68
## + FTP          1   840.69 858.69
## + ThreePGame   1   840.69 858.69
## + BLKGame      1   840.76 858.76
## + ORBP         1   840.84 858.84
## + BLKP         1   840.93 858.93
## + VORP         1   840.96 858.96
## + OBPM         1   840.96 858.96
## + BPM          1   841.03 859.03
## + FGP          1   841.09 859.09
## + FTr          1   841.10 859.10
## + DWS          1   841.11 859.11
## + FTGame       1   841.12 859.12
## + ThreePP      1   841.13 859.13
## + STLGame      1   841.17 859.17
## + FTAGame      1   841.17 859.17
## 
## Step:  AIC=851.42
## isAllStar ~ PER + TOVGame + WS + TOVP + OWS + PF + PTSGame + 
##     ASTGame
## 
##               Df Deviance    AIC
## + ASTP         1   824.05 844.05
## + TRBGame      1   825.48 845.48
## + TRBP         1   825.64 845.64
## + ORBP         1   825.80 845.80
## + DRBP         1   828.39 848.39
## + OBPM         1   829.60 849.60
## + BLKGame      1   829.76 849.76
## + DBPM         1   829.78 849.78
## + BLKP         1   830.11 850.11
## + STLP         1   830.14 850.14
## + ThreePAr     1   830.37 850.37
## + ThreePAGame  1   830.51 850.51
## + FTr          1   830.66 850.66
## + PFGame       1   830.98 850.98
## + ThreePGame   1   831.15 851.15
## + TwoPAGame    1   831.32 851.32
## <none>             833.42 851.42
## + STLGame      1   831.92 851.92
## + TwoPGame     1   832.03 852.03
## + FTAGame      1   832.05 852.05
## + USGP         1   832.18 852.18
## + FGP          1   832.38 852.38
## + FTP          1   832.43 852.43
## + FTGame       1   832.81 852.81
## + WS48         1   833.07 853.07
## + ThreePP      1   833.32 853.32
## + BPM          1   833.37 853.37
## + eFGP         1   833.38 853.38
## + TwoPP        1   833.40 853.40
## + VORP         1   833.40 853.40
## + TSP          1   833.41 853.41
## + DWS          1   833.42 853.42
## 
## Step:  AIC=844.05
## isAllStar ~ PER + TOVGame + WS + TOVP + OWS + PF + PTSGame + 
##     ASTGame + ASTP
## 
##               Df Deviance    AIC
## + STLGame      1   821.15 843.15
## + STLP         1   821.24 843.24
## + FTr          1   821.63 843.63
## + ORBP         1   821.93 843.93
## + USGP         1   822.00 844.00
## + TRBP         1   822.01 844.01
## <none>             824.05 844.05
## + TRBGame      1   822.14 844.14
## + ThreePAGame  1   822.28 844.28
## + ThreePAr     1   822.32 844.32
## + TwoPAGame    1   822.68 844.68
## + FTAGame      1   822.72 844.72
## + ThreePGame   1   822.76 844.76
## + DRBP         1   822.95 844.95
## + FTGame       1   823.05 845.05
## + OBPM         1   823.09 845.09
## + PFGame       1   823.10 845.10
## + DBPM         1   823.25 845.25
## + BLKGame      1   823.27 845.27
## + BLKP         1   823.37 845.37
## + TwoPGame     1   823.54 845.54
## + eFGP         1   823.70 845.70
## + WS48         1   823.85 845.85
## + TwoPP        1   823.86 845.86
## + FTP          1   823.94 845.94
## + FGP          1   823.94 845.94
## + VORP         1   823.99 845.99
## + TSP          1   824.01 846.01
## + BPM          1   824.03 846.03
## + ThreePP      1   824.04 846.04
## + DWS          1   824.04 846.04
## 
## Step:  AIC=843.15
## isAllStar ~ PER + TOVGame + WS + TOVP + OWS + PF + PTSGame + 
##     ASTGame + ASTP + STLGame
## 
##               Df Deviance    AIC
## + FTr          1   818.49 842.49
## <none>             821.15 843.15
## + FTAGame      1   819.64 843.64
## + DBPM         1   819.70 843.70
## + FTGame       1   819.92 843.92
## + USGP         1   819.93 843.93
## + ORBP         1   819.98 843.98
## + PFGame       1   820.01 844.01
## + TRBGame      1   820.27 844.27
## + ThreePAr     1   820.30 844.30
## + ThreePAGame  1   820.34 844.34
## + TRBP         1   820.39 844.39
## + TwoPAGame    1   820.53 844.53
## + ThreePGame   1   820.58 844.58
## + eFGP         1   820.61 844.61
## + BPM          1   820.75 844.75
## + TwoPP        1   820.80 844.80
## + DRBP         1   820.86 844.86
## + VORP         1   820.89 844.89
## + WS48         1   820.95 844.95
## + BLKGame      1   820.95 844.95
## + BLKP         1   821.03 845.03
## + OBPM         1   821.05 845.05
## + FTP          1   821.06 845.06
## + TSP          1   821.07 845.07
## + ThreePP      1   821.07 845.07
## + TwoPGame     1   821.08 845.08
## + FGP          1   821.14 845.14
## + DWS          1   821.15 845.15
## + STLP         1   821.15 845.15
## 
## Step:  AIC=842.49
## isAllStar ~ PER + TOVGame + WS + TOVP + OWS + PF + PTSGame + 
##     ASTGame + ASTP + STLGame + FTr
## 
##               Df Deviance    AIC
## <none>             818.49 842.49
## + USGP         1   816.97 842.97
## + ORBP         1   817.27 843.27
## + DBPM         1   817.29 843.29
## + TRBGame      1   817.51 843.51
## + TwoPAGame    1   817.60 843.60
## + TRBP         1   817.65 843.65
## + FTAGame      1   817.80 843.80
## + WS48         1   817.85 843.85
## + PFGame       1   817.90 843.90
## + VORP         1   818.03 844.03
## + BPM          1   818.03 844.03
## + ThreePAr     1   818.10 844.10
## + ThreePAGame  1   818.14 844.14
## + DRBP         1   818.16 844.16
## + ThreePP      1   818.19 844.19
## + FTGame       1   818.25 844.25
## + TwoPGame     1   818.25 844.25
## + TwoPP        1   818.29 844.29
## + TSP          1   818.30 844.30
## + BLKGame      1   818.34 844.34
## + ThreePGame   1   818.36 844.36
## + BLKP         1   818.41 844.41
## + eFGP         1   818.41 844.41
## + OBPM         1   818.46 844.46
## + DWS          1   818.47 844.47
## + STLP         1   818.49 844.49
## + FGP          1   818.49 844.49
## + FTP          1   818.49 844.49
summary(seasonstatsmodel.glm.fwd)
## 
## Call:
## glm(formula = isAllStar ~ PER + TOVGame + WS + TOVP + OWS + PF + 
##     PTSGame + ASTGame + ASTP + STLGame + FTr, family = "binomial", 
##     data = seasonstatsmodel.train)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -2.20927  -0.23958  -0.10281  -0.04741   3.00470  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -12.650194   1.609283  -7.861 3.82e-15 ***
## PER           0.287937   0.054005   5.332 9.73e-08 ***
## TOVGame      -0.332723   0.606091  -0.549  0.58303    
## WS            0.545897   0.083794   6.515 7.28e-11 ***
## TOVP          0.060048   0.107118   0.561  0.57508    
## OWS          -0.584125   0.108786  -5.369 7.90e-08 ***
## PF           -0.004080   0.002345  -1.740  0.08187 .  
## PTSGame       0.248910   0.086470   2.879  0.00399 ** 
## ASTGame       0.884862   0.211441   4.185 2.85e-05 ***
## ASTP         -0.133102   0.042741  -3.114  0.00184 ** 
## STLGame      -0.452017   0.256846  -1.760  0.07843 .  
## FTr           1.645029   1.001094   1.643  0.10033    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 1769.64  on 2498  degrees of freedom
## Residual deviance:  818.49  on 2487  degrees of freedom
## AIC: 842.49
## 
## Number of Fisher Scoring iterations: 7
sum.fwd <- summary(seasonstatsmodel.glm.fwd)
dim(sum.fwd$coefficients)
## [1] 12  4
AIC(seasonstatsmodel.glm.fwd)
## [1] 842.488
pred.glm.train2 <- predict(seasonstatsmodel.glm.fwd, type = "response")
pred.glm.valid2 <- predict(seasonstatsmodel.glm.fwd, newdata = seasonstatsmodel.valid, type = "response")
confusionMatrix(as.factor(ifelse(pred.glm.train2 >= optimal.pcut.glm, "1", "0")), as.factor(seasonstatsmodel.train$isAllStar), 
                positive = "1")
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction    0    1
##          0 1224    0
##          1  991  284
##                                           
##                Accuracy : 0.6034          
##                  95% CI : (0.5839, 0.6227)
##     No Information Rate : 0.8864          
##     P-Value [Acc > NIR] : 1               
##                                           
##                   Kappa : 0.2192          
##                                           
##  Mcnemar's Test P-Value : <2e-16          
##                                           
##             Sensitivity : 1.0000          
##             Specificity : 0.5526          
##          Pos Pred Value : 0.2227          
##          Neg Pred Value : 1.0000          
##              Prevalence : 0.1136          
##          Detection Rate : 0.1136          
##    Detection Prevalence : 0.5102          
##       Balanced Accuracy : 0.7763          
##                                           
##        'Positive' Class : 1               
## 
#0.8455 accuracy


#Perform backward elimination - Best
seasonstatsmodel.glm.back <- step(seasonstatsmodel.glm.full, direction = "backward")
## Start:  AIC=872.89
## isAllStar ~ PF + PER + TSP + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + STLP + BLKP + TOVP + USGP + OWS + DWS + WS + WS48 + 
##     OBPM + DBPM + BPM + VORP + FGP + ThreePP + TwoPP + eFGP + 
##     FTP + TOVGame + STLGame + BLKGame + PTSGame + TRBGame + ASTGame + 
##     FTGame + FTAGame + PFGame + TwoPGame + TwoPAGame + ThreePAGame + 
##     ThreePGame
## 
## 
## Step:  AIC=872.89
## isAllStar ~ PF + PER + TSP + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + STLP + BLKP + TOVP + USGP + OWS + DWS + WS + WS48 + 
##     OBPM + DBPM + BPM + VORP + FGP + ThreePP + TwoPP + eFGP + 
##     FTP + TOVGame + STLGame + BLKGame + PTSGame + TRBGame + ASTGame + 
##     FTGame + FTAGame + PFGame + TwoPGame + TwoPAGame + ThreePAGame
## 
##               Df Deviance    AIC
## - FTP          1   794.89 870.89
## - OWS          1   794.89 870.89
## - BLKGame      1   794.90 870.90
## - DWS          1   794.91 870.91
## - WS           1   794.93 870.93
## - TSP          1   794.96 870.96
## - STLP         1   794.97 870.97
## - BLKP         1   794.98 870.98
## - PFGame       1   795.00 871.00
## - STLGame      1   795.03 871.03
## - ThreePAGame  1   795.03 871.03
## - PTSGame      1   795.08 871.08
## - TOVP         1   795.17 871.17
## - WS48         1   795.18 871.18
## - TwoPGame     1   795.26 871.26
## - TwoPAGame    1   795.27 871.27
## - DRBP         1   795.30 871.30
## - PER          1   795.36 871.36
## - OBPM         1   795.46 871.46
## - DBPM         1   795.56 871.56
## - VORP         1   795.56 871.56
## - ThreePP      1   795.60 871.60
## - ORBP         1   795.77 871.77
## - TRBP         1   795.82 871.82
## - BPM          1   795.85 871.85
## - TwoPP        1   796.03 872.03
## - FTGame       1   796.08 872.08
## - FTAGame      1   796.63 872.63
## <none>             794.89 872.89
## - FGP          1   796.96 872.96
## - ThreePAr     1   796.99 872.99
## - eFGP         1   797.15 873.15
## - TRBGame      1   797.52 873.52
## - TOVGame      1   797.60 873.60
## - PF           1   797.74 873.74
## - FTr          1   798.00 874.00
## - ASTP         1   801.86 877.86
## - USGP         1   803.87 879.87
## - ASTGame      1   812.53 888.53
## 
## Step:  AIC=870.89
## isAllStar ~ PF + PER + TSP + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + STLP + BLKP + TOVP + USGP + OWS + DWS + WS + WS48 + 
##     OBPM + DBPM + BPM + VORP + FGP + ThreePP + TwoPP + eFGP + 
##     TOVGame + STLGame + BLKGame + PTSGame + TRBGame + ASTGame + 
##     FTGame + FTAGame + PFGame + TwoPGame + TwoPAGame + ThreePAGame
## 
##               Df Deviance    AIC
## - OWS          1   794.89 868.89
## - BLKGame      1   794.90 868.90
## - DWS          1   794.91 868.91
## - WS           1   794.93 868.93
## - STLP         1   794.97 868.97
## - BLKP         1   794.98 868.98
## - TSP          1   794.98 868.98
## - PFGame       1   795.00 869.00
## - STLGame      1   795.03 869.03
## - ThreePAGame  1   795.03 869.03
## - PTSGame      1   795.08 869.08
## - TOVP         1   795.17 869.17
## - WS48         1   795.18 869.18
## - TwoPGame     1   795.26 869.26
## - TwoPAGame    1   795.27 869.27
## - DRBP         1   795.30 869.30
## - PER          1   795.36 869.36
## - OBPM         1   795.46 869.46
## - DBPM         1   795.56 869.56
## - VORP         1   795.56 869.56
## - ThreePP      1   795.60 869.60
## - ORBP         1   795.78 869.78
## - TRBP         1   795.82 869.82
## - BPM          1   795.85 869.85
## - TwoPP        1   796.06 870.06
## - FTGame       1   796.14 870.14
## <none>             794.89 870.89
## - FGP          1   796.97 870.97
## - FTAGame      1   796.99 870.99
## - ThreePAr     1   796.99 870.99
## - eFGP         1   797.18 871.18
## - TRBGame      1   797.56 871.56
## - TOVGame      1   797.62 871.62
## - PF           1   797.74 871.74
## - FTr          1   798.00 872.00
## - ASTP         1   801.87 875.87
## - USGP         1   803.87 877.87
## - ASTGame      1   812.59 886.59
## 
## Step:  AIC=868.89
## isAllStar ~ PF + PER + TSP + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + STLP + BLKP + TOVP + USGP + DWS + WS + WS48 + OBPM + 
##     DBPM + BPM + VORP + FGP + ThreePP + TwoPP + eFGP + TOVGame + 
##     STLGame + BLKGame + PTSGame + TRBGame + ASTGame + FTGame + 
##     FTAGame + PFGame + TwoPGame + TwoPAGame + ThreePAGame
## 
##               Df Deviance    AIC
## - BLKGame      1   794.91 866.91
## - STLP         1   794.97 866.97
## - BLKP         1   794.98 866.98
## - TSP          1   794.99 866.99
## - PFGame       1   795.01 867.01
## - STLGame      1   795.03 867.03
## - ThreePAGame  1   795.04 867.04
## - PTSGame      1   795.09 867.09
## - TOVP         1   795.17 867.17
## - WS48         1   795.19 867.19
## - TwoPGame     1   795.27 867.27
## - TwoPAGame    1   795.27 867.27
## - DRBP         1   795.30 867.30
## - PER          1   795.37 867.37
## - OBPM         1   795.46 867.46
## - VORP         1   795.57 867.57
## - DBPM         1   795.57 867.57
## - ThreePP      1   795.60 867.60
## - ORBP         1   795.79 867.79
## - TRBP         1   795.83 867.83
## - BPM          1   795.85 867.85
## - TwoPP        1   796.06 868.06
## - FTGame       1   796.16 868.16
## - WS           1   796.43 868.43
## <none>             794.89 868.89
## - FGP          1   796.97 868.97
## - ThreePAr     1   796.99 868.99
## - FTAGame      1   797.03 869.03
## - eFGP         1   797.18 869.18
## - DWS          1   797.26 869.26
## - TRBGame      1   797.56 869.56
## - TOVGame      1   797.63 869.63
## - PF           1   797.76 869.76
## - FTr          1   798.04 870.04
## - ASTP         1   801.88 873.88
## - USGP         1   803.88 875.88
## - ASTGame      1   812.59 884.59
## 
## Step:  AIC=866.91
## isAllStar ~ PF + PER + TSP + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + STLP + BLKP + TOVP + USGP + DWS + WS + WS48 + OBPM + 
##     DBPM + BPM + VORP + FGP + ThreePP + TwoPP + eFGP + TOVGame + 
##     STLGame + PTSGame + TRBGame + ASTGame + FTGame + FTAGame + 
##     PFGame + TwoPGame + TwoPAGame + ThreePAGame
## 
##               Df Deviance    AIC
## - STLP         1   794.98 864.98
## - TSP          1   795.00 865.00
## - STLGame      1   795.04 865.04
## - PFGame       1   795.04 865.04
## - ThreePAGame  1   795.05 865.05
## - PTSGame      1   795.10 865.10
## - TOVP         1   795.18 865.18
## - WS48         1   795.23 865.23
## - TwoPGame     1   795.28 865.28
## - TwoPAGame    1   795.30 865.30
## - DRBP         1   795.30 865.30
## - PER          1   795.37 865.37
## - OBPM         1   795.47 865.47
## - DBPM         1   795.58 865.58
## - VORP         1   795.58 865.58
## - ThreePP      1   795.61 865.61
## - ORBP         1   795.79 865.79
## - TRBP         1   795.83 865.83
## - BLKP         1   795.86 865.86
## - BPM          1   795.86 865.86
## - TwoPP        1   796.08 866.08
## - FTGame       1   796.16 866.16
## - WS           1   796.45 866.45
## <none>             794.91 866.91
## - FGP          1   797.00 867.00
## - ThreePAr     1   797.03 867.03
## - FTAGame      1   797.03 867.03
## - eFGP         1   797.21 867.21
## - DWS          1   797.43 867.43
## - TOVGame      1   797.63 867.63
## - PF           1   797.83 867.83
## - FTr          1   798.04 868.04
## - TRBGame      1   798.97 868.97
## - ASTP         1   801.89 871.89
## - USGP         1   803.89 873.89
## - ASTGame      1   812.66 882.66
## 
## Step:  AIC=864.98
## isAllStar ~ PF + PER + TSP + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + BLKP + TOVP + USGP + DWS + WS + WS48 + OBPM + DBPM + 
##     BPM + VORP + FGP + ThreePP + TwoPP + eFGP + TOVGame + STLGame + 
##     PTSGame + TRBGame + ASTGame + FTGame + FTAGame + PFGame + 
##     TwoPGame + TwoPAGame + ThreePAGame
## 
##               Df Deviance    AIC
## - TSP          1   795.07 863.07
## - PFGame       1   795.10 863.10
## - STLGame      1   795.10 863.10
## - ThreePAGame  1   795.15 863.15
## - PTSGame      1   795.18 863.18
## - TOVP         1   795.22 863.22
## - WS48         1   795.27 863.27
## - TwoPAGame    1   795.35 863.35
## - DRBP         1   795.37 863.37
## - TwoPGame     1   795.38 863.38
## - PER          1   795.49 863.49
## - OBPM         1   795.54 863.54
## - VORP         1   795.59 863.59
## - DBPM         1   795.65 863.65
## - ThreePP      1   795.68 863.68
## - ORBP         1   795.86 863.86
## - TRBP         1   795.90 863.90
## - BPM          1   795.92 863.92
## - BLKP         1   796.03 864.03
## - TwoPP        1   796.16 864.16
## - FTGame       1   796.28 864.28
## - WS           1   796.46 864.46
## <none>             794.98 864.98
## - FTAGame      1   797.09 865.09
## - FGP          1   797.15 865.15
## - ThreePAr     1   797.20 865.20
## - eFGP         1   797.36 865.36
## - DWS          1   797.55 865.55
## - TOVGame      1   797.63 865.63
## - PF           1   797.90 865.90
## - FTr          1   798.11 866.11
## - TRBGame      1   799.30 867.30
## - ASTP         1   802.60 870.60
## - USGP         1   804.09 872.09
## - ASTGame      1   816.03 884.03
## 
## Step:  AIC=863.07
## isAllStar ~ PF + PER + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + BLKP + TOVP + USGP + DWS + WS + WS48 + OBPM + DBPM + 
##     BPM + VORP + FGP + ThreePP + TwoPP + eFGP + TOVGame + STLGame + 
##     PTSGame + TRBGame + ASTGame + FTGame + FTAGame + PFGame + 
##     TwoPGame + TwoPAGame + ThreePAGame
## 
##               Df Deviance    AIC
## - PFGame       1   795.19 861.19
## - STLGame      1   795.21 861.21
## - ThreePAGame  1   795.26 861.26
## - PTSGame      1   795.26 861.26
## - TwoPAGame    1   795.37 861.37
## - WS48         1   795.37 861.37
## - TOVP         1   795.38 861.38
## - TwoPGame     1   795.44 861.44
## - DRBP         1   795.44 861.44
## - PER          1   795.59 861.59
## - OBPM         1   795.62 861.62
## - VORP         1   795.68 861.68
## - DBPM         1   795.73 861.73
## - ThreePP      1   795.78 861.78
## - ORBP         1   795.93 861.93
## - TRBP         1   795.96 861.96
## - BPM          1   796.00 862.00
## - BLKP         1   796.17 862.17
## - TwoPP        1   796.20 862.20
## - FTGame       1   796.53 862.53
## - WS           1   796.59 862.59
## <none>             795.07 863.07
## - FGP          1   797.16 863.16
## - ThreePAr     1   797.23 863.23
## - eFGP         1   797.41 863.41
## - DWS          1   797.69 863.69
## - TOVGame      1   797.97 863.97
## - PF           1   798.10 864.10
## - FTr          1   798.29 864.29
## - FTAGame      1   798.74 864.74
## - TRBGame      1   799.34 865.34
## - ASTP         1   802.63 868.63
## - USGP         1   804.16 870.16
## - ASTGame      1   816.07 882.07
## 
## Step:  AIC=861.19
## isAllStar ~ PF + PER + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + BLKP + TOVP + USGP + DWS + WS + WS48 + OBPM + DBPM + 
##     BPM + VORP + FGP + ThreePP + TwoPP + eFGP + TOVGame + STLGame + 
##     PTSGame + TRBGame + ASTGame + FTGame + FTAGame + TwoPGame + 
##     TwoPAGame + ThreePAGame
## 
##               Df Deviance    AIC
## - ThreePAGame  1   795.34 859.34
## - PTSGame      1   795.35 859.35
## - WS48         1   795.37 859.37
## - TOVP         1   795.52 859.52
## - STLGame      1   795.53 859.53
## - TwoPGame     1   795.54 859.54
## - TwoPAGame    1   795.56 859.56
## - DRBP         1   795.61 859.61
## - OBPM         1   795.71 859.71
## - VORP         1   795.74 859.74
## - DBPM         1   795.84 859.84
## - ThreePP      1   795.89 859.89
## - BPM          1   796.08 860.08
## - ORBP         1   796.14 860.14
## - TRBP         1   796.18 860.18
## - PER          1   796.22 860.22
## - TwoPP        1   796.28 860.28
## - FTGame       1   796.60 860.60
## - WS           1   796.67 860.67
## - BLKP         1   796.83 860.83
## <none>             795.19 861.19
## - FGP          1   797.23 861.23
## - ThreePAr     1   797.30 861.30
## - eFGP         1   797.48 861.48
## - DWS          1   797.72 861.72
## - TOVGame      1   798.36 862.36
## - FTr          1   798.38 862.38
## - FTAGame      1   798.93 862.93
## - TRBGame      1   800.55 864.55
## - PF           1   802.04 866.04
## - ASTP         1   802.67 866.67
## - USGP         1   806.27 870.27
## - ASTGame      1   816.91 880.91
## 
## Step:  AIC=859.34
## isAllStar ~ PF + PER + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + BLKP + TOVP + USGP + DWS + WS + WS48 + OBPM + DBPM + 
##     BPM + VORP + FGP + ThreePP + TwoPP + eFGP + TOVGame + STLGame + 
##     PTSGame + TRBGame + ASTGame + FTGame + FTAGame + TwoPGame + 
##     TwoPAGame
## 
##             Df Deviance    AIC
## - PTSGame    1   795.35 857.35
## - WS48       1   795.53 857.53
## - TwoPGame   1   795.64 857.64
## - TOVP       1   795.66 857.66
## - TwoPAGame  1   795.66 857.66
## - STLGame    1   795.74 857.74
## - DRBP       1   795.79 857.79
## - OBPM       1   795.85 857.85
## - VORP       1   795.92 857.92
## - DBPM       1   795.99 857.99
## - ThreePP    1   796.00 858.00
## - BPM        1   796.24 858.24
## - ORBP       1   796.34 858.34
## - TRBP       1   796.35 858.35
## - TwoPP      1   796.42 858.42
## - PER        1   796.51 858.51
## - WS         1   796.83 858.83
## - BLKP       1   797.14 859.14
## <none>           795.34 859.34
## - DWS        1   797.99 859.99
## - FTr        1   798.39 860.39
## - TOVGame    1   798.53 860.53
## - FGP        1   798.64 860.64
## - FTGame     1   798.73 860.73
## - FTAGame    1   798.96 860.96
## - ThreePAr   1   799.30 861.30
## - eFGP       1   800.27 862.27
## - TRBGame    1   800.64 862.64
## - PF         1   802.51 864.51
## - ASTP       1   802.85 864.85
## - USGP       1   806.73 868.73
## - ASTGame    1   817.43 879.43
## 
## Step:  AIC=857.35
## isAllStar ~ PF + PER + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + BLKP + TOVP + USGP + DWS + WS + WS48 + OBPM + DBPM + 
##     BPM + VORP + FGP + ThreePP + TwoPP + eFGP + TOVGame + STLGame + 
##     TRBGame + ASTGame + FTGame + FTAGame + TwoPGame + TwoPAGame
## 
##             Df Deviance    AIC
## - WS48       1   795.54 855.54
## - TwoPGame   1   795.64 855.64
## - TwoPAGame  1   795.67 855.67
## - TOVP       1   795.71 855.71
## - STLGame    1   795.75 855.75
## - DRBP       1   795.79 855.79
## - OBPM       1   795.86 855.86
## - VORP       1   795.92 855.92
## - DBPM       1   795.99 855.99
## - ThreePP    1   796.00 856.00
## - BPM        1   796.24 856.24
## - ORBP       1   796.34 856.34
## - TRBP       1   796.37 856.37
## - TwoPP      1   796.45 856.45
## - PER        1   796.54 856.54
## - WS         1   796.83 856.83
## - BLKP       1   797.23 857.23
## <none>           795.35 857.35
## - DWS        1   798.00 858.00
## - FTr        1   798.46 858.46
## - FGP        1   798.64 858.64
## - TOVGame    1   798.72 858.72
## - FTAGame    1   798.96 858.96
## - FTGame     1   799.28 859.28
## - ThreePAr   1   799.31 859.31
## - eFGP       1   800.34 860.34
## - TRBGame    1   801.02 861.02
## - PF         1   802.70 862.70
## - ASTP       1   804.42 864.42
## - USGP       1   809.42 869.42
## - ASTGame    1   821.51 881.51
## 
## Step:  AIC=855.54
## isAllStar ~ PF + PER + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + BLKP + TOVP + USGP + DWS + WS + OBPM + DBPM + BPM + 
##     VORP + FGP + ThreePP + TwoPP + eFGP + TOVGame + STLGame + 
##     TRBGame + ASTGame + FTGame + FTAGame + TwoPGame + TwoPAGame
## 
##             Df Deviance    AIC
## - TwoPGame   1   795.87 853.87
## - TwoPAGame  1   795.87 853.87
## - VORP       1   795.92 853.92
## - TOVP       1   795.96 853.96
## - OBPM       1   796.06 854.06
## - DRBP       1   796.10 854.10
## - STLGame    1   796.20 854.20
## - ThreePP    1   796.20 854.20
## - DBPM       1   796.22 854.22
## - BPM        1   796.39 854.39
## - TwoPP      1   796.63 854.63
## - ORBP       1   796.66 854.66
## - TRBP       1   796.72 854.72
## - WS         1   796.85 854.85
## <none>           795.54 855.54
## - PER        1   797.72 855.72
## - DWS        1   798.00 856.00
## - BLKP       1   798.10 856.10
## - FTr        1   798.56 856.56
## - FGP        1   798.81 856.81
## - TOVGame    1   798.93 856.93
## - FTAGame    1   799.02 857.02
## - FTGame     1   799.30 857.30
## - ThreePAr   1   799.49 857.49
## - eFGP       1   800.49 858.49
## - TRBGame    1   801.60 859.60
## - PF         1   802.79 860.79
## - ASTP       1   804.43 862.43
## - USGP       1   811.23 869.23
## - ASTGame    1   821.52 879.52
## 
## Step:  AIC=853.87
## isAllStar ~ PF + PER + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + BLKP + TOVP + USGP + DWS + WS + OBPM + DBPM + BPM + 
##     VORP + FGP + ThreePP + TwoPP + eFGP + TOVGame + STLGame + 
##     TRBGame + ASTGame + FTGame + FTAGame + TwoPAGame
## 
##             Df Deviance    AIC
## - TwoPAGame  1   795.88 851.88
## - VORP       1   796.22 852.22
## - STLGame    1   796.27 852.27
## - TOVP       1   796.29 852.29
## - DRBP       1   796.35 852.35
## - OBPM       1   796.46 852.46
## - ThreePP    1   796.54 852.54
## - DBPM       1   796.57 852.57
## - BPM        1   796.76 852.76
## - ORBP       1   796.86 852.86
## - TRBP       1   797.01 853.01
## - TwoPP      1   797.04 853.04
## - WS         1   797.11 853.11
## - PER        1   797.76 853.76
## <none>           795.87 853.87
## - BLKP       1   798.10 854.10
## - DWS        1   798.18 854.18
## - FTr        1   798.56 854.56
## - FGP        1   798.96 854.96
## - FTAGame    1   799.03 855.03
## - TOVGame    1   799.05 855.05
## - FTGame     1   799.31 855.31
## - ThreePAr   1   799.64 855.64
## - eFGP       1   800.87 856.87
## - TRBGame    1   802.25 858.25
## - PF         1   802.82 858.82
## - ASTP       1   805.30 861.30
## - USGP       1   811.40 867.40
## - ASTGame    1   821.57 877.57
## 
## Step:  AIC=851.88
## isAllStar ~ PF + PER + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + BLKP + TOVP + USGP + DWS + WS + OBPM + DBPM + BPM + 
##     VORP + FGP + ThreePP + TwoPP + eFGP + TOVGame + STLGame + 
##     TRBGame + ASTGame + FTGame + FTAGame
## 
##            Df Deviance    AIC
## - VORP      1   796.24 850.24
## - STLGame   1   796.28 850.28
## - DRBP      1   796.36 850.36
## - TOVP      1   796.38 850.38
## - OBPM      1   796.48 850.48
## - ThreePP   1   796.56 850.56
## - DBPM      1   796.58 850.58
## - BPM       1   796.78 850.78
## - ORBP      1   796.87 850.87
## - TRBP      1   797.01 851.01
## - TwoPP     1   797.06 851.06
## - WS        1   797.13 851.13
## - PER       1   797.76 851.76
## <none>          795.88 851.88
## - BLKP      1   798.11 852.11
## - DWS       1   798.23 852.23
## - FGP       1   798.96 852.96
## - TOVGame   1   799.09 853.09
## - FTAGame   1   799.22 853.22
## - FTGame    1   799.31 853.31
## - FTr       1   799.53 853.53
## - ThreePAr  1   799.99 853.99
## - eFGP      1   800.88 854.88
## - PF        1   802.83 856.83
## - TRBGame   1   805.05 859.05
## - ASTP      1   805.75 859.75
## - USGP      1   817.62 871.62
## - ASTGame   1   824.23 878.23
## 
## Step:  AIC=850.24
## isAllStar ~ PF + PER + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + BLKP + TOVP + USGP + DWS + WS + OBPM + DBPM + BPM + 
##     FGP + ThreePP + TwoPP + eFGP + TOVGame + STLGame + TRBGame + 
##     ASTGame + FTGame + FTAGame
## 
##            Df Deviance    AIC
## - STLGame   1   796.48 848.48
## - DRBP      1   796.64 848.64
## - TOVP      1   796.69 848.69
## - OBPM      1   796.84 848.84
## - ThreePP   1   796.90 848.90
## - DBPM      1   796.93 848.93
## - BPM       1   797.05 849.05
## - ORBP      1   797.13 849.13
## - WS        1   797.18 849.18
## - TRBP      1   797.26 849.26
## - TwoPP     1   797.41 849.41
## - PER       1   797.77 849.77
## - BLKP      1   798.15 850.15
## <none>          796.24 850.24
## - DWS       1   798.93 850.93
## - FGP       1   799.36 851.36
## - TOVGame   1   799.50 851.50
## - FTAGame   1   799.75 851.75
## - FTr       1   799.96 851.96
## - FTGame    1   800.06 852.06
## - ThreePAr  1   800.37 852.37
## - eFGP      1   801.36 853.36
## - PF        1   803.02 855.02
## - TRBGame   1   805.16 857.16
## - ASTP      1   805.86 857.86
## - USGP      1   817.82 869.82
## - ASTGame   1   824.27 876.27
## 
## Step:  AIC=848.48
## isAllStar ~ PF + PER + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + BLKP + TOVP + USGP + DWS + WS + OBPM + DBPM + BPM + 
##     FGP + ThreePP + TwoPP + eFGP + TOVGame + TRBGame + ASTGame + 
##     FTGame + FTAGame
## 
##            Df Deviance    AIC
## - TOVP      1   796.86 846.86
## - DRBP      1   796.98 846.98
## - OBPM      1   797.12 847.12
## - ThreePP   1   797.14 847.14
## - DBPM      1   797.16 847.16
## - WS        1   797.24 847.24
## - BPM       1   797.32 847.32
## - ORBP      1   797.51 847.51
## - TwoPP     1   797.59 847.59
## - TRBP      1   797.73 847.73
## - PER       1   797.84 847.84
## - BLKP      1   798.29 848.29
## <none>          796.48 848.48
## - DWS       1   799.20 849.20
## - FGP       1   799.45 849.45
## - TOVGame   1   799.50 849.50
## - FTAGame   1   799.78 849.78
## - FTGame    1   800.08 850.08
## - FTr       1   800.21 850.21
## - ThreePAr  1   800.39 850.39
## - eFGP      1   801.37 851.37
## - PF        1   803.15 853.15
## - TRBGame   1   805.23 855.23
## - ASTP      1   807.86 857.86
## - USGP      1   819.41 869.41
## - ASTGame   1   825.43 875.43
## 
## Step:  AIC=846.86
## isAllStar ~ PF + PER + ThreePAr + FTr + ORBP + DRBP + TRBP + 
##     ASTP + BLKP + USGP + DWS + WS + OBPM + DBPM + BPM + FGP + 
##     ThreePP + TwoPP + eFGP + TOVGame + TRBGame + ASTGame + FTGame + 
##     FTAGame
## 
##            Df Deviance    AIC
## - DRBP      1   797.29 845.29
## - ThreePP   1   797.51 845.51
## - DBPM      1   797.54 845.54
## - OBPM      1   797.56 845.56
## - BPM       1   797.71 845.71
## - WS        1   797.72 845.72
## - ORBP      1   797.84 845.84
## - TRBP      1   797.95 845.95
## - PER       1   797.96 845.96
## - TwoPP     1   797.97 845.97
## - BLKP      1   798.39 846.39
## <none>          796.86 846.86
## - DWS       1   799.34 847.34
## - FGP       1   800.01 848.01
## - FTGame    1   800.69 848.69
## - ThreePAr  1   800.81 848.81
## - FTAGame   1   801.40 849.40
## - eFGP      1   802.09 850.09
## - TOVGame   1   802.17 850.17
## - FTr       1   802.35 850.35
## - PF        1   803.29 851.29
## - TRBGame   1   805.32 853.32
## - ASTP      1   808.72 856.72
## - USGP      1   822.91 870.91
## - ASTGame   1   827.53 875.53
## 
## Step:  AIC=845.29
## isAllStar ~ PF + PER + ThreePAr + FTr + ORBP + TRBP + ASTP + 
##     BLKP + USGP + DWS + WS + OBPM + DBPM + BPM + FGP + ThreePP + 
##     TwoPP + eFGP + TOVGame + TRBGame + ASTGame + FTGame + FTAGame
## 
##            Df Deviance    AIC
## - ThreePP   1   797.92 843.92
## - DBPM      1   797.98 843.98
## - OBPM      1   798.00 844.00
## - WS        1   798.03 844.03
## - BPM       1   798.15 844.15
## - PER       1   798.24 844.24
## - TwoPP     1   798.30 844.30
## - BLKP      1   798.78 844.78
## - ORBP      1   799.25 845.25
## <none>          797.29 845.29
## - DWS       1   799.58 845.58
## - FGP       1   800.29 846.29
## - FTGame    1   800.85 846.85
## - ThreePAr  1   801.05 847.05
## - TRBP      1   801.05 847.05
## - FTAGame   1   801.52 847.52
## - eFGP      1   802.29 848.29
## - FTr       1   802.57 848.57
## - TOVGame   1   802.73 848.73
## - PF        1   803.31 849.31
## - TRBGame   1   806.23 852.23
## - ASTP      1   808.87 854.87
## - USGP      1   822.91 868.91
## - ASTGame   1   827.57 873.57
## 
## Step:  AIC=843.92
## isAllStar ~ PF + PER + ThreePAr + FTr + ORBP + TRBP + ASTP + 
##     BLKP + USGP + DWS + WS + OBPM + DBPM + BPM + FGP + TwoPP + 
##     eFGP + TOVGame + TRBGame + ASTGame + FTGame + FTAGame
## 
##            Df Deviance    AIC
## - DBPM      1   798.57 842.57
## - OBPM      1   798.58 842.58
## - WS        1   798.65 842.65
## - BPM       1   798.73 842.73
## - PER       1   798.86 842.86
## - TwoPP     1   799.01 843.01
## - BLKP      1   799.29 843.29
## - ORBP      1   799.64 843.64
## <none>          797.92 843.92
## - DWS       1   800.29 844.29
## - FGP       1   801.35 845.35
## - FTGame    1   801.47 845.47
## - TRBP      1   801.71 845.71
## - FTAGame   1   802.08 846.08
## - ThreePAr  1   802.08 846.08
## - FTr       1   803.05 847.05
## - TOVGame   1   803.21 847.21
## - eFGP      1   803.65 847.65
## - PF        1   804.18 848.18
## - TRBGame   1   807.02 851.02
## - ASTP      1   809.50 853.50
## - USGP      1   823.45 867.45
## - ASTGame   1   828.01 872.01
## 
## Step:  AIC=842.57
## isAllStar ~ PF + PER + ThreePAr + FTr + ORBP + TRBP + ASTP + 
##     BLKP + USGP + DWS + WS + OBPM + BPM + FGP + TwoPP + eFGP + 
##     TOVGame + TRBGame + ASTGame + FTGame + FTAGame
## 
##            Df Deviance    AIC
## - OBPM      1   798.58 840.58
## - WS        1   799.32 841.32
## - PER       1   799.49 841.49
## - TwoPP     1   799.75 841.75
## - BLKP      1   799.75 841.75
## - BPM       1   799.80 841.80
## - ORBP      1   800.43 842.43
## <none>          798.57 842.57
## - DWS       1   800.80 842.80
## - FGP       1   802.18 844.18
## - FTGame    1   802.22 844.22
## - TRBP      1   802.50 844.50
## - FTAGame   1   802.73 844.73
## - ThreePAr  1   802.90 844.90
## - FTr       1   803.57 845.57
## - TOVGame   1   803.97 845.97
## - eFGP      1   804.57 846.57
## - PF        1   804.71 846.71
## - TRBGame   1   807.59 849.59
## - ASTP      1   810.13 852.13
## - USGP      1   824.46 866.46
## - ASTGame   1   828.65 870.65
## 
## Step:  AIC=840.58
## isAllStar ~ PF + PER + ThreePAr + FTr + ORBP + TRBP + ASTP + 
##     BLKP + USGP + DWS + WS + BPM + FGP + TwoPP + eFGP + TOVGame + 
##     TRBGame + ASTGame + FTGame + FTAGame
## 
##            Df Deviance    AIC
## - WS        1   799.41 839.41
## - PER       1   799.75 839.75
## - TwoPP     1   799.79 839.79
## <none>          798.58 840.58
## - BLKP      1   800.79 840.79
## - ORBP      1   800.83 840.83
## - BPM       1   801.61 841.61
## - FTGame    1   802.22 842.22
## - FGP       1   802.25 842.25
## - FTAGame   1   802.74 842.74
## - ThreePAr  1   803.20 843.20
## - FTr       1   803.58 843.58
## - TRBP      1   803.61 843.61
## - DWS       1   803.89 843.89
## - TOVGame   1   804.04 844.04
## - eFGP      1   804.61 844.61
## - PF        1   805.10 845.10
## - TRBGame   1   808.04 848.04
## - ASTP      1   810.82 850.82
## - USGP      1   825.14 865.14
## - ASTGame   1   829.07 869.07
## 
## Step:  AIC=839.41
## isAllStar ~ PF + PER + ThreePAr + FTr + ORBP + TRBP + ASTP + 
##     BLKP + USGP + DWS + BPM + FGP + TwoPP + eFGP + TOVGame + 
##     TRBGame + ASTGame + FTGame + FTAGame
## 
##            Df Deviance    AIC
## - PER       1   800.04 838.04
## - TwoPP     1   800.64 838.64
## - BLKP      1   801.08 839.08
## <none>          799.41 839.41
## - ORBP      1   802.01 840.01
## - BPM       1   802.43 840.43
## - FGP       1   803.28 841.28
## - FTAGame   1   804.03 842.03
## - FTr       1   804.22 842.22
## - ThreePAr  1   804.28 842.28
## - FTGame    1   804.66 842.66
## - PF        1   805.67 843.67
## - TRBP      1   805.76 843.76
## - eFGP      1   805.97 843.97
## - TOVGame   1   807.34 845.34
## - TRBGame   1   809.69 847.69
## - ASTP      1   812.66 850.66
## - DWS       1   815.92 853.92
## - USGP      1   825.14 863.14
## - ASTGame   1   833.45 871.45
## 
## Step:  AIC=838.04
## isAllStar ~ PF + ThreePAr + FTr + ORBP + TRBP + ASTP + BLKP + 
##     USGP + DWS + BPM + FGP + TwoPP + eFGP + TOVGame + TRBGame + 
##     ASTGame + FTGame + FTAGame
## 
##            Df Deviance    AIC
## - TwoPP     1   801.05 837.05
## - BLKP      1   801.17 837.17
## - ORBP      1   802.03 838.03
## <none>          800.04 838.04
## - BPM       1   802.43 838.43
## - FGP       1   803.54 839.54
## - FTAGame   1   804.14 840.14
## - ThreePAr  1   804.44 840.44
## - FTr       1   804.84 840.84
## - FTGame    1   804.89 840.89
## - PF        1   805.89 841.89
## - eFGP      1   805.99 841.99
## - TRBP      1   806.53 842.53
## - TOVGame   1   809.63 845.63
## - TRBGame   1   809.90 845.90
## - ASTP      1   814.07 850.07
## - DWS       1   816.94 852.94
## - ASTGame   1   834.50 870.50
## - USGP      1   836.40 872.40
## 
## Step:  AIC=837.05
## isAllStar ~ PF + ThreePAr + FTr + ORBP + TRBP + ASTP + BLKP + 
##     USGP + DWS + BPM + FGP + eFGP + TOVGame + TRBGame + ASTGame + 
##     FTGame + FTAGame
## 
##            Df Deviance    AIC
## - BLKP      1   802.08 836.08
## - ORBP      1   802.72 836.72
## <none>          801.05 837.05
## - BPM       1   803.97 837.97
## - FGP       1   805.14 839.14
## - FTAGame   1   805.27 839.27
## - FTr       1   805.67 839.67
## - ThreePAr  1   805.96 839.96
## - FTGame    1   806.10 840.10
## - PF        1   806.72 840.72
## - TRBP      1   807.46 841.46
## - eFGP      1   808.08 842.08
## - TOVGame   1   810.37 844.37
## - TRBGame   1   810.89 844.89
## - ASTP      1   815.11 849.11
## - DWS       1   817.34 851.34
## - ASTGame   1   835.15 869.15
## - USGP      1   837.30 871.30
## 
## Step:  AIC=836.08
## isAllStar ~ PF + ThreePAr + FTr + ORBP + TRBP + ASTP + USGP + 
##     DWS + BPM + FGP + eFGP + TOVGame + TRBGame + ASTGame + FTGame + 
##     FTAGame
## 
##            Df Deviance    AIC
## - ORBP      1   803.65 835.65
## <none>          802.08 836.08
## - FTAGame   1   806.07 838.07
## - FGP       1   806.28 838.28
## - FTGame    1   806.43 838.43
## - BPM       1   806.48 838.48
## - FTr       1   807.05 839.05
## - ThreePAr  1   807.35 839.35
## - TRBP      1   807.75 839.75
## - PF        1   808.00 840.00
## - eFGP      1   809.16 841.16
## - TOVGame   1   810.76 842.76
## - TRBGame   1   811.19 843.19
## - ASTP      1   817.48 849.48
## - DWS       1   818.59 850.59
## - ASTGame   1   836.45 868.45
## - USGP      1   838.81 870.81
## 
## Step:  AIC=835.65
## isAllStar ~ PF + ThreePAr + FTr + TRBP + ASTP + USGP + DWS + 
##     BPM + FGP + eFGP + TOVGame + TRBGame + ASTGame + FTGame + 
##     FTAGame
## 
##            Df Deviance    AIC
## <none>          803.65 835.65
## - FTGame    1   807.10 837.10
## - FTAGame   1   807.19 837.19
## - TRBP      1   807.93 837.93
## - FGP       1   808.00 838.00
## - PF        1   808.72 838.72
## - FTr       1   808.85 838.85
## - ThreePAr  1   809.60 839.60
## - BPM       1   810.17 840.17
## - eFGP      1   810.79 840.79
## - TOVGame   1   811.85 841.85
## - TRBGame   1   812.22 842.22
## - DWS       1   818.69 848.69
## - ASTP      1   820.38 850.38
## - ASTGame   1   838.26 868.26
## - USGP      1   839.89 869.89
summary(seasonstatsmodel.glm.back)
## 
## Call:
## glm(formula = isAllStar ~ PF + ThreePAr + FTr + TRBP + ASTP + 
##     USGP + DWS + BPM + FGP + eFGP + TOVGame + TRBGame + ASTGame + 
##     FTGame + FTAGame, family = "binomial", data = seasonstatsmodel.train)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -2.10181  -0.23629  -0.09109  -0.03610   2.90272  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -17.813014   2.348417  -7.585 3.32e-14 ***
## PF           -0.004450   0.001985  -2.242 0.024954 *  
## ThreePAr    -11.231662   4.620505  -2.431 0.015064 *  
## FTr           6.228662   2.700329   2.307 0.021075 *  
## TRBP         -0.248560   0.123016  -2.021 0.043326 *  
## ASTP         -0.233050   0.060516  -3.851 0.000118 ***
## USGP          0.405056   0.069336   5.842 5.16e-09 ***
## DWS           0.375063   0.097662   3.840 0.000123 ***
## BPM           0.192148   0.075683   2.539 0.011121 *  
## FGP         -49.439257  23.595669  -2.095 0.036147 *  
## eFGP         59.227018  22.039166   2.687 0.007202 ** 
## TOVGame      -0.736219   0.259649  -2.835 0.004576 ** 
## TRBGame       0.569243   0.200226   2.843 0.004469 ** 
## ASTGame       1.492532   0.274232   5.443 5.25e-08 ***
## FTGame        0.505011   0.272340   1.854 0.063690 .  
## FTAGame      -0.614114   0.324167  -1.894 0.058167 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 1769.64  on 2498  degrees of freedom
## Residual deviance:  803.65  on 2483  degrees of freedom
## AIC: 835.65
## 
## Number of Fisher Scoring iterations: 7
dim(seasonstatsmodel.glm.back)
## NULL
sum.back <- summary(seasonstatsmodel.glm.back)
dim(sum.back$coefficients)
## [1] 16  4
AIC(seasonstatsmodel.glm.back)
## [1] 835.654
pred.glm3.train <- predict(seasonstatsmodel.glm.back, type = "response")
pred.glm3.valid <- predict(seasonstatsmodel.glm.back, newdata = seasonstatsmodel.valid, type = "response")
confusionMatrix(as.factor(ifelse(pred.glm3.train >= optimal.pcut.glm, "1", "0")), as.factor(seasonstatsmodel.train$isAllStar), 
                positive = "1")
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction    0    1
##          0 1261    0
##          1  954  284
##                                           
##                Accuracy : 0.6182          
##                  95% CI : (0.5989, 0.6373)
##     No Information Rate : 0.8864          
##     P-Value [Acc > NIR] : 1               
##                                           
##                   Kappa : 0.231           
##                                           
##  Mcnemar's Test P-Value : <2e-16          
##                                           
##             Sensitivity : 1.0000          
##             Specificity : 0.5693          
##          Pos Pred Value : 0.2294          
##          Neg Pred Value : 1.0000          
##              Prevalence : 0.1136          
##          Detection Rate : 0.1136          
##    Detection Prevalence : 0.4954          
##       Balanced Accuracy : 0.7847          
##                                           
##        'Positive' Class : 1               
## 
#0.8463 accuracy

#Perform stepwise regression - 3rd best
seasonstatsmodel.glm.step <- step(seasonstatsmodel.glm.null, scope = list(seasonstatsmodel.glm.null, upper = seasonstatsmodel.glm), 
                          direction = "both")
## Start:  AIC=1771.64
## isAllStar ~ 1
## 
##               Df Deviance     AIC
## + PER          1   980.61  984.61
## + PTSGame      1  1065.55 1069.55
## + VORP         1  1138.59 1142.59
## + WS           1  1142.93 1146.93
## + FTAGame      1  1170.56 1174.56
## + FTGame       1  1173.40 1177.40
## + TwoPGame     1  1187.60 1191.60
## + BPM          1  1197.55 1201.55
## + OWS          1  1220.61 1224.61
## + TwoPAGame    1  1234.21 1238.21
## + WS48         1  1259.83 1263.83
## + USGP         1  1276.25 1280.25
## + OBPM         1  1287.65 1291.65
## + TOVGame      1  1356.88 1360.88
## + DWS          1  1470.20 1474.20
## + ASTGame      1  1557.47 1561.47
## + TRBGame      1  1579.00 1583.00
## + STLGame      1  1595.39 1599.39
## + ASTP         1  1631.79 1635.79
## + FTr          1  1637.62 1641.62
## + TSP          1  1652.17 1656.17
## + BLKGame      1  1688.22 1692.22
## + FGP          1  1692.92 1696.92
## + TwoPP        1  1704.34 1708.34
## + DRBP         1  1707.67 1711.67
## + DBPM         1  1715.46 1719.46
## + PF           1  1715.58 1719.58
## + TRBP         1  1728.75 1732.75
## + ThreePAr     1  1735.75 1739.75
## + eFGP         1  1736.56 1740.56
## + BLKP         1  1746.57 1750.57
## + PFGame       1  1746.83 1750.83
## + STLP         1  1751.43 1755.43
## + FTP          1  1752.65 1756.65
## + ThreePAGame  1  1754.87 1758.87
## + ThreePGame   1  1755.28 1759.28
## + ORBP         1  1763.93 1767.93
## + TOVP         1  1765.41 1769.41
## <none>            1769.64 1771.64
## + ThreePP      1  1768.02 1772.02
## 
## Step:  AIC=984.61
## isAllStar ~ PER
## 
##               Df Deviance     AIC
## + TOVGame      1   916.99  922.99
## + PTSGame      1   921.55  927.55
## + VORP         1   937.50  943.50
## + ASTGame      1   940.73  946.73
## + FTGame       1   943.60  949.60
## + FTAGame      1   944.22  950.22
## + TwoPAGame    1   948.22  954.22
## + DWS          1   951.60  957.60
## + STLGame      1   953.69  959.69
## + WS           1   954.31  960.31
## + TwoPGame     1   959.31  965.31
## + ASTP         1   960.28  966.28
## + FGP          1   960.29  966.29
## + TwoPP        1   960.59  966.59
## + ORBP         1   960.93  966.93
## + USGP         1   960.93  966.93
## + eFGP         1   965.13  971.13
## + BPM          1   967.17  973.17
## + ThreePAGame  1   967.67  973.67
## + ThreePGame   1   970.32  976.32
## + TSP          1   971.05  977.05
## + TRBP         1   971.12  977.12
## + BLKP         1   971.21  977.21
## + ThreePP      1   971.33  977.33
## + OWS          1   973.62  979.62
## + TOVP         1   974.30  980.30
## + OBPM         1   974.35  980.35
## + DRBP         1   976.25  982.25
## + PF           1   976.79  982.79
## + ThreePAr     1   977.77  983.77
## + STLP         1   977.83  983.83
## + BLKGame      1   978.28  984.28
## <none>             980.61  984.61
## + WS48         1   978.62  984.62
## + FTP          1   979.26  985.26
## + DBPM         1   979.78  985.78
## + FTr          1   980.08  986.08
## + PFGame       1   980.56  986.56
## + TRBGame      1   980.61  986.61
## - PER          1  1769.64 1771.64
## 
## Step:  AIC=922.99
## isAllStar ~ PER + TOVGame
## 
##               Df Deviance     AIC
## + WS           1   882.31  890.31
## + DWS          1   884.29  892.29
## + VORP         1   885.76  893.76
## + PTSGame      1   900.48  908.48
## + BPM          1   903.15  911.15
## + TOVP         1   904.89  912.89
## + OWS          1   905.87  913.87
## + WS48         1   907.76  915.76
## + TwoPAGame    1   909.40  917.40
## + DBPM         1   910.57  918.57
## + TwoPGame     1   912.03  920.03
## + FTGame       1   912.20  920.20
## + STLGame      1   912.66  920.66
## + FTAGame      1   913.00  921.00
## + ThreePP      1   913.47  921.47
## + ThreePGame   1   913.64  921.64
## + ThreePAGame  1   913.75  921.75
## + TwoPP        1   913.81  921.81
## + ASTGame      1   914.03  922.03
## + ORBP         1   914.03  922.03
## + FGP          1   914.23  922.23
## + TRBGame      1   914.88  922.88
## <none>             916.99  922.99
## + PF           1   915.58  923.58
## + eFGP         1   915.94  923.94
## + TSP          1   916.09  924.09
## + OBPM         1   916.16  924.16
## + ThreePAr     1   916.16  924.16
## + PFGame       1   916.23  924.23
## + BLKP         1   916.57  924.57
## + FTP          1   916.61  924.61
## + FTr          1   916.80  924.80
## + TRBP         1   916.82  924.82
## + USGP         1   916.88  924.88
## + BLKGame      1   916.90  924.90
## + DRBP         1   916.92  924.92
## + STLP         1   916.99  924.99
## + ASTP         1   916.99  924.99
## - TOVGame      1   980.61  984.61
## - PER          1  1356.88 1360.88
## 
## Step:  AIC=890.31
## isAllStar ~ PER + TOVGame + WS
## 
##               Df Deviance    AIC
## + TOVP         1   867.57 877.57
## + PTSGame      1   867.65 877.65
## + TwoPAGame    1   868.09 878.09
## + TwoPGame     1   873.37 883.37
## + TSP          1   874.17 884.17
## + USGP         1   874.61 884.61
## + OWS          1   875.20 885.20
## + DWS          1   875.21 885.21
## + PF           1   875.47 885.47
## + TwoPP        1   876.34 886.34
## + eFGP         1   876.71 886.71
## + FGP          1   877.95 887.95
## + FTAGame      1   879.65 889.65
## + FTGame       1   879.93 889.93
## + DBPM         1   880.25 890.25
## <none>             882.31 890.31
## + VORP         1   880.34 890.34
## + TRBGame      1   880.36 890.36
## + WS48         1   880.37 890.37
## + PFGame       1   880.85 890.85
## + ThreePP      1   881.01 891.01
## + ThreePAGame  1   881.05 891.05
## + FTr          1   881.18 891.18
## + ThreePGame   1   881.32 891.32
## + STLGame      1   881.40 891.40
## + ORBP         1   881.48 891.48
## + BPM          1   881.51 891.51
## + OBPM         1   881.67 891.67
## + DRBP         1   881.74 891.74
## + ASTGame      1   881.86 891.86
## + BLKGame      1   881.91 891.91
## + STLP         1   881.99 891.99
## + ASTP         1   882.19 892.19
## + FTP          1   882.24 892.24
## + TRBP         1   882.28 892.28
## + BLKP         1   882.30 892.30
## + ThreePAr     1   882.30 892.30
## - WS           1   916.99 922.99
## - TOVGame      1   954.31 960.31
## - PER          1   968.62 974.62
## 
## Step:  AIC=877.57
## isAllStar ~ PER + TOVGame + WS + TOVP
## 
##               Df Deviance    AIC
## + OWS          1   858.95 870.95
## + DWS          1   859.01 871.01
## + PF           1   859.17 871.17
## + DBPM         1   860.42 872.42
## + ASTGame      1   863.84 875.84
## + BPM          1   864.37 876.37
## + TSP          1   864.82 876.82
## + VORP         1   865.29 877.29
## + TwoPAGame    1   865.32 877.32
## + TRBGame      1   865.40 877.40
## <none>             867.57 877.57
## + PFGame       1   865.62 877.62
## + DRBP         1   865.87 877.87
## + OBPM         1   866.01 878.01
## + TwoPP        1   866.40 878.40
## + eFGP         1   866.48 878.48
## + BLKGame      1   866.48 878.48
## + ASTP         1   866.52 878.52
## + FTP          1   866.55 878.55
## + TRBP         1   866.82 878.82
## + TwoPGame     1   866.84 878.84
## + STLGame      1   866.88 878.88
## + BLKP         1   866.89 878.89
## + PTSGame      1   866.98 878.98
## + WS48         1   867.05 879.05
## + FGP          1   867.12 879.12
## + ThreePP      1   867.21 879.21
## + FTGame       1   867.36 879.36
## + ThreePAr     1   867.42 879.42
## + USGP         1   867.42 879.42
## + ThreePAGame  1   867.53 879.53
## + ThreePGame   1   867.54 879.54
## + ORBP         1   867.54 879.54
## + FTr          1   867.54 879.54
## + FTAGame      1   867.55 879.55
## + STLP         1   867.57 879.57
## - TOVP         1   882.31 890.31
## - WS           1   904.89 912.89
## - PER          1   914.87 922.87
## - TOVGame      1   947.41 955.41
## 
## Step:  AIC=870.95
## isAllStar ~ PER + TOVGame + WS + TOVP + OWS
## 
##               Df Deviance    AIC
## + PF           1   845.48 859.48
## + ASTGame      1   848.58 862.58
## + ASTP         1   854.41 868.41
## + PFGame       1   854.42 868.42
## + PTSGame      1   854.69 868.69
## + ThreePP      1   856.54 870.54
## + ORBP         1   856.63 870.63
## <none>             858.95 870.95
## + BPM          1   857.75 871.75
## + ThreePGame   1   857.83 871.83
## + TwoPP        1   857.84 871.84
## + TRBP         1   857.86 871.86
## + BLKP         1   857.91 871.91
## + FGP          1   857.96 871.96
## + ThreePAGame  1   858.05 872.05
## + OBPM         1   858.10 872.10
## + BLKGame      1   858.37 872.37
## + ThreePAr     1   858.38 872.38
## + VORP         1   858.44 872.44
## + WS48         1   858.47 872.47
## + USGP         1   858.51 872.51
## + DRBP         1   858.57 872.57
## + TwoPAGame    1   858.65 872.65
## + FTP          1   858.71 872.71
## + STLGame      1   858.78 872.78
## + STLP         1   858.78 872.78
## + TSP          1   858.80 872.80
## + DBPM         1   858.82 872.82
## + eFGP         1   858.83 872.83
## + FTr          1   858.89 872.89
## + TRBGame      1   858.91 872.91
## + FTGame       1   858.92 872.92
## + DWS          1   858.93 872.93
## + FTAGame      1   858.93 872.93
## + TwoPGame     1   858.95 872.95
## - OWS          1   867.57 877.57
## - TOVP         1   875.20 885.20
## - WS           1   893.56 903.56
## - PER          1   912.04 922.04
## - TOVGame      1   940.51 950.51
## 
## Step:  AIC=859.48
## isAllStar ~ PER + TOVGame + WS + TOVP + OWS + PF
## 
##               Df Deviance    AIC
## + PTSGame      1   841.17 857.17
## + ASTGame      1   842.33 858.33
## + TwoPAGame    1   842.52 858.52
## + PFGame       1   842.80 858.80
## <none>             845.48 859.48
## + TRBGame      1   843.80 859.80
## + TwoPGame     1   843.97 859.97
## + STLP         1   844.44 860.44
## + DRBP         1   844.82 860.82
## + WS48         1   844.96 860.96
## + DBPM         1   844.96 860.96
## + TRBP         1   845.01 861.01
## + ASTP         1   845.08 861.08
## + ThreePAr     1   845.09 861.09
## + ThreePP      1   845.16 861.16
## + BLKGame      1   845.20 861.20
## + FTAGame      1   845.21 861.21
## + OBPM         1   845.22 861.22
## + FTr          1   845.28 861.28
## + FTGame       1   845.29 861.29
## + TwoPP        1   845.30 861.30
## + FTP          1   845.30 861.30
## + ThreePAGame  1   845.35 861.35
## + USGP         1   845.36 861.36
## + BLKP         1   845.37 861.37
## + TSP          1   845.38 861.38
## + ORBP         1   845.39 861.39
## + STLGame      1   845.42 861.42
## + DWS          1   845.44 861.44
## + eFGP         1   845.44 861.44
## + ThreePGame   1   845.45 861.45
## + VORP         1   845.46 861.46
## + FGP          1   845.47 861.47
## + BPM          1   845.47 861.47
## - PF           1   858.95 870.95
## - OWS          1   859.17 871.17
## - TOVP         1   864.58 876.58
## - PER          1   880.72 892.72
## - WS           1   893.54 905.54
## - TOVGame      1   936.98 948.98
## 
## Step:  AIC=857.17
## isAllStar ~ PER + TOVGame + WS + TOVP + OWS + PF + PTSGame
## 
##               Df Deviance    AIC
## + ASTGame      1   833.42 851.42
## - TOVP         1   841.24 855.24
## + ASTP         1   838.76 856.76
## - TOVGame      1   842.99 856.99
## + TwoPAGame    1   839.11 857.11
## <none>             841.17 857.17
## + PFGame       1   839.19 857.19
## + TSP          1   839.40 857.40
## + TRBGame      1   839.62 857.62
## + DBPM         1   840.00 858.00
## + eFGP         1   840.19 858.19
## + USGP         1   840.22 858.22
## + ThreePAr     1   840.34 858.34
## + TwoPP        1   840.47 858.47
## + TwoPGame     1   840.50 858.50
## + DRBP         1   840.56 858.56
## + ThreePAGame  1   840.56 858.56
## + WS48         1   840.57 858.57
## + TRBP         1   840.59 858.59
## + STLP         1   840.68 858.68
## + FTP          1   840.69 858.69
## + ThreePGame   1   840.69 858.69
## + BLKGame      1   840.76 858.76
## + ORBP         1   840.84 858.84
## + BLKP         1   840.93 858.93
## + VORP         1   840.96 858.96
## + OBPM         1   840.96 858.96
## + BPM          1   841.03 859.03
## + FGP          1   841.09 859.09
## + FTr          1   841.10 859.10
## + DWS          1   841.11 859.11
## + FTGame       1   841.12 859.12
## + ThreePP      1   841.13 859.13
## + STLGame      1   841.17 859.17
## + FTAGame      1   841.17 859.17
## - PTSGame      1   845.48 859.48
## - PF           1   854.69 868.69
## - OWS          1   858.90 872.90
## - PER          1   864.59 878.59
## - WS           1   892.73 906.73
## 
## Step:  AIC=851.42
## isAllStar ~ PER + TOVGame + WS + TOVP + OWS + PF + PTSGame + 
##     ASTGame
## 
##               Df Deviance    AIC
## + ASTP         1   824.05 844.05
## + TRBGame      1   825.48 845.48
## + TRBP         1   825.64 845.64
## + ORBP         1   825.80 845.80
## + DRBP         1   828.39 848.39
## - TOVGame      1   833.53 849.53
## + OBPM         1   829.60 849.60
## + BLKGame      1   829.76 849.76
## + DBPM         1   829.78 849.78
## + BLKP         1   830.11 850.11
## + STLP         1   830.14 850.14
## - TOVP         1   834.18 850.18
## + ThreePAr     1   830.37 850.37
## + ThreePAGame  1   830.51 850.51
## + FTr          1   830.66 850.66
## + PFGame       1   830.98 850.98
## + ThreePGame   1   831.15 851.15
## + TwoPAGame    1   831.32 851.32
## <none>             833.42 851.42
## + STLGame      1   831.92 851.92
## + TwoPGame     1   832.03 852.03
## + FTAGame      1   832.05 852.05
## + USGP         1   832.18 852.18
## + FGP          1   832.38 852.38
## + FTP          1   832.43 852.43
## + FTGame       1   832.81 852.81
## + WS48         1   833.07 853.07
## - PF           1   837.10 853.10
## + ThreePP      1   833.32 853.32
## + BPM          1   833.37 853.37
## + eFGP         1   833.38 853.38
## + TwoPP        1   833.40 853.40
## + VORP         1   833.40 853.40
## + TSP          1   833.41 853.41
## + DWS          1   833.42 853.42
## - ASTGame      1   841.17 857.17
## - PTSGame      1   842.33 858.33
## - OWS          1   858.36 874.36
## - PER          1   859.54 875.54
## - WS           1   885.58 901.58
## 
## Step:  AIC=844.05
## isAllStar ~ PER + TOVGame + WS + TOVP + OWS + PF + PTSGame + 
##     ASTGame + ASTP
## 
##               Df Deviance    AIC
## - TOVGame      1   824.11 842.11
## - TOVP         1   824.56 842.56
## + STLGame      1   821.15 843.15
## + STLP         1   821.24 843.24
## + FTr          1   821.63 843.63
## + ORBP         1   821.93 843.93
## + USGP         1   822.00 844.00
## + TRBP         1   822.01 844.01
## <none>             824.05 844.05
## + TRBGame      1   822.14 844.14
## + ThreePAGame  1   822.28 844.28
## + ThreePAr     1   822.32 844.32
## + TwoPAGame    1   822.68 844.68
## + FTAGame      1   822.72 844.72
## + ThreePGame   1   822.76 844.76
## + DRBP         1   822.95 844.95
## + FTGame       1   823.05 845.05
## + OBPM         1   823.09 845.09
## + PFGame       1   823.10 845.10
## + DBPM         1   823.25 845.25
## + BLKGame      1   823.27 845.27
## + BLKP         1   823.37 845.37
## + TwoPGame     1   823.54 845.54
## - PF           1   827.68 845.68
## + eFGP         1   823.70 845.70
## + WS48         1   823.85 845.85
## + TwoPP        1   823.86 845.86
## + FTP          1   823.94 845.94
## + FGP          1   823.94 845.94
## + VORP         1   823.99 845.99
## + TSP          1   824.01 846.01
## + BPM          1   824.03 846.03
## + ThreePP      1   824.04 846.04
## + DWS          1   824.04 846.04
## - PTSGame      1   831.06 849.06
## - ASTP         1   833.42 851.42
## - ASTGame      1   838.76 856.76
## - OWS          1   849.00 867.00
## - PER          1   858.66 876.66
## - WS           1   865.27 883.27
## 
## Step:  AIC=842.11
## isAllStar ~ PER + WS + TOVP + OWS + PF + PTSGame + ASTGame + 
##     ASTP
## 
##               Df Deviance    AIC
## + STLGame      1   821.23 841.23
## + STLP         1   821.34 841.34
## - TOVP         1   825.42 841.42
## + FTr          1   821.90 841.90
## <none>             824.11 842.11
## + TRBP         1   822.28 842.28
## + TRBGame      1   822.38 842.38
## + ORBP         1   822.40 842.40
## + USGP         1   822.43 842.43
## + ThreePAGame  1   822.52 842.52
## + ThreePAr     1   822.60 842.60
## + TwoPAGame    1   822.92 842.92
## + ThreePGame   1   823.01 843.01
## + FTAGame      1   823.03 843.03
## + DRBP         1   823.06 843.06
## + PFGame       1   823.14 843.14
## + OBPM         1   823.23 843.23
## + FTGame       1   823.27 843.27
## + DBPM         1   823.37 843.37
## + BLKGame      1   823.42 843.42
## + BLKP         1   823.50 843.50
## + TwoPGame     1   823.66 843.66
## + eFGP         1   823.89 843.89
## + TwoPP        1   823.96 843.96
## + WS48         1   823.98 843.98
## + FGP          1   823.99 843.99
## + FTP          1   824.03 844.03
## + VORP         1   824.04 844.04
## + TOVGame      1   824.05 844.05
## + ThreePP      1   824.09 844.09
## + BPM          1   824.10 844.10
## + TSP          1   824.10 844.10
## + DWS          1   824.10 844.10
## - PF           1   828.52 844.52
## - ASTP         1   833.53 849.53
## - ASTGame      1   838.91 854.91
## - OWS          1   854.26 870.26
## - PER          1   858.99 874.99
## - WS           1   865.28 881.28
## - PTSGame      1   870.01 886.01
## 
## Step:  AIC=841.23
## isAllStar ~ PER + WS + TOVP + OWS + PF + PTSGame + ASTGame + 
##     ASTP + STLGame
## 
##               Df Deviance    AIC
## - TOVP         1   822.24 840.24
## + FTr          1   818.79 840.79
## <none>             821.23 841.23
## + DBPM         1   819.85 841.85
## + FTAGame      1   819.99 841.99
## + PFGame       1   820.04 842.04
## - STLGame      1   824.11 842.11
## + FTGame       1   820.18 842.18
## + USGP         1   820.25 842.25
## + ORBP         1   820.32 842.32
## + TRBGame      1   820.46 842.46
## + ThreePAr     1   820.51 842.51
## + ThreePAGame  1   820.52 842.52
## + TRBP         1   820.58 842.58
## + TwoPAGame    1   820.71 842.71
## + ThreePGame   1   820.77 842.77
## + BPM          1   820.81 842.81
## + eFGP         1   820.86 842.86
## + TwoPP        1   820.92 842.92
## + DRBP         1   820.96 842.96
## + VORP         1   820.99 842.99
## + BLKGame      1   821.06 843.06
## + WS48         1   821.09 843.09
## + ThreePP      1   821.12 843.12
## + BLKP         1   821.13 843.13
## + OBPM         1   821.14 843.14
## + FTP          1   821.15 843.15
## + TOVGame      1   821.15 843.15
## + TwoPGame     1   821.17 843.17
## + TSP          1   821.19 843.19
## + FGP          1   821.22 843.22
## + DWS          1   821.22 843.22
## + STLP         1   821.23 843.23
## - PF           1   825.46 843.46
## - ASTP         1   832.04 850.04
## - ASTGame      1   838.62 856.62
## - OWS          1   854.20 872.20
## - PER          1   856.02 874.02
## - WS           1   865.27 883.27
## - PTSGame      1   869.59 887.59
## 
## Step:  AIC=840.24
## isAllStar ~ PER + WS + OWS + PF + PTSGame + ASTGame + ASTP + 
##     STLGame
## 
##               Df Deviance    AIC
## + FTr          1   818.81 838.81
## + FTAGame      1   820.21 840.21
## <none>             822.24 840.24
## + FTGame       1   820.46 840.46
## + DBPM         1   820.60 840.60
## + PFGame       1   820.97 840.97
## + ORBP         1   821.09 841.09
## + TOVP         1   821.23 841.23
## + TRBGame      1   821.29 841.29
## + ThreePAGame  1   821.38 841.38
## + TRBP         1   821.38 841.38
## + USGP         1   821.41 841.41
## - STLGame      1   825.42 841.42
## + ThreePAr     1   821.47 841.47
## - PF           1   825.54 841.54
## + TOVGame      1   821.60 841.60
## + ThreePGame   1   821.70 841.70
## + BPM          1   821.82 841.82
## + DRBP         1   821.90 841.90
## + VORP         1   821.97 841.97
## + TwoPAGame    1   822.03 842.03
## + BLKGame      1   822.05 842.05
## + WS48         1   822.08 842.08
## + OBPM         1   822.09 842.09
## + ThreePP      1   822.10 842.10
## + TSP          1   822.13 842.13
## + BLKP         1   822.13 842.13
## + FTP          1   822.15 842.15
## + eFGP         1   822.17 842.17
## + TwoPP        1   822.17 842.17
## + FGP          1   822.18 842.18
## + TwoPGame     1   822.23 842.23
## + DWS          1   822.24 842.24
## + STLP         1   822.24 842.24
## - ASTP         1   833.73 849.73
## - ASTGame      1   844.02 860.02
## - OWS          1   858.83 874.83
## - PER          1   861.62 877.62
## - WS           1   865.74 881.74
## - PTSGame      1   874.57 890.57
## 
## Step:  AIC=838.81
## isAllStar ~ PER + WS + OWS + PF + PTSGame + ASTGame + ASTP + 
##     STLGame + FTr
## 
##               Df Deviance    AIC
## <none>             818.81 838.81
## + DBPM         1   817.72 839.72
## + USGP         1   817.81 839.81
## + FTAGame      1   817.86 839.86
## + ORBP         1   818.00 840.00
## - STLGame      1   822.00 840.00
## + TRBGame      1   818.04 840.04
## + PFGame       1   818.14 840.14
## + TRBP         1   818.18 840.18
## - FTr          1   822.24 840.24
## + TwoPAGame    1   818.25 840.25
## + BPM          1   818.34 840.34
## + ThreePP      1   818.42 840.42
## + VORP         1   818.43 840.43
## + WS48         1   818.43 840.43
## + FTGame       1   818.49 840.49
## + DRBP         1   818.54 840.54
## + ThreePAr     1   818.56 840.56
## + ThreePAGame  1   818.56 840.56
## + TwoPGame     1   818.67 840.67
## + TwoPP        1   818.72 840.72
## + BLKGame      1   818.72 840.72
## + ThreePGame   1   818.76 840.76
## + BLKP         1   818.77 840.77
## + TOVP         1   818.79 840.79
## + DWS          1   818.79 840.79
## + TSP          1   818.79 840.79
## + FGP          1   818.80 840.80
## + TOVGame      1   818.80 840.80
## + OBPM         1   818.80 840.80
## + FTP          1   818.81 840.81
## + STLP         1   818.81 840.81
## + eFGP         1   818.81 840.81
## - PF           1   823.24 841.24
## - ASTP         1   829.44 847.44
## - ASTGame      1   839.88 857.88
## - PER          1   848.71 866.71
## - OWS          1   855.86 873.86
## - WS           1   863.23 881.23
## - PTSGame      1   873.46 891.46
summary(seasonstatsmodel.glm.step)
## 
## Call:
## glm(formula = isAllStar ~ PER + WS + OWS + PF + PTSGame + ASTGame + 
##     ASTP + STLGame + FTr, family = "binomial", data = seasonstatsmodel.train)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -2.21064  -0.23823  -0.10314  -0.04683   3.02058  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -11.863945   0.815165 -14.554  < 2e-16 ***
## PER           0.291069   0.053499   5.441 5.31e-08 ***
## WS            0.542034   0.083331   6.505 7.79e-11 ***
## OWS          -0.560176   0.094186  -5.948 2.72e-09 ***
## PF           -0.004377   0.002096  -2.088  0.03681 *  
## PTSGame       0.202840   0.029032   6.987 2.81e-12 ***
## ASTGame       0.878998   0.199460   4.407 1.05e-05 ***
## ASTP         -0.134878   0.042779  -3.153  0.00162 ** 
## STLGame      -0.453909   0.255786  -1.775  0.07597 .  
## FTr           1.630478   0.875682   1.862  0.06261 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 1769.64  on 2498  degrees of freedom
## Residual deviance:  818.81  on 2489  degrees of freedom
## AIC: 838.81
## 
## Number of Fisher Scoring iterations: 7
sum.step <- summary(seasonstatsmodel.glm.step)
dim(sum.step$coefficients)
## [1] 10  4
AIC(seasonstatsmodel.glm.step)
## [1] 838.8129
pred.glm4.train <- predict(seasonstatsmodel.glm.step, type = "response")
pred.glm4.valid <- predict(seasonstatsmodel.glm.step, newdata = seasonstatsmodel.valid, type = "response")
confusionMatrix(as.factor(ifelse(pred.glm4.train >= optimal.pcut.glm, "1", "0")), as.factor(seasonstatsmodel.train$isAllStar), 
                positive = "1")
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction    0    1
##          0 1221    0
##          1  994  284
##                                           
##                Accuracy : 0.6022          
##                  95% CI : (0.5827, 0.6215)
##     No Information Rate : 0.8864          
##     P-Value [Acc > NIR] : 1               
##                                           
##                   Kappa : 0.2183          
##                                           
##  Mcnemar's Test P-Value : <2e-16          
##                                           
##             Sensitivity : 1.0000          
##             Specificity : 0.5512          
##          Pos Pred Value : 0.2222          
##          Neg Pred Value : 1.0000          
##              Prevalence : 0.1136          
##          Detection Rate : 0.1136          
##    Detection Prevalence : 0.5114          
##       Balanced Accuracy : 0.7756          
##                                           
##        'Positive' Class : 1               
## 
#0.8436 accuracy

Set-up data for largetree

#Partition the data for largetree
set.seed(2016)
train.index <- sample(nrow(seasonstatsmodel), nrow(seasonstatsmodel) * 0.6)
seasonstatsmodel.train <- seasonstatsmodel[train.index, ]
seasonstatsmodel.valid <- seasonstatsmodel[-train.index, ]

#Ploting a largetree
library(rpart.plot)
## Warning: package 'rpart.plot' was built under R version 3.6.3
## Loading required package: rpart
seasonstatsmodel.largetree <- rpart(isAllStar ~ ., data = seasonstatsmodel.train, cp = 0.0001, method = "class")
prp(seasonstatsmodel.largetree, digits = 4, type = 1, extra = 1, varlen = -10,
    box.col = ifelse(seasonstatsmodel.largetree$frame$var == "<leaf>", 'gray', 'white'))

plotcp(seasonstatsmodel.largetree)

printcp(seasonstatsmodel.largetree)
## 
## Classification tree:
## rpart(formula = isAllStar ~ ., data = seasonstatsmodel.train, 
##     method = "class", cp = 1e-04)
## 
## Variables actually used in tree construction:
##  [1] ASTGame   ASTP      BLKGame   DRBP      DWS       FTAGame   FTGame   
##  [8] FTP       FTr       OBPM      PER       PF        PTSGame   ThreePAr 
## [15] TOVGame   TOVP      TRBP      TSP       TwoPAGame TwoPGame  VORP     
## [22] WS       
## 
## Root node error: 284/2499 = 0.11365
## 
## n= 2499 
## 
##           CP nsplit rel error  xerror     xstd
## 1  0.1602113      0   1.00000 1.00000 0.055866
## 2  0.0704225      2   0.67958 0.73239 0.048623
## 3  0.0281690      3   0.60915 0.66197 0.046428
## 4  0.0158451      4   0.58099 0.65493 0.046200
## 5  0.0140845      6   0.54930 0.67606 0.046878
## 6  0.0105634      8   0.52113 0.68310 0.047102
## 7  0.0052817     16   0.42606 0.71831 0.048195
## 8  0.0035211     21   0.39437 0.72887 0.048517
## 9  0.0017606     25   0.38028 0.74648 0.049046
## 10 0.0011737     27   0.37676 0.77113 0.049772
## 11 0.0001000     30   0.37324 0.78169 0.050079
#Pruning
seasonstatsmodel.pruned <- prune(seasonstatsmodel.largetree, cp = 0.0169173) 
seasonstatsmodel.pruned
## n= 2499 
## 
## node), split, n, loss, yval, (yprob)
##       * denotes terminal node
## 
##  1) root 2499 284 0 (0.8863545 0.1136455)  
##    2) PER< 19.25 2116  78 0 (0.9631380 0.0368620) *
##    3) PER>=19.25 383 177 1 (0.4621410 0.5378590)  
##      6) PTSGame< 22.09166 262 100 0 (0.6183206 0.3816794)  
##       12) WS< 10.85 216  67 0 (0.6898148 0.3101852)  
##         24) ASTGame< 9.456535 206  58 0 (0.7184466 0.2815534) *
##         25) ASTGame>=9.456535 10   1 1 (0.1000000 0.9000000) *
##       13) WS>=10.85 46  13 1 (0.2826087 0.7173913) *
##      7) PTSGame>=22.09166 121  15 1 (0.1239669 0.8760331) *
#Graphical output
prp(seasonstatsmodel.pruned, digits = 4, type = 1, extra = 1, varlen = -10,
    box.col = ifelse(seasonstatsmodel.pruned$frame$var == "<leaf>", 'gray', 'white'))

#Confusion Matrix
library(caret)
library(e1071)
seasonstatsmodel.ct0 <- rpart(isAllStar ~ ., data = seasonstatsmodel.train, method = "class")
pred0 <- predict(seasonstatsmodel.ct0, type = "class")
confusionMatrix(pred0, as.factor(seasonstatsmodel.train$isAllStar), positive = "1")
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction    0    1
##          0 2188   94
##          1   27  190
##                                           
##                Accuracy : 0.9516          
##                  95% CI : (0.9424, 0.9597)
##     No Information Rate : 0.8864          
##     P-Value [Acc > NIR] : < 2.2e-16       
##                                           
##                   Kappa : 0.7321          
##                                           
##  Mcnemar's Test P-Value : 1.973e-09       
##                                           
##             Sensitivity : 0.66901         
##             Specificity : 0.98781         
##          Pos Pred Value : 0.87558         
##          Neg Pred Value : 0.95881         
##              Prevalence : 0.11365         
##          Detection Rate : 0.07603         
##    Detection Prevalence : 0.08683         
##       Balanced Accuracy : 0.82841         
##                                           
##        'Positive' Class : 1               
## 

Final comment - will use logistic models with large tree in combination to validate