Announcement

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

  • confidence interval for cox proportional hazard model hazard rates

    Hello Statalist, let me start by saying I am not a statistician. I am a person interested in doing some statistical analysis for work. I have had a handful of undergrad and a couple of graduate level statistics courses, but those were about 10 years ago, so I'm (a little) out of it. Any help or guidance here would be very appreciated.

    I have been using stata to build cox proportional hazards models, and I believe I have a good understanding of the model itself, however I am trying to build a confidence interval for the final hazard rates the model produces. I have seen the basic output provides confidence intervals for the coefficients, and I am able to get a covariance matrix of the various covariates, but I am struggling to find the way I would put a confidence interval around my lambda(t|x).

    I believe that this model is heavily used in epidemiological studies, where they likely only care about the relative hazard, but I care about the hazard rates themselves, not just the relative hazard. I have found through googling ways to get a confidence interval for the exp(X*B) portion (http://www.public.iastate.edu/~kkoeh...oxph.4page.pdf , page 318), but I want it for the full lambda0(t)*exp(X*B).

    Apologies if I butchered notation or terminology.

    Thank you in advance for any assistance!

  • #2
    Welcome to Statalist, Jeff! Be sure to read the FAQ, especially FAQ 12.

    sts graph can fit a Cox model in categories and display confidence intervals. However, with a general Cox hazard model, the only approach is to fit the equivalent flexible model with Paul Lambert's stpm2, available at SSC.

    Code:
    capture log close
    set more off
    
    webuse brcancer, clear
    rename x1 age
    
    stset rectime, failure(censrec = 1)
    /* sts graph */
    sts graph if hormon==0,  hazard ci name(g1, replace) ///
    title("Standard Treatment")
    sts graph if hormon==1, hazard ci name(g2, replace) ///
    title("Hormonal Therapy")
    graph combine g1 g2, ycommon xcommon name(g3, replace) ///
    note("g3: sts graph")
    graph export g3.png,  replace
    
    /* stcox   */
    stcox hormon age  , tvc(hormon)
    
    /* similar model stpm2 */
    stpm2 hormon age, scale(hazard) df(4) eform  tvc(hormon) dftvc(3)
    
    /* predict hazard rates */
    predict s50h1, hazard at(hormon 1 age 50 ) ci
    predict s50h0, hazard at(hormon 0 age 50) ci
    
    /* plot them */
    sort _t
    twoway connect s50h0*  _t,  ms(i i i)  name(g5, replace) nodraw title("Standard")
    twoway connect s50h1*  _t,  ms(i i i)  name(g6, replace) nodraw title("Hormonal Therapy")
    graph combine g5 g6 , xcommon ycommon   name(g7, replace) ///
     title("Hazard Function by Treatment" "at Age 50") note("g7: stpm2")
    graph export g7.png,  replace
    Click image for larger version

Name:	g3.png
Views:	1
Size:	29.5 KB
ID:	1345454


    Click image for larger version

Name:	g7.png
Views:	1
Size:	43.9 KB
ID:	1345455


    Steve Samuels
    Statistical Consulting
    [email protected]

    Stata 14.2

    Comment


    • #3
      Thank you for the response Steve, I will make sure to read the FAQ as well!

      Comment

      Working...
      X