Announcement

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

  • Cumulative incidence rate calculation in survival analysis

    I am trying to calculate cumulative incidence rates at different time points in survival analysis. When I previously asked for statistical advice, it was suggested that I should "Google stptime" and that I could try to set the intervals with the following command "stptime, at(1 (50) 350)". When I tried however I get the following error message: "stptime requires that you have previously stset an id() variable". Could anyone suggest what I must set with regards to "ïd"?

  • #2
    Welcome to the Stata Forum / Statalist,

    Please take some time to read the FAQ. There you will find information about using CODE delimiters or - dataex - to share an example to work with.

    With regards to - stset -, if you type - help stset - you will get clarifying examples.

    Since you didn't share information about the data set, I'll do some guess work. If you don't have an id variable, provided every row refers to unique observations, I mean, you don't have more than one row for the same individual, you may create it just by typing:

    Code:
    gen id = _n
    Hopefully that helps.
    Best regards,

    Marcos

    Comment


    • #3
      Hi Marcos

      Thanks for your response. I did generate "id" as suggested. Unfortunately I still get an error message.

      I am not sure what you would need to know about my dataset to be able to assist me. The command that was suggested to me for cumulative incidence rates was:
      stptime, at (1 (30) 365)

      That would (theoretically) indicate the cumulative proportion of major complications from day 1 to day 365 with intervals of 30 days.

      The error message from Stata is:
      stptime requires that you have previously stset an id() variable
      r(198);

      I have checked and the id variable is in the dataset. I have also tried re-running the survival analysis after generating the id variable, but I get the same error message.

      Is there perhaps a different command to calculate cumulative incidence rates? I actually know the different proportions at the different times, but wanted to generate 95% confidence intervals.

      Thanks in advance for any assistance

      Comment


      • #4
        Adding the id variable in the dataset is not sufficient. For the survival commands to know that it is an id, you must specify it in the stset statement.

        We request information about your study and problem to be sure that your approach is correct. Incidence rates have person-years as denominators. It appears to me, that you might actually want to estimate a cumulative incidence function or (same thing) cumulative incidence curve: the proportion who have failed, plotted against time from baseline. This is also known as the failure function and is equal to 1 minus the survival function. stptime is not the correct command for doing that. Commands that can do it include sts graph and sts list.
        Last edited by Steve Samuels; 07 Feb 2018, 02:26.
        Steve Samuels
        Statistical Consulting
        [email protected]

        Stata 14.2

        Comment


        • #5
          Penelope Rose Sorry for not giving a reply sooner. I was in business trip, very busy. That being said, I believe Steve Samuels provided a clarifying reply in #4. I hope the message was helpful to you. If not, please post an example - can be a toy example, as well - of what is happening with your data.
          Best regards,

          Marcos

          Comment

          Working...
          X