Differences between revisions 1 and 2
Revision 1 as of 2023-03-15 21:13:08
Size: 350
Comment:
Revision 2 as of 2023-06-08 00:33:45
Size: 2338
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

The '''`logit`''' command runs a logistic regression.

Compare to the [[Stata/Logistic|logistic]] command, which always shows the odds ratios, while the `or` option must be specified on `logit` to show those.
Line 11: Line 15:
This example is per [[https://stats.idre.ucla.edu/stata/dae/logistic-regression/|UCLA: Statistical Consulting Group]]:
Line 12: Line 18:
logit dependent independent . logit admit gre gpa i.rank

Iteration 0: log likelihood = -249.98826
Iteration 1: log likelihood = -229.66446
Iteration 2: log likelihood = -229.25955
Iteration 3: log likelihood = -229.25875
Iteration 4: log likelihood = -229.25875

Logistic regression Number of obs = 400
                                                  LR chi2(5) = 41.46
                                                  Prob > chi2 = 0.0000
Log likelihood = -229.25875 Pseudo R2 = 0.0829

------------------------------------------------------------------------------
       admit | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
         gre | .0022644 .001094 2.07 0.038 .0001202 .0044086
         gpa | .8040377 .3318193 2.42 0.015 .1536838 1.454392
             |
        rank |
          2 | -.6754429 .3164897 -2.13 0.033 -1.295751 -.0551346
          3 | -1.340204 .3453064 -3.88 0.000 -2.016992 -.6634158
          4 | -1.551464 .4178316 -3.71 0.000 -2.370399 -.7325287
             |
       _cons | -3.989979 1.139951 -3.50 0.000 -6.224242 -1.755717
------------------------------------------------------------------------------
Line 16: Line 47:

----



== Estimates ==

The estimates can be accessed through any of the following commands...
 * `predict` creates a variable storing the predicted probability for each case
 * `margins` displays the marginal predicted probabilities

Stata Logit

The logit command runs a logistic regression.

Compare to the logistic command, which always shows the odds ratios, while the or option must be specified on logit to show those.


Usage

This example is per UCLA: Statistical Consulting Group:

. logit admit gre gpa i.rank 

Iteration 0:   log likelihood = -249.98826  
Iteration 1:   log likelihood = -229.66446  
Iteration 2:   log likelihood = -229.25955  
Iteration 3:   log likelihood = -229.25875  
Iteration 4:   log likelihood = -229.25875  

Logistic regression                               Number of obs   =        400
                                                  LR chi2(5)      =      41.46
                                                  Prob > chi2     =     0.0000
Log likelihood = -229.25875                       Pseudo R2       =     0.0829

------------------------------------------------------------------------------
       admit |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         gre |   .0022644    .001094     2.07   0.038     .0001202    .0044086
         gpa |   .8040377   .3318193     2.42   0.015     .1536838    1.454392
             |
        rank |
          2  |  -.6754429   .3164897    -2.13   0.033    -1.295751   -.0551346
          3  |  -1.340204   .3453064    -3.88   0.000    -2.016992   -.6634158
          4  |  -1.551464   .4178316    -3.71   0.000    -2.370399   -.7325287
             |
       _cons |  -3.989979   1.139951    -3.50   0.000    -6.224242   -1.755717
------------------------------------------------------------------------------

See here for details on factor variables.


Estimates

The estimates can be accessed through any of the following commands...

  • predict creates a variable storing the predicted probability for each case

  • margins displays the marginal predicted probabilities


See also

Stata manual for logit post-estimation


CategoryRicottone

Stata/Logit (last edited 2025-04-04 00:28:12 by DominicRicottone)