This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Using Stata 9 & 10 for Logistic Regression—Page 1 Using Stata 9 & 10 for Logistic Regression NOTE: The routines spost9 , lrdrop1 , and extremes are used in this handout. Use the findit command to locate and install them. See related handouts for the statistical theory underlying logistic regression and for SPSS examples. The spostado routines will generally work if you have an earlier version of Stata. Most but not all of the commands shown in this handout will also work in Stata 8, but the syntax is sometimes a little different. Commands. Stata and SPSS differ a bit in their approach, but both are quite competent at handling logistic regression. With large data sets, I find that Stata tends to be far faster than SPSS, which is one of the many reasons I prefer it. Stata has various commands for doing logistic regression. They differ in their default output and in some of the options they provide. My personal favorite is logit . . use "http://www.nd.edu/~rwilliam/stats2/statafiles/logist.dta", clear . logit grade gpa tuce psi Iteration 0: log likelihood = 20.59173 Iteration 1: log likelihood = 13.496795 Iteration 2: log likelihood = 12.929188 Iteration 3: log likelihood = 12.889941 Iteration 4: log likelihood = 12.889633 Iteration 5: log likelihood = 12.889633 Logit estimates Number of obs = 32 LR chi2(3) = 15.40 Prob > chi2 = 0.0015 Log likelihood = 12.889633 Pseudo R2 = 0.3740  grade  Coef. Std. Err. z P>z [95% Conf. Interval] + gpa  2.826113 1.262941 2.24 0.025 .3507938 5.301432 tuce  .0951577 .1415542 0.67 0.501 .1822835 .3725988 psi  2.378688 1.064564 2.23 0.025 .29218 4.465195 _cons  13.02135 4.931325 2.64 0.008 22.68657 3.35613  Note that the log likelihood for iteration 0 is LL , i.e. it is the log likelihood when there are no explanatory variables in the model  only the constant term is included. The last log likelihood reported is LL M . From these we easily compute DEV = 2LL = 2 * 20.59173 = 41.18 DEV M = 2LL M = 2 * 12.889633 = 25.78 Also note that the default output does not include exp(b). To get that, include the or parameter (or = odds ratios = exp(b)). Using Stata 9 & 10 for Logistic Regression—Page 2 . logit grade gpa tuce psi, or Logit estimates Number of obs = 32 LR chi2(3) = 15.40 Prob > chi2 = 0.0015 Log likelihood = 12.889633 Pseudo R2 = 0.3740  grade  Odds Ratio Std. Err. z P>z [95% Conf. Interval] + gpa  16.87972 21.31809 2.24 0.025 1.420194 200.6239 tuce  1.099832 .1556859 0.67 0.501 .8333651 1.451502 psi  10.79073 11.48743 2.23 0.025 1.339344 86.93802 ...
View
Full
Document
This note was uploaded on 02/29/2012 for the course SOC 63993 taught by Professor Richardwilliams during the Spring '11 term at Notre Dame.
 Spring '11
 RichardWilliams

Click to edit the document details