A logit, or log odds, is the natural logarithm of an event’s odds: log[p / (1 − p)]. Odds compare an event’s probability with its failure probability. Logistic regression models this value as an intercept plus predictor coefficients, keeping predicted probabilities between 0 and 1. section 14.6.2
Use the logit to move between probabilities, odds, and logistic-regression predictions:
- Convert odds to log odds with the natural logarithm; for example, ln(2.33) is approximately 0.85. section 14.6.2
- Convert log odds back to odds with exp(); exp(0.85) is approximately 2.34. section 14.6.2
- Convert odds to probability with odds divided by one plus odds; odds of 2.34 produce a probability of about 0.70. section 14.6.2
Predicting NBA playoff qualification
A logistic regression models the binary outcome playoffs2 from standardized points allowed, z_o_pts. The coefficient is −1.721, so increasing z_o_pts lowers the modeled log odds of reaching the playoffs. Applying plogis(−1.72) gives a predicted probability of about 0.15. The model uses a 0.50 cutoff to classify teams, then evaluates predictions with a confusion matrix, sensitivity, specificity, accuracy, and ROC analysis. section 14.6.2
fit3 <- glm(playoffs2 ~ z_o_pts, family = "binomial", data = train) summary(fit3) ## ## Call: ## glm(formula = playoffs2 ~ z_o_pts, family = "binomial", data = train) ## ## Deviance Residuals: ## Min 1Q Median 3Q Max ## -2.17428 -0.77250 -0.01473 0.76694 2.13669 ## ## Coefficients: ## Estimate Std. Error z value Pr(>|z|) ## (Intercept) 0.1998 0.1727 1.157 0.247 ## z_o_pts -1.7210 0.2317 -7.428 0.00000000000011 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## (Dispersion parameter for binomial family taken to be 1) ## ## Null deviance: 304.98 on 219 degrees of freedom ## Residual deviance: 210.91 on 218 degrees of freedom ## AIC: 214.91 ## ## Number of Fisher Scoring iterations: 5
Inspect the complete base R glm() fit, including the binomial family, coefficient estimates, deviance, AIC, and Fisher scoring iterations. section 14.6.2
















