Size: 577
Comment:
|
← Revision 4 as of 2025-04-04 00:28:02 ⇥
Size: 1994
Comment: Standardize
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= Stata Logistic = | = Stata logistic = |
Line 3: | Line 3: |
The '''`logistic`''' command runs a logistic regression. Compare to the [[Stata/Logit|logit]] command, which only shows the odds ratios if the `or` option is specified, while `logistic` to always shows those. |
The '''`logistic`''' command fits a [[Statistics/LogisticModel|logistic model]]. |
Line 15: | Line 13: |
Adapted from [[https://stats.idre.ucla.edu/stata/dae/logistic-regression/|here]]: |
|
Line 16: | Line 16: |
logistic dependent independent | . use https://stats.idre.ucla.edu/stat/stata/dae/binary, clear . logistic admit gre gpa i.rank Logistic regression Number of obs = 400 LR chi2(5) = 41.46 Prob > chi2 = 0.0000 Log likelihood = -229.25875 Pseudo R2 = 0.0829 ------------------------------------------------------------------------------ admit | Odds ratio Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- gre | 1.002267 .0010965 2.07 0.038 1.00012 1.004418 gpa | 2.234545 .7414652 2.42 0.015 1.166122 4.281877 | rank | 2 | .5089309 .1610714 -2.13 0.033 .2736922 .9463578 3 | .2617923 .0903986 -3.88 0.000 .1330551 .5150889 4 | .2119375 .0885542 -3.71 0.000 .0934435 .4806919 | _cons | .0185001 .0210892 -3.50 0.000 .0019808 .1727834 ------------------------------------------------------------------------------ Note: _cons estimates baseline odds. |
Line 18: | Line 40: |
Compare the output of [[Stata/Logit|logit]], which ordinarily shows coefficients rather than odds ratios. |
|
Line 27: | Line 51: |
[[https://www.stata.com/manuals/rlogistic.pdf|Stata manual for logistic]] |
Stata logistic
The logistic command fits a logistic model.
Contents
Usage
Adapted from here:
. use https://stats.idre.ucla.edu/stat/stata/dae/binary, clear . logistic admit gre gpa i.rank Logistic regression Number of obs = 400 LR chi2(5) = 41.46 Prob > chi2 = 0.0000 Log likelihood = -229.25875 Pseudo R2 = 0.0829 ------------------------------------------------------------------------------ admit | Odds ratio Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- gre | 1.002267 .0010965 2.07 0.038 1.00012 1.004418 gpa | 2.234545 .7414652 2.42 0.015 1.166122 4.281877 | rank | 2 | .5089309 .1610714 -2.13 0.033 .2736922 .9463578 3 | .2617923 .0903986 -3.88 0.000 .1330551 .5150889 4 | .2119375 .0885542 -3.71 0.000 .0934435 .4806919 | _cons | .0185001 .0210892 -3.50 0.000 .0019808 .1727834 ------------------------------------------------------------------------------ Note: _cons estimates baseline odds.
Compare the output of logit, which ordinarily shows coefficients rather than odds ratios.
See here for details on factor variables.
See also
Stata manual for logistic post-estimation