Logistic regression in SAS
Here we'll analyze the basketball data using logistic regression.
The b-ball data contains data for 1192 shots by Sam Cassell in the NBA 2004-2005 season. The outcome variable is
"make" which is 1 if the shot is made and 0 if the shot is missed. There are several predictors including:
- the shot's distance ("distance")
- score differential at the time of the shot ("scorediff")
- whether teammates Kevin Garnett ("kg") and Latrell Sprewell ("spree") are in the game
- whether the game is played at home ("home"),
- the opponent's field goal percentage allowed ("fgpA")
- the opponent's winning percentage ("totW")
- time remaining in the game ("time")
- days off between games ("daysrest")
To perform logistic regression using pull-down menus:
- load the data using import wizard
- open the analyst window and load the bball data
- click statistics->regression->logistic
- Define "make" as the dependent variable and enter "1" in the "Model Pr{ }" field to indicate that we
want to model the probability of making a shot, not the probability of missing a shot.
- Add the continuous predictors (distance, scorediff, fgpA, totW, time, and daysrest) to the "quantitative" list.
- Add the categorical predictors (kg, spree, home) to the "class" list.
- Click "OK".
Or, you can use this sas script in the editor window ("descend" tells SAS to model the probability of a make, not the probability of a miss):
proc logistic data = bball descend;
class kg spree home;
model make = distance scorediff kg spree home fgpA totW time daysrest;
run;