Size: 2338
Comment:
|
Size: 2354
Comment: Phrasing update
|
Deletions are marked like this. | Additions are marked like this. |
Line 4: | Line 4: |
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 15: | Line 13: |
This example is per [[https://stats.idre.ucla.edu/stata/dae/logistic-regression/|UCLA: Statistical Consulting Group]]: | Copied from [[https://stats.idre.ucla.edu/stata/dae/logistic-regression/|here]]: |
Line 18: | Line 16: |
. logit admit gre gpa i.rank | . use https://stats.idre.ucla.edu/stat/stata/dae/binary, clear |
Line 20: | Line 18: |
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 |
. 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 |
Line 45: | Line 45: |
Compare the output of [[Stata/Logistic|logistic]], which always shows the odds ratios, while the `or` option must be specified on `logit` to show those. |
Stata Logit
The logit command runs a logistic regression.
Contents
Usage
Copied from here:
. use https://stats.idre.ucla.edu/stat/stata/dae/binary, clear . 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 ------------------------------------------------------------------------------
Compare the output of logistic, which always shows the odds ratios, while the or option must be specified on logit to show those.
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