#### Transcript Document

Overview of Logistics Regression and its SAS implementation • Logistics regression is widely used nowadays in finance, marketing research and clinical studies when the dependent variable is dichotomous, representing an event or a nonevent. However, because ordinary linear regression was routinely used before we had the modern statistical packages for analyzing logit, we will compare the statistical assumptions of logistic regression with that of ordinary least square linear regression. • Next we will examine PROC LOGISTICS implemented in SAS and discuss the basic statistic output for understanding the logistic regression results. • We will then discuss how to setup and understand logistics regression when the dependent variable has more than two outcomes. • We will conclude the presentation by comparing PROC LOGISTICS with other SAS procedures that can also perform logistics regression. 1 Examples of discrete responses: • Examples of discrete responses: – – – – – Getting decease vs. not getting decease Good, medium and bad credit risks Responders vs. non – responders (both in marketing or clinical trial studies) Married vs. unmarried Guilty vs. not guilty 2 Comparing linear and logistic regression • Linear Probability Model pi xi • Logit Model pi log 1 xi1 2 xi 2 .. 1 xik 1 pi 1 pi 1 exp( 1 xi1 2 xi 2 .. 1 xik ) 3 Why can linear regression work reasonable well on binary dependent variables ? Assumptions 1 yi a bxi i 2 E (i ) 0 3 Var (i ) i 4 Cov(i , j ) 0 5 i ~ Noraml • Consequence of violations Notes Biased parameter estimates Parameter’s meaning hard to interpret, except a linear approximation to nonlinear functions. Prediction can be <0, >1 Biased intercept estimate 2 ^ ^ Unbiased estimates but biased Variance of b Biased confidence interval b Same as 3 Unable for us to use t , F statistical tests for regression models. The estimates may still be normal if sample size is large. If 1) and 2) are true, it can be shown that 3) and 5) are necessarily false. However, the consequences may not be as serious as you expect. 4 Logistic regression for binary response variables Basic Syntax: • proc logistic data=chdage1 outest=parms descending; model chd = age / selection = stepwise ctable pprob = (0 to 1 by 0.1) outroc=roc1; • proc score data=chdage1 score = parms out=scored type=parms; var age; run; In the events/trials syntax, you specify two variables that contain count data for a binomial experiment. These two variables are separated by a slash. The value of the first variable, events, is the number of positive responses (or events). The value of the second variable, trials, is the number of trials. 5 Interpretation of SAS output - continued • Model Selection Criteria: – • Convergence - difference in parameter estimates is small enough. Model Fit Statistics Criteria: n – Likelihood Function: L pi i (1 pi )1 yi y i 1 – – – • – 2 * log (likelihood ) AIC = – 2 * log ( max likelihood ) + 2 * k SIC = – 2 * log ( max likelihood ) + log (N) * k Testing Global Null Hypothesis: BETA=0 – Likelihood ratio: ln(L intercept)- ln(L int + covariates), – – Score: 1st and 2nd derivative of Log(L) Wald: (coefficient / std error)2 6 Interpretation of SAS output - continued • Analysis of Maximum Likelihood Estimates – • Parameter estimates and significance test Odds Ratio Estimates k – Odds: Oi exp( j xij ) j 0 – • Association of Predicted Probabilities and Observed Responses – – – – • Odds ratio: Oi / Oj per unit change in covariate. Pairs: 43 (event) * 57 (non event) = 2451 Concordant (0- lower prob vs. 1- higher prob) Discordant (0- higher prob vs. 1- lower prob) Tie – all other ROC used to visualize model model prediction strength. 7 Interpretation of SAS output - continued Classification Table: – The model classifies an observation as an event if its estimated probability is greater than or equal to a given probability cutpoints. Prob. Level 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Correct Incorrect Percentages (%) Event Non Event Event Non Event Correct Sensitivity Specificity FALSE POS FALSE NEG 57 0 43 0 57 100 0 43 . 57 1 42 0 58 100 2.3 42.4 0 55 7 36 2 62 96.5 16.3 39.6 22.2 51 19 24 6 70 89.5 44.2 32 24 50 25 18 7 75 87.7 58.1 26.5 21.9 45 27 16 12 72 78.9 62.8 26.2 30.8 41 32 11 16 73 71.9 74.4 21.2 33.3 32 36 7 25 68 56.1 83.7 17.9 41 24 39 4 33 63 42.1 90.7 14.3 45.8 6 42 1 51 48 10.5 97.7 14.3 54.8 0 43 0 57 43 0 100 . 57 Tot Correct / Total Item a b c d Correct Correct Event/ Tot N.Event/ Tot F.Pos / Event N.Event (F.Pos+Pos) (a+b) / (a+b+c+d) a / (a+d) b / (b+c) c / (a+c) F.Neg / (F.Neg+Neg) d / (b+d) 8 Logistic regression for polychotomous response variables • Example: Three outcomes p1 pr(Y 1 x) p2 pr(Y 2 x) p3 pr(Y 3 x) 1 p1 p2 • The cumulative probability model p log( 1 ) 1 x 1 p1 p p2 log( 1 ) 2 x 1 p1 p2 • The assumption: – A common slope parameter associated with the predictor. 9 Logistic regression for polychotomous response variables Examples: • proc logistic data=diabetes descending; model group=glutest; output out=probs predicted=prob xbeta=logit; format group gp.; run; 10 Other SAS Procedures for Logistic Regression Models Proc Model Options Logistics Notes Event/Trial format only works for binary Response GENMOD Dist = Binormial Link=logit PROBIT Dist=Logistic CATMOD Proc catmod data=diabetes; direct glutest; response logits / out = cat_prob; model group = glutest; run; Allow for individual parameters: proc phreg data=diabetes; model t * group = glutest; run; Trick: events occur at time one, non events occur at a later times (censored). * t is dummy time var, group is censoring var PHREG One of General linear models log( p1 ) 1 1 x p2 log( p2 ) 2 2x p3 11 References • Hosmer, D.W, Jr. and Lemeshow, S. (1989), Applied Logistic Regression, New York: John Wiley & Sons, Inc. • SAS Institute Inc. (1995), Logistic Regression Examples Using the SAS System, Cary, NC: SAS Institute Inc. • Paul D. Allison (1999) Logistic Regression Using the SAS System: Theory and Application, BBU Press and John Wiley Sons Inc. 12