






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Description Quick start Menu Syntax Options Remarks and examples Stored results Methods and formulas References Also see
Model
SE/Robust
Reporting
Maximization
indepvars may contain factor variables; see [U] 11.4.3 Factor variables. depvar and indepvars may contain time-series operators; see [U] 11.4.4 Time-series varlists. bayes, bootstrap, by, collect, fp, jackknife, mfp, mi estimate, nestreg, rolling, statsby, stepwise, and svy are allowed; see [U] 11.1.10 Prefix commands. For more details, see [BAYES] bayes: logistic. vce(bootstrap) and vce(jackknife) are not allowed with the mi estimate prefix; see [MI] mi estimate. Weights are not allowed with the bootstrap prefix; see [R] bootstrap. vce() and weights are not allowed with the svy prefix; see [SVY] svy. fweights, iweights, and pweights are allowed; see [U] 11.1.6 weight. collinear and coeflegend do not appear in the dialog box. See [U] 20 Estimation and postestimation commands for more capabilities of estimation commands.
. use https://www.stata-press.com/data/r17/lbw (Hosmer & Lemeshow data) . describe Contains data from https://www.stata-press.com/data/r17/lbw.dta Observations: 189 Hosmer & Lemeshow data Variables: 11 15 Jan 2020 05:
Variable Storage Display Value name type format label Variable label
id int %8.0g Identification code low byte %8.0g Birthweight<2500g age byte %8.0g Age of mother lwt int %8.0g Weight at last menstrual period race byte %8.0g race Race smoke byte %9.0g smoke Smoked during pregnancy ptl byte %8.0g Premature labor history (count) ht byte %8.0g Has history of hypertension ui byte %8.0g Presence, uterine irritability ftv byte %8.0g Number of visits to physician during 1st trimester bwt int %8.0g Birthweight (grams)
Sorted by:
. logistic low age lwt i.race smoke ptl ht ui Logistic regression Number of obs = 189 LR chi2(8) = 33. Prob > chi2 = 0. Log likelihood = -100.724 Pseudo R2 = 0.
low Odds ratio Std. err. z P>|z| [95% conf. interval]
age .9732636 .0354759 -0.74 0.457 .9061578 1. lwt .9849634 .0068217 -2.19 0.029 .9716834.
race Black 3.534767 1.860737 2.40 0.016 1.259736 9. Other 2.368079 1.039949 1.96 0.050 1.001356 5.
smoke 2.517698 1.00916 2.30 0.021 1.147676 5. ptl 1.719161 .5952579 1.56 0.118 .8721455 3. ht 6.249602 4.322408 2.65 0.008 1.611152 24. ui 2.1351 .9808153 1.65 0.099 .8677528 5. _cons 1.586014 1.910496 0.38 0.702 .1496092 16.
Note: _cons estimates baseline odds.
. generate age4 = age/ . logistic low age4 lwt i.race smoke ptl ht ui (output omitted )
. logit Logistic regression Number of obs = 189 LR chi2(8) = 33. Prob > chi2 = 0. Log likelihood = -100.724 Pseudo R2 = 0.
low Coefficient Std. err. z P>|z| [95% conf. interval]
age4 -.1084012 .1458017 -0.74 0.457 -.3941673. lwt -.0151508 .0069259 -2.19 0.029 -.0287253 -.
race Black 1.262647 .5264101 2.40 0.016 .2309024 2. Other .8620792 .4391532 1.96 0.050 .0013548 1.
smoke .9233448 .4008266 2.30 0.021 .137739 1. ptl .5418366 .346249 1.56 0.118 -.136799 1. ht 1.832518 .6916292 2.65 0.008 .4769494 3. ui .7585135 .4593768 1.65 0.099 -.1418484 1. _cons .4612239 1.20459 0.38 0.702 -1.899729 2.
. use https://www.stata-press.com/data/r17/hospid1, clear . logistic low age lwt i.race smoke ptl ht ui, vce(cluster hospid) Logistic regression Number of obs = 189 Wald chi2(8) = 49. Prob > chi2 = 0. Log pseudolikelihood = -100.724 Pseudo R2 = 0. (Std. err. adjusted for 20 clusters in hospid)
Robust low Odds ratio std. err. z P>|z| [95% conf. interval]
age .9732636 .0397476 -0.66 0.507 .898396 1. lwt .9849634 .0057101 -2.61 0.009 .9738352.
race Black 3.534767 2.013285 2.22 0.027 1.157563 10. Other 2.368079 .8451325 2.42 0.016 1.176562 4.
smoke 2.517698 .8284259 2.81 0.005 1.321062 4. ptl 1.719161 .6676221 1.40 0.163 .8030814 3. ht 6.249602 4.066275 2.82 0.005 1.74591 22. ui 2.1351 1.093144 1.48 0.138 .7827337 5. _cons 1.586014 1.661913 0.44 0.660 .2034094 12.
Note: _cons estimates baseline odds.
. use https://www.stata-press.com/data/r17/hospid . logistic low age lwt i.race smoke ptl ht ui, vce(cluster hospid) Logistic regression Number of obs = 189 Wald chi2(8) = 7. Prob > chi2 = 0. Log pseudolikelihood = -100.724 Pseudo R2 = 0. (Std. err. adjusted for 20 clusters in hospid)
Robust low Odds ratio std. err. z P>|z| [95% conf. interval]
age .9732636 .0293064 -0.90 0.368 .9174862 1. lwt .9849634 .0106123 -1.41 0.160 .9643817 1.
race Black 3.534767 3.120338 1.43 0.153 .6265521 19. Other 2.368079 1.297738 1.57 0.116 .8089594 6.
smoke 2.517698 1.570287 1.48 0.139 .7414969 8. ptl 1.719161 .6799153 1.37 0.171 .7919045 3. ht 6.249602 7.165454 1.60 0.110 .660558 59. ui 2.1351 1.411977 1.15 0.251 .5841231 7. _cons 1.586014 1.946253 0.38 0.707 .1431423 17.
Note: _cons estimates baseline odds.
Matrices r(table) matrix containing the coefficients with their standard errors, test statistics, p-values, and confidence intervals
ψ
Archer, K. J., and S. A. Lemeshow. 2006. Goodness-of-fit test for a logistic regression model fitted using survey sample data. Stata Journal 6: 97–105. Buis, M. L. 2010a. Direct and indirect effects in a logit model. Stata Journal 10: 11–29.
. 2010b. Stata tip 87: Interpretation of interactions in nonlinear models. Stata Journal 10: 305–308. Dupont, W. D. 2009. Statistical Modeling for Biomedical Researchers: A Simple Introduction to the Analysis of Complex Data. 2nd ed. Cambridge: Cambridge University Press.
Fernandez-Felix, B. M., E. Garc´ıa-Esquinas, A. Muriel, A. Royuela, and J. Zamora. 2021. Bootstrap internal validation command for predictive logistic regression models. Stata Journal 21: 498–509. Freese, J. 2002. Least likely observations in regression models for categorical outcomes. Stata Journal 2: 296–300.
Gould, W. W. 2000. sg124: Interpreting logistic regression in all its forms. Stata Technical Bulletin 53: 19–29. Reprinted in Stata Technical Bulletin Reprints, vol. 9, pp. 257–270. College Station, TX: Stata Press. Hilbe, J. M. 2009. Logistic Regression Models. Boca Raton, FL: Chapman & Hill/CRC.
Hosmer, D. W., Jr., S. A. Lemeshow, and R. X. Sturdivant. 2013. Applied Logistic Regression. 3rd ed. Hoboken, NJ: Wiley. Kleinbaum, D. G., and M. Klein. 2010. Logistic Regression: A Self-Learning Text. 3rd ed. New York: Springer.
Lalanne, C., and M. Mesbah. 2016. Biostatistics and Computer-based Analysis of Health Data Using Stata. London: ISTE Press. Lemeshow, S. A., and J.-R. L. Gall. 1994. Modeling the severity of illness of ICU patients: A systems update. Journal of the American Medical Association 272: 1049–1055. https://doi.org/10.1001/jama.1994.03520130087038.
Lemeshow, S. A., and D. W. Hosmer, Jr. 2005. Logistic regression. In Vol. 2 of Encyclopedia of Biostatistics, ed. P. Armitage and T. Colton, 2870–2880. Chichester, UK: Wiley.
Long, J. S., and J. Freese. 2014. Regression Models for Categorical Dependent Variables Using Stata. 3rd ed. College Station, TX: Stata Press. Mehmetoglu, M., and T. G. Jakobsen. 2017. Applied Statistics Using Stata: A Guide for the Social Sciences. Thousand Oaks, CA: SAGE. Miranda, A., and S. Rabe-Hesketh. 2006. Maximum likelihood estimation of endogenous switching and sample selection models for binary, ordinal, and count variables. Stata Journal 6: 285–308. Mitchell, M. N., and X. Chen. 2005. Visualizing main effects and interactions for binary logit models. Stata Journal 5: 64–82.
Pagano, M., and K. Gauvreau. (2000) 2018. Principles of Biostatistics. 2nd ed. Reprint, Boca Raton, FL: CRC Press. Pampel, F. C. 2000. Logistic Regression: A Primer. Thousand Oaks, CA: SAGE. Pregibon, D. 1981. Logistic regression diagnostics. Annals of Statistics 9: 705–724. https://doi.org/10.1214/aos/1176345513. Schonlau, M. 2005. Boosted regression (boosting): An introductory tutorial and a Stata plugin. Stata Journal 5: 330–354.
Uberti, L. J. 2022. Interpreting logit models. Stata Journal 22: 60–76. Vittinghoff, E., D. V. Glidden, S. C. Shiboski, and C. E. McCulloch. 2012. Regression Methods in Biostatistics: Linear, Logistic, Survival, and Repeated Measures Models. 2nd ed. New York: Springer. Xu, J., and J. S. Long. 2005. Confidence intervals for predicted outcomes in regression models for categorical outcomes. Stata Journal 5: 537–559.