0% found this document useful (0 votes)
249 views

Ordered Probit and Logit Models Stata Program and Output PDF

Uploaded by

julio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
249 views

Ordered Probit and Logit Models Stata Program and Output PDF

Uploaded by

julio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

* Ordered Probit and Logit Models in Stata

* Copyright 2013 by Ani Katchova

clear all
set more off

use C:\Econometrics\Data\ordered_health.dta

* Dependent variable has 3 categories denoted 1,2,3


global ylist healthstatus
global xlist age logincome numberdiseases

describe $ylist $xlist


summarize $ylist $xlist

tabulate $ylist

* Ordered logit model


ologit $ylist $xlist

* Ordered logit marginal effects


margins, dydx(*) atmeans predict(outcome(1))
margins, dydx(*) atmeans predict(outcome(2))
margins, dydx(*) atmeans predict(outcome(3))

* Ordered logit predicted probabilities


predict p1ologit p2ologit p3ologit, pr
summarize p1ologit p2ologit p3ologit
tabulate $ylist

* Ordered probit model coefficients


oprobit $ylist $xlist

* Ordered probit model marginal effects


margins, dydx(*) atmeans predict(outcome(1))
margins, dydx(*) atmeans predict(outcome(2))
margins, dydx(*) atmeans predict(outcome(3))

* Ordered probit model predicted probabilities


predict p1oprobit, pr outcome(1)
predict p2oprobit, pr outcome(2)
predict p3oprobit, pr outcome(3)
summarize p1oprobit p2oprobit p2oprobit
tabulate $ylist
. * Ordered Probit and Logit Models in Stata
. * Copyright 2013 by Ani Katchova
.
. clear all

. set more off

.
. use C:\Econometrics\Data\ordered_health.dta

.
. * Dependent variable has 3 categories denoted 1,2,3
. global ylist healthstatus

. global xlist age logincome numberdiseases

.
. describe $ylist $xlist

storage display value


variable name type format label variable label
--------------------------------------------------------------------------------------
-------------------
healthstatus float %9.0g hsvalue health status (fair, good, excellent)
age float %9.0g age
logincome float %9.0g log of annual family income (in $)
numberdiseases float %9.0g number of chronic diseases

. summarize $ylist $xlist

Variable | Obs Mean Std. Dev. Min Max


-------------+--------------------------------------------------------
healthstatus | 5574 2.447435 .659524 1 3
age | 5574 25.57613 16.73011 .0253251 63.27515
logincome | 5574 8.696929 1.220592 0 10.28324
numberdise~s | 5574 11.20526 6.788959 0 58.6

.
. tabulate $ylist

health |
status |
(fair, |
good, |
excellent) | Freq. Percent Cum.
------------+-----------------------------------
fair | 523 9.38 9.38
good | 2,034 36.49 45.87
excellent | 3,017 54.13 100.00
------------+-----------------------------------
Total | 5,574 100.00

.
. * Ordered logit model
. ologit $ylist $xlist
Iteration 0: log likelihood = -5140.0463
Iteration 1: log likelihood = -4776.008
Iteration 2: log likelihood = -4769.8693
Iteration 3: log likelihood = -4769.8525
Iteration 4: log likelihood = -4769.8525

Ordered logistic regression Number of obs = 5574


LR chi2(3) = 740.39
Prob > chi2 = 0.0000
Log likelihood = -4769.8525 Pseudo R2 = 0.0720

--------------------------------------------------------------------------------
healthstatus | Coef. Std. Err. z P>|z| [95% Conf. Interval]
---------------+----------------------------------------------------------------
age | -.0292944 .001681 -17.43 0.000 -.0325891 -.0259996
logincome | .2836537 .0231098 12.27 0.000 .2383593 .3289481
numberdiseases | -.0549905 .0040692 -13.51 0.000 -.0629661 -.047015
---------------+----------------------------------------------------------------
/cut1 | -1.39598 .2061301 -1.799987 -.9919722
/cut2 | .9513097 .2054301 .5486741 1.353945
--------------------------------------------------------------------------------

.
. * Ordered logit marginal effects
. margins, dydx(*) atmeans predict(outcome(1))

Conditional marginal effects Number of obs = 5574


Model VCE : OIM

Expression : Pr(healthstatus==1), predict(outcome(1))


dy/dx w.r.t. : age logincome numberdiseases
at : age = 25.57613 (mean)
logincome = 8.696929 (mean)
numberdise~s = 11.20526 (mean)

--------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
---------------+----------------------------------------------------------------
age | .002058 .0001333 15.44 0.000 .0017969 .0023192
logincome | -.0199278 .0017344 -11.49 0.000 -.0233272 -.0165284
numberdiseases | .0038633 .0003056 12.64 0.000 .0032643 .0044623
--------------------------------------------------------------------------------

. margins, dydx(*) atmeans predict(outcome(2))

Conditional marginal effects Number of obs = 5574


Model VCE : OIM

Expression : Pr(healthstatus==2), predict(outcome(2))


dy/dx w.r.t. : age logincome numberdiseases
at : age = 25.57613 (mean)
logincome = 8.696929 (mean)
numberdise~s = 11.20526 (mean)
--------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
---------------+----------------------------------------------------------------
age | .0052244 .0003258 16.04 0.000 .0045859 .0058629
logincome | -.0505872 .0043054 -11.75 0.000 -.0590256 -.0421489
numberdiseases | .0098071 .000768 12.77 0.000 .0083018 .0113124
--------------------------------------------------------------------------------

. margins, dydx(*) atmeans predict(outcome(3))

Conditional marginal effects Number of obs = 5574


