Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Obtaining hazard rate instead of cumulative hazard

    Hi Statalist,

    I am trying to produce that hazard rate at different time points. I cannot share my data due to it being sensitive data, but I can share the code I used.

    I first set up my survival data
    Code:
    stset survtime, failure(fail==1)
    I then get the cumulative hazard with:

    Code:
    sts list, cumhaz risktable (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14)
    However, I would like to get the hazard rate not the cumulative hazard. I followed the advice here: https://www.stata.com/statalist/arch.../msg00658.html

    Code:
    ssc install stkerhaz
    stcoz, estimate basech(H)
    stkerhaz, basecha(H) bwidth(5) ci out (hazard_rate, replace)
    use hazard_rate, clear
    (stkerhaz (SSC) by Enzo Coviello)

    I am not sure if this is the correct way to calculate the hazard rate? I am getting confused because I’ve seen suggestions to use this:

    Code:
    Sts graph, ci hazard
    Sts graph, ci hazard outfile (hazard)
    Saving the file gives me the estimates but no 95% confidence interval.
Working...
X