|
Size: 362
Comment:
|
← Revision 5 as of 2025-10-24 18:25:32 ⇥
Size: 1988
Comment: Rewrite
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| = Stata Logistic = | = Stata logistic = '''`-logistic-`''' fits a [[Statistics/LogisticModel|logistic model]]. |
| Line 11: | Line 13: |
| Adapted from [[https://stats.idre.ucla.edu/stata/dae/logistic-regression/|here]]: |
|
| Line 12: | 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 14: | Line 40: |
Compare the output of [[Stata/Logit|-logit-]], which ordinarily shows coefficients rather than odds ratios. |
|
| Line 23: | Line 51: |
| [[https://www.stata.com/manuals/rlogistic.pdf|Stata manual for -logistic-]] |
Stata logistic
-logistic- 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
