Announcement

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

  • Competing risk model error message

    Dear all,

    I am trying to run a competing model with STATA and having the following error. I would really appreciate if anyone may help me.

    Thank you
    Sincerely,
    Oyun

    error message:
    option compete(): competing risks events must be stset as censored
    r(459);
    Codes
    PHP Code:
    gen death_before_chf =0
    replace death_before_chf
    =if (death==time_death time_chf)

    label define death_before_chf 0"censored" 1"event"replace 
    label value death_before_chf death_before_chf


    stset time_chf
    failure(chf==1id (id)

    stcrreg i.age i.gendercompete(death_before_chf)
        
    estimate store model1 

  • #2
    -stcrreg- does not allow you to have different variables to designate the primary failure event and the competing events. What you need is a single variable that takes on different values for the primary failure event, each competing event, and each censoring event. So you would need to do something like this (not tested):

    Code:
    gen failure_var = 0
    replace failiure_var = 1 if chf == 1
    replace failure_var = 2 if death == 1 & time_death < time_chf
    
    stset time_chf, failure(failure_var = 1)  id(id)
    stcrreg i.age i.gender, compete(failure_var = 2)
    Note: I don't know how you have defined the time_chf variable, but based just on its name I fear it is wrong. The variable you need in that part of the -stset- command must contain the time of occurence of whichever event occurs, whether it is chf, death from other causes, or end of observation due to withdrawal/end of study, etc. If you don't have a variable like that, you need to create one. If time_chf is in fact such a variable, then you are OK using it in this way (though if it were my project, I would give it a name that suggests its generality.)

    Comment


    • #3
      Thank you so much prof.Schechter for valuable guidance.
      It seems I have to create time variable which contains the time of occurence of whichever event occurs first as you suggested.

      Comment

      Working...
      X