Announcement

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

  • Conditional Risk Using STPM2

    Dear All,

    I would like to predict a conditonal risk for a recurrence at 6 months after having had no recurrence at 3 months using stpm2 and the predict command.

    stpm2 x y, scale(hazard) df(z) eform

    gen time3m = 3

    predict hazard3months = hazard timevar(time3m)


    gen time6m = 6

    predict hazard6months = hazard timevar(time6m)


    The problem occuring when following the steps as provided by Paul Dickman (https://www.statalist.org/forums/for...ival-modelling) is that all values after

    gen = hazard6months / hazard3months

    are of the the same value. So I merely receive a horizontal line when plotting the graph against age.

    I would be very grateful for any advice how to overcome this issue.

    Thank you in advance!

    Best regards,

    Maria Smolle

  • #2
    You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

    You're using a user-written procedure. It is possible that no one active on this list uses it. User written procedures may also not necessarily interact well with Stata procedures. I don't use it, but the documentation says

    timevar(varname) time variable used for predictions; default is timevar(_t)

    This seems to mean that timevar should be a variable. By giving it a specific value, you may be making all the predictions for that value (and get no variance). You may want to at() instead.

    Comment


    • #3

      Dear Phil Bromiley,

      Thank you for your valuable suggestions!

      I have followed the instructions for conditional survival as suggested by Paul Dickman in a previous post (and substituted "survival" by "hazard").

      Attached is the code for 3 and 6 month conditional hazard as caluclated with the "colon.dta" dataset.

      Code:
      *conditional 3 and 6 month hazard*
      
      stset surv_mm, failure(status=1,2) scale(12) id(id) exit(time 60.5)
      gen _age = min(int(age + _t),99)
      gen _year = int(yydx + _t)
      
      generate t3 = 0.25
      generate t6 = 0.5
      
      stpm2 age, df(4) scale(hazard) eform
      
      predict h3, hazard timevar(t3)
      
      predict h6, hazard timevar(t6)
      
      gen h63 = h6 /h3
      
      twoway hist h63
      I am aware of the fact that with the colon dataset, displaying of hazards is not very sensible - I am merely giving the example for viewing purposes.

      When changing the "hazard" to "survival", the conditional survival can be easily calculated (and depicted in a histogram).

      Code:
      *conditional 3 and 6 month survival*
      
      stset surv_mm, failure(status=1,2) scale(12) id(id) exit(time 60.5)
      gen _age = min(int(age + _t),99)
      gen _year = int(yydx + _t)
      
      generate t3 = 0.25
      generate t6 = 0.5
      
      stpm2 age, df(4) scale(hazard) eform
      
      predict s3, survival timevar(t3)
      
      predict s6, survival timevar(t6)
      
      gen s63 = s6 /s3
      
      twoway hist s63

      In order to answer my question, I would need to know the conditional hazard - i.e. "a patient had no recurrence of the tumour at 3 months - what is their risk of having a recurrence at 6 months"?

      With Kind regards,

      Maria Smolle

      Comment


      • #4
        Hi Maria,

        I am not sure if I really understand what you are trying to calculate and why you are trying to use hazard functions rather than probabilities. The hazard is a rate, not a probability. It is also a conditional measure. In your example you have calculated the instantaneous mortality rate at 3 and 6 months, i.e. the mortality rate for those still at risk at 3 or 6 months.

        It appears you want to estimate the probability of having an event for individuals still at risk after a specific point in time. You can use a conditional survival function as you have done in your second chunk of code. Your code above give the probability of still be alive (not having the event) at 6 months given you are still alive at 3 months. The probability of being dead (having the event) at 6 months given you are alive at 3 months is simply 1- s6/s3.

        Paul

        Comment


        • #5
          Dear Prof. Lambert,

          Thank you very much for your response and the valuable comments!

          I have had a complete error in reasoning regarding rates and hazards - which has been solved by your explanation.

          With the code you provided, I could answer my question.

          Thank you again for your time.

          With kind regards,

          Maria

          Comment

          Working...
          X