Announcement

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

  • xtstreg - How to extract hazard ratios after estimation?

    Hi,

    I am running a panel survival model and I want the estimates reported as hazard ratios.
    This is not a problem for the tables displayed in the Stata output window, but I don't find a way to access the matrix of estimated hazard ratios.
    I can access only the estimated coeffcients via
    matrix list - but this is not what I want. How can I do this?

    I simply estimate something like this:

    xtstreg D_gdp i.time, distribution(exponential) vce(robust)

    What I see in Stata is:
    Click image for larger version

Name:	hazard.JPG
Views:	1
Size:	16.6 KB
ID:	1421151

    And exactly the
    1.030946 is what I want.

    But what I get is:
    Click image for larger version

Name:	return.JPG
Views:	1
Size:	14.9 KB
ID:	1421152

    The coeffcient
    0.3047728 would come out if I estimate
    xtstreg D_gdp i.time, distribution(exponential) vce(robust) nohr

    How can I extract the hazard ratio?

    I also tried

    parmby "xtstreg D_gdp i.time, distribution(exponential) vce(robust)", saving(results.dta)

    But it also only gave the coeffcients and not the hazard ratios.

    What can I do? Thank you so much already for your help!

    Fabian



  • #2
    Take the exp(.) of the coefficient (which is the log hazard ratio).

    Comment


    • #3
      Of course. I was so keen finding a way to extract the ratios that I forgot about this easy workaround.
      Thank you so much!

      Comment


      • #4
        Hello, how do I obtain/export the standard error of the hazard ratio's estimated coefficient? Thanks

        Comment


        • #5
          Are you really sure you want the SE of the Hazard Ratio? If so, use the delta method

          Code:
          webuse cancer
          stcox age
          
          local se_hr1 sqrt(exp(_b[age])^2*_se[age]^2)
          di `se_hr1'
          
          nlcom exp(_b[age])
          local se_hr2 = sqrt(el(r(V), 1,1))
          di `se_hr2'
          If instead what you actually meant was the SE of the log-HR, then

          Code:
          di _se[age]
          Last edited by Andrea Discacciati; 12 Mar 2019, 13:23.

          Comment

          Working...
          X