Announcement

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

  • Life table and hazard ratio?

    Hello, everyone

    I have computed the hazard function and the hazard function of two groups were listed there. However could Stata compute and show the hazard ratios between these two groups by a simple command? I don't want to compute the hazard ratio manually.

    Click image for larger version

Name:	Screen Shot 2017-09-09 at 11.00.09 PM.png
Views:	1
Size:	208.4 KB
ID:	1409771


    PS: see the screenshot

    Tom

  • #2
    The hazard functions you have displayed are estimated non-parametrically. There is no such thing as "the hazard ratio" in this context. Indeed, if you look at the actual ratio of the hazards at various times you will see that this ratio changes.

    When we speak of a hazard ratio, we do so in the context of either a semi-parametric (e.g. Cox model, -help stcox-) or parametric (-help streg-) survival model which assumes that the groups have a common baseline hazard function, modified in each group by a hazard ratio specific to the group. Departures from this structure are attributed to error variance. So if you want to characterize the differences between these two groups by a hazard ratio you have to select a proportional-hazards based model to fit.

    Alternatively, if you wish to non-parametrically test the null hypothesis that the survival (equivalently, the hazard) functions are equal in the two groups, you can do that with -sts test-. This will give you a test of equality, but there is no hazard ratio or other summary statistic associated with it.

    Comment


    • #3
      Thanks for your response, Clyde.

      Actually, a book had drew out the graph of survivorship function, probability density function, and hazard function. Can I draw similar graphs and how by Stata? I know how to draw the graph of survivorship function,

      Code:
      ltable graph
      But how about probability density function and hazard function?

      Comment


      • #4
        See -help sts graph- for the hazard function.

        As for the density function, I'm not aware of a command that will do that automatically. So you would have to calculate the density function yourself and then use -graph- to graph it. The survival density function is the negative of the derivative of the survival function, so see -help dydx-.

        Comment


        • #5
          Tom.
          paragraph 13.3.2 in Altman G. Practical statistics for medical research. Chapman & Hall/CRC. Boca Raton, FL: 1999: 375-76 covers the calculation of non-parametric hazard ratio.
          It often happens to find out that measure reported along the result of the non-parametric log-rank test in clinical articles.
          I do agree with Clyde's reply #2 and I find the non-parametric hazard ratio pretty bewildering.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Thanks. I just forgot to post the screenshot. Add it below. They are the survivorship function plot, the hazard function plot, and probability density function plot, all deviated from a life-table analysis.

            Click image for larger version

Name:	Screen Shot 2017-09-12 at 11.26.06 PM.png
Views:	1
Size:	178.7 KB
ID:	1410114

            Comment


            • #7
              Code:
              clear all
              sysuse cancer
              tempfile temp tofill
              
              sts list, cumhaz saving(`tofill')
              use `tofill'
              keep time cumhaz
              save `tofill', replace
              
              sysuse cancer, clear
              sts list, surv saving(`temp')
              use `temp'
              keep time survivor
              set obs `=_N+1'
              replace time = 0 in `=_N'
              replace survivor=1 in `=_N'
              sort time
              merge 1:1 time using `tofill'
              drop _merge
              
              gen haz = cumhaz - cumhaz[_n-1]
              replace haz = cumhaz if _n == 1
              gen density = haz * survivor
              
              drop cumhaz
              twoway line survivor time,     ///
                  connect(J)  ylab(0(.25)1)  ///
                  name(surv, replace)
                  
              twoway line haz time, name(haz, replace)
              
              twoway line density time, name(dens, replace)
              ---------------------------------
              Maarten L. Buis
              University of Konstanz
              Department of history and sociology
              box 40
              78457 Konstanz
              Germany
              http://www.maartenbuis.nl
              ---------------------------------

              Comment

              Working...
              X