Chapter 22 - Duration Analysis
Examples
------------------------------------------------------------------------------------------
name: SN
log: \iiexample22.smcl
log type: smcl
opened on: 13 May 2020, 17:41:13
. **********************************************
. * Solomon Negash - Examples
. * Wooldridge (2010). Economic Analysis of Cross-Section and Panel Data. 2nd ed.
. * STATA Program, version 16.1.
. * Chapter 22 - Duration Analysis
. ***********************************************
. // Example 22.5 (Weibull Model for Recidivism Duration)
. bcuse recid, clear nodesc
. stset durat, failure(cens=0)
failure event: cens == 0
obs. time interval: (0, durat]
exit on or before: failure
------------------------------------------------------------------------------
1,445 total observations
0 exclusions
------------------------------------------------------------------------------
1,445 observations remaining, representing
552 failures in single-record/single-failure data
80,013 total analysis time at risk and under observation
at risk from t = 0
earliest observed entry t = 0
last observed exit t = 81
. streg workprg priors tserved felon alcohol drugs black married educ age, dist(weibull) nohr
failure _d: cens == 0
analysis time _t: durat
Weibull PH regression
No. of subjects = 1,445 Number of obs = 1,445
No. of failures = 552
Time at risk = 80013
LR chi2(10) = 165.48
Log likelihood = -1633.0325 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
_t | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
workprg | .0908893 .0906478 1.00 0.316 -.0867772 .2685558
priors | .0887867 .0134355 6.61 0.000 .0624535 .1151198
tserved | .0135625 .0016808 8.07 0.000 .0102682 .0168567
felon | -.2994775 .105974 -2.83 0.005 -.5071826 -.0917723
alcohol | .4473611 .1057353 4.23 0.000 .2401236 .6545985
drugs | .2814605 .0978644 2.88 0.004 .0896499 .4732711
black | .4537147 .0883037 5.14 0.000 .2806426 .6267867
married | -.1515864 .1092454 -1.39 0.165 -.3657035 .0625307
educ | -.0232984 .0194196 -1.20 0.230 -.0613601 .0147633
age | -.0037246 .000525 -7.09 0.000 -.0047536 -.0026956
_cons | -3.402094 .3010177 -11.30 0.000 -3.992077 -2.81211
-------------+----------------------------------------------------------------
/ln_p | -.2158398 .0389149 -5.55 0.000 -.2921115 -.1395681
-------------+----------------------------------------------------------------
p | .8058644 .0313601 .7466852 .8697338
1/p | 1.240904 .0482896 1.149777 1.339252
------------------------------------------------------------------------------
. streg , dist(weibull) nohr
failure _d: cens == 0
analysis time _t: durat
Weibull PH regression
No. of subjects = 1,445 Number of obs = 1,445
No. of failures = 552
Time at risk = 80013
LR chi2(0) = -0.00
Log likelihood = -1715.7711 Prob > chi2 = .
------------------------------------------------------------------------------
_t | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_cons | -4.017511 .1329745 -30.21 0.000 -4.278136 -3.756886
-------------+----------------------------------------------------------------
/ln_p | -.2626894 .0397168 -6.61 0.000 -.3405329 -.1848458
-------------+----------------------------------------------------------------
p | .7689807 .0305415 .7113911 .8312325
1/p | 1.300423 .0516487 1.203033 1.405697
------------------------------------------------------------------------------
. set scheme s2mono
. stcurve, hazard caption("{bf: Figure 22.1} " "{stSerif: Weibull hazard of recidivism}", ///
position(7) size(*.8)) ytitle(Hazard) xtitle("Months until arrest") title("")
. sts graph, hazard caption("{bf: Figure 22.2} " "{stSerif: Lognormal hazard of recidivism}", ///
position(7) size(*.8)) ytitle(Hazard) xtitle("Months until arrest") title("")
. log close
name: SN
log: iiexample22.smcl
log type: smcl
closed on: 13 May 2020, 17:41:16
------------------------------------------------------------------------------------------