# Logistic Regression in STATA

Using Stata 11 & higher for Logistic Regression

http://www3.nd.edu/~rwilliam/stats2/Logistic-Stata.pdf

Model fit: How often is the model right?

Create a classification table

% predicted correctly

page 6: “To get the equivalent of SPSS’s classification table, you can use the estat clas command (lstat also works). This command shows you how many cases were classified correctly and incorrectly, using a cutoff point of 50% for the predicted probability.”

UCLA:

Stata FAQ: How can I perform the likelihood ratio, Wald, and Lagrange multiplier (score) test in Stata?

http://www.ats.ucla.edu/stat/stata/faq/nested_tests.htm

Model significance: Use likelihood ratio test to compare two models (m1 nested in m2):

```logit hiwrite female read
estimates store m1
logit hiwrite female read math science
estimates store m2
lrtest m1 m2```

If the test is significant, the bigger model is a better fit.

Check assumptions:

Correction: This webpage is about linear regression, not logistic regression. But still, the measures described are useful – just choose wisely. There are two things to do for logistic regression:

1. `Assumptions for logistic regression: linearity, independence of errors, multicollinearity.`
2. `Identify outliers & influential observations.`

http://www.ats.ucla.edu/stat/stata/webbooks/reg/chapter2/statareg2.htm

From this webpage:

The following table summarizes the general rules of thumb we use for these measures to identify observations worthy of further investigation (where k is the number of predictors and n is the number of observations).

 Measure Value leverage >(2k+2)/n abs(rstu) > 2 Cook’s D > 4/n abs(DFITS) > 2*sqrt(k/n) abs(DFBETA) > 2/sqrt(n)

VIF: > 10
tolerance: < 0.1

Definition and interaction:

http://www.ats.ucla.edu/stat/stata/seminars/interaction_sem/interaction_sem.htm

Visualizing Main Effects and Interactions for Binary Logit Models in Stata:

http://www.ats.ucla.edu/stat/stata/seminars/stata_vibl/default.htm

Logistic Regression with Stata (Xiao Chen, Phil Ender, Michael Mitchell & Christine Wells):

http://www.ats.ucla.edu/stat/stata/webbooks/logistic/

Applied Logistic Regression (David Hosmer and Stanley Lemeshow):

http://www.ats.ucla.edu/stat/examples/alr2/default.htm

Stata Programs for Data Analysis:

Resources:

http://www.ats.ucla.edu/stat/stata/topics/logistic_regression.htm

Understanding and Interpreting Results from Logistic, Multinomial, and Ordered Logistic Regression Models: Using Post-Estimation Commands in Stata

http://www.socwkp.sinica.edu.tw/doc/Day5Session1.pdf

Princeton:

Intro:

http://dss.princeton.edu/training/Logit.pdf

Resources:

http://www.princeton.edu/~otorres/Stata/statnotes

STATWING: