Announcement

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

  • Help with hazard function plot

    Hi,

    I'm looking for help with hazard function plot.

    Sample of dataset:
    ID Age Drugduration Hypertension Event EventDay Censored
    1 76 200 1 0 83 0
    2 80 180 0 1 214 0
    3 85 120 1 0 275 1


    I used these codes:
    Code:
    stset EventDay, failure(Event) id(ID)
    stcox Age Drugduration
    stcurve, hazard kernel(gauss)
    However, the plot does not begin at t=0. It begins at t=180. I have checked my dataset and EventDay data begin at t=3.

    Then I tried to predict the baseline hazard contribution using these codes:
    Code:
    predict hr1, basehc
    predict xb, xb
    gen haz = hr1*exp(xb)
    There are 935 missing values generated from the code. These missing values are from patient with Event=0.
    Can anyone give a possible suggestion/fix for these problems?

    Thanks.
    Wa
    Last edited by Wardati Syahrul; 12 Mar 2015, 07:10.

  • #2
    With regard to the question about the plot, I note that the first observation in your sample data has neither event nor censoring. I'm not very strong on hazard models, but I think if an observation has no event and no censoring ... well, I don't really know what to make of such an observation. I think any observation with no event is effectively censored at the time the data is recorded.

    So, is it possible that 180 is the smallest value of EventDay that does not have both Event==0 and Censored==0?

    Comment


    • #3
      1.The manual for stcurve (Stata 13 , p. 238) says:
      If the epan2, biweight, or rectangular kernel is used, the bias
      correction near the boundary is performed using boundary kernels. For other kernels, the plotted
      range of the smoothed hazard function is restricted to be inside of one bandwidth from each
      endpoint. For these other kernels, specifying noboundary merely removes this range restriction
      So try noboundary

      2. predict generates predictions only at failure times; the missings are for individuals who did not fail.
      Last edited by Steve Samuels; 13 Mar 2015, 19:32.
      Steve Samuels
      Statistical Consulting
      [email protected]

      Stata 14.2

      Comment


      • #4
        Hi Steven,

        Thank you for the solutions of both problems. I've tried 'noboundary' and it's really working. The plot now does start at t=0.

        Thank you so much.

        Comment

        Working...
        X