Differences between revisions 1 and 3 (spanning 2 versions)
Revision 1 as of 2023-03-15 21:12:39
Size: 362
Comment:
Revision 3 as of 2024-04-25 16:58:15
Size: 1893
Comment: Contentful update
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

The '''`logistic`''' command runs a logistic regression.
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.

Stata Logistic

The logistic command runs a logistic regression.


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


CategoryRicottone

Stata/Logistic (last edited 2025-10-24 18:25:32 by DominicRicottone)