Announcement

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

  • Setting up data for competing risk analysis

    Hello,

    So I used a cox proportional regression model and I am pretty sure the assumptions have been violated mainly due to my Kaplan Meier curve showing a protective effect for the curve with the lowest survival. I researched STATA's stcrreg command which will probably work for me. However, I do not see any information on how to set-up the data first. For example, my data as death and transplant and the competing events but these are two separate variables as shown in my data example below. Do I recode death=2 if a patient had transplant? Or better yet, how do I know which variable is the competing risk variable. Thank you in advance.



    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float id str1(transplant cancer) float(died time)
     1 "Y" "N" 1 2.3
     2 "Y" "Y" 1 4.8
     3 "Y" "N" 0   7
     4 "N" "N" 1 3.3
     5 "Y" "Y" 0   7
     6 "N" "Y" 1 2.8
     7 "Y" "N" 1 2.2
     8 "Y" "Y" 0   5
     9 "N" "Y" 1 2.5
    10 "N" "N" 0   5
    end

  • #2
    The data requires no additional setup. You -stset- it the same way you did for the K-M analysis. The -stcrreg- command has a -compete- option that allows you to specify the variable which identifies the competing risk. In your case you would specify that option as -compete(transplant = 1)-

    Comment


    • #3
      Clyde is correct, but you might need to obtain additional data on time-to-transplant. Your data and research question are not clear to me. Are you for example, studying the incidence of cancer after transplant, transplants after cancer, or is the variable "cancer" and indicator for cancer as the cause-of-death. Either way, if "time" is the time-to-death then if transplant is a competing risk then you'll need time-to-transplant. Patient IDs 1 and 2 have both had a transplant and dies, but you only have one time. I suggest you consult a statistician.

      Comment


      • #4
        Thank you so much Clyde. This will solve my issue, however, I get an error message below when I use transplant as the competing risk variable.
        option compete(): competing risks events must be stset as censored

        Paul, the data was not necessarily collected in a population with transplant as the primary exposure but it looks like patients who had a transplant might be a higher risk for mortality which is validated by the proportional violation I encounter because transplant kept showing up as violating the model.

        Comment


        • #5
          First, I want to say that I agree with Paul Dickman. I was assuming that the time variable in those observations with a transplant was time-to-transplant, not time-to-death. But you never actually said that. So you have to make that be true. I have not encountered the kind of error message you received with the competing risks, but I don't use it that much and probably have never actually done it that way. So to get past that, make a new variable that is 0 for censored, 1 for death, and 2 for transplant. Let's call this variable outcome3. Then in your -stset- command set the failure option as outcome3 = 1, and set the -compete- option in -stcrreg- as outcome3 = 2.

          Comment


          • #6
            The fact that all observations with died==0 have an integer time and all observations with died==1 had a decimal time made me suspect that the variable time may represent time to death (even for the individuals who underwent a transplant).

            Comment


            • #7
              Thank you both very much for the detailed solutions. I used Paul's recommendation to add the time to transplant and I created a new variable with 0, 1, 2 with 2 being transplant (the competing variable). It worked out perfectly. Thank you.

              Comment

              Working...
              X