 Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: Recovering the discrete time (interval) baseline hazard function

 From Urmi Bhattacharya To statalist@hsphsun2.harvard.edu Subject st: Recovering the discrete time (interval) baseline hazard function Date Tue, 26 Apr 2011 19:15:20 -0400

```Dear Statalisters,

I am interested in plotting the discrete time (interval) baseline
hazard function against the discrete failure time. I am illustrating
what I have done so far.

use cancer.dta
ge id=_n
lab var id "subject identifier"
expand studytim
bysort id:ge j= _n
lab var j"spell month"

bysort id:ge dead = died==1 & _n==_N
lab var dead "binary depvar for discrete hazard model"

ta j,ge(d)
ge dur1=d1+d2+d3+d4+d5+d6
ge dur2=d7+d8+d9+d10+d11+d12
ge dur3=d13+d14+d15+d16+d17+d18
ge dur4=d19+d20+d21+d22+d23+d24
ge dur5=d25+d26+d27+d28+d28+d30
ge dur6=d31+d32+d33+d34+d35+d36+d37+d38+d39

So far the code is exactly as provided by Prof Stephen Jenkins in
(Survival Analysis with Stata: Module EC968: Part II: Lesson 6)

Then I use the cloglog model which gives the following coefficient table:

cloglog dead drug age dur1 dur2 dur3 dur4 dur5 dur6,nocons nolog

Complementary log-log regression                Number of obs     =        744
Zero
outcomes     =        713

Nonzero outcomes  =         31

Wald
chi2(8)      =     236.62
Log likelihood = -113.84096                     Prob > chi2       =     0.0000

------------------------------------------------------------------------------
dead |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
drug |   -1.55814   .2962569    -5.26   0.000    -2.138793   -.9774874
age |   .0333702    .021577     1.55   0.122      -.00892    .0756604
dur1 |  -2.732428   1.100091    -2.48   0.013    -4.888567   -.5762891
dur2 |  -2.246698   1.067769    -2.10   0.035    -4.339487   -.1539086
dur3 |   -2.23858   1.107324    -2.02   0.043    -4.408894   -.0682651
dur4 |  -1.285214   1.083815    -1.19   0.236    -3.409453    .8390242
dur5 |  -.1979354   .9196818    -0.22   0.830    -2.000479    1.604608
dur6 |  -.5873695   1.405062    -0.42   0.676     -3.34124    2.166501
------------------------------------------------------------------------------

Now  to generate the piecewise baseline hazard function I do the following:

generate h0=-2.732428 *dur1 + -2.246698*dur2 + -2.23858*dur3 +
-1.285214*dur4 + -.1979354*dur5 + -.5873695*dur6

twoway (connect h0 j, sort msymbol(t) connect (J)),xlabel (1(1)39)

My question is if this would give me the piecewise constant baseline
discrete hazard function?

Thanks for any help in advance

Urmi Bhattacharya
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```