Model VCE : OIM

Expression : Pr(healthstatus==3), predict(outcome(3))


dy/dx w.r.t. : age logincome numberdiseases
at : age = 25.57613 (mean)
logincome = 8.696929 (mean)
numberdise~s = 11.20526 (mean)

--------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
---------------+----------------------------------------------------------------
age | -.0072824 .0004179 -17.43 0.000 -.0081014 -.0064634
logincome | .070515 .0057527 12.26 0.000 .05924 .0817901
numberdiseases | -.0136704 .0010126 -13.50 0.000 -.015655 -.0116858
--------------------------------------------------------------------------------

.
. * Ordered logit predicted probabilities
. predict p1ologit p2ologit p3ologit, pr

. summarize p1ologit p2ologit p3ologit

Variable | Obs Mean Std. Dev. Min Max


-------------+--------------------------------------------------------
p1ologit | 5574 .0946903 .0843148 .0233629 .859022
p2ologit | 5574 .3651672 .0946158 .1255265 .5276064
p3ologit | 5574 .5401425 .1640575 .0154515 .7999009

. tabulate $ylist

health |
status |
(fair, |
good, |
excellent) | Freq. Percent Cum.
------------+-----------------------------------
fair | 523 9.38 9.38
good | 2,034 36.49 45.87
excellent | 3,017 54.13 100.00
------------+-----------------------------------
Total | 5,574 100.00
.
.
. * Ordered probit model coefficients
. oprobit $ylist $xlist

Iteration 0: log likelihood = -5140.0463


Iteration 1: log likelihood = -4771.7555
Iteration 2: log likelihood = -4771.0299
Iteration 3: log likelihood = -4771.0298

Ordered probit regression Number of obs = 5574


LR chi2(3) = 738.03
Prob > chi2 = 0.0000
Log likelihood = -4771.0298 Pseudo R2 = 0.0718

--------------------------------------------------------------------------------
healthstatus | Coef. Std. Err. z P>|z| [95% Conf. Interval]
---------------+----------------------------------------------------------------
age | -.0171681 .0009898 -17.34 0.000 -.0191082 -.0152281
logincome | .1654079 .01286 12.86 0.000 .1402028 .190613
numberdiseases | -.0315288 .0023848 -13.22 0.000 -.0362029 -.0268548
---------------+----------------------------------------------------------------
/cut1 | -.7945455 .115108 -1.020153 -.5689379
/cut2 | .5459371 .1148228 .3208886 .7709857
--------------------------------------------------------------------------------

.
. * Ordered probit model marginal effects
. margins, dydx(*) atmeans predict(outcome(1))

Conditional marginal effects Number of obs = 5574


Model VCE : OIM

Expression : Pr(healthstatus==1), predict(outcome(1))


dy/dx w.r.t. : age logincome numberdiseases
at : age = 25.57613 (mean)
logincome = 8.696929 (mean)
numberdise~s = 11.20526 (mean)

--------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
---------------+----------------------------------------------------------------
age | .0024261 .0001545 15.70 0.000 .0021233 .002729
logincome | -.0233749 .0019304 -12.11 0.000 -.0271584 -.0195914
numberdiseases | .0044556 .0003587 12.42 0.000 .0037525 .0051586
--------------------------------------------------------------------------------

. margins, dydx(*) atmeans predict(outcome(2))

Conditional marginal effects Number of obs = 5574


Model VCE : OIM

Expression : Pr(healthstatus==2), predict(outcome(2))


dy/dx w.r.t. : age logincome numberdiseases
at : age = 25.57613 (mean)
logincome = 8.696929 (mean)
numberdise~s = 11.20526 (mean)

--------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
---------------+----------------------------------------------------------------
age | .0043886 .0002786 15.75 0.000 .0038426 .0049347
logincome | -.0422827 .0034702 -12.18 0.000 -.0490842 -.0354812
numberdiseases | .0080596 .0006459 12.48 0.000 .0067937 .0093256
--------------------------------------------------------------------------------

. margins, dydx(*) atmeans predict(outcome(3))

Conditional marginal effects Number of obs = 5574


Model VCE : OIM

Expression : Pr(healthstatus==3), predict(outcome(3))


dy/dx w.r.t. : age logincome numberdiseases
at : age = 25.57613 (mean)
logincome = 8.696929 (mean)
numberdise~s = 11.20526 (mean)

--------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
---------------+----------------------------------------------------------------
age | -.0068148 .0003929 -17.34 0.000 -.0075849 -.0060447
logincome | .0656577 .0051072 12.86 0.000 .0556476 .0756677
numberdiseases | -.0125152 .0009472 -13.21 0.000 -.0143717 -.0106587
--------------------------------------------------------------------------------

.
. * Ordered probit model predicted probabilities
. predict p1oprobit, pr outcome(1)

. predict p2oprobit, pr outcome(2)

. predict p3oprobit, pr outcome(3)

. summarize p1oprobit p2oprobit p2oprobit

Variable | Obs Mean Std. Dev. Min Max


-------------+--------------------------------------------------------
p1oprobit | 5574 .0941691 .0897707 .0155477 .8556623
p2oprobit | 5574 .3641854 .0802058 .1361741 .497296
p2oprobit | 5574 .3641854 .0802058 .1361741 .497296

. tabulate $ylist

health |
status |
(fair, |
good, |
excellent) | Freq. Percent Cum.
------------+-----------------------------------
fair | 523 9.38 9.38
good | 2,034 36.49 45.87
excellent | 3,017 54.13 100.00
------------+-----------------------------------
Total | 5,574 100.00

You might also like