Announcement

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

  • Computing and graphing cumulative incidence of GVHD using competing risk analysis

    Hello,

    I would like to compute the cumulative incidence (CI) of graft versus host disease following a transplant with death being the competing event. I've gone through "Cumulative incidence estimation in the presence of competing risks" but I'm not sure if I've set this up correctly and how to graph it.

    These are my variables:

    alive byte %10.0g 1-alive, 2-dead
    aGVHD byte %10.0g 1 - developed GVHD, 0-no GVHD
    contact float %9.0g date of last follow-up: based on a date variable that I converted using mdy() function to make it numeric
    tx_date double %10.0g date of transplant: based on a date variable that I converted using mdy() function to make it numeric
    aGVHD_date float %9.0g date of GVHD onset: based on a date variable that I converted using mdy() function to make it numeric

    *generated a variable that takes on the date of death or GVHD, whichever comes first. And if no death or GVHD then it should just be last follow-up date
    . gen contact2 = contact
    . replace contact2 = aGVHD_date if (aGVHD==1 & aGVHD_date<contact)

    *generate a variable to define the event of interest. So event = 1 is the outcome event (
    . gen event = 0 // no GVHD and no death
    . replace event = 1 if (aGVHD==1 & alive==1) // patient got aGVHD and patient is alive
    . replace event = 2 if (alive==2 & aGVHD==0) // patient died with no GVHD prior

    . stset contact2, failure(event==1) origin(tx_date) enter(tx_date) id(crid) exit(time tx_date+(365.25))
    . stcompet CIF = ci, compet1(2)

    How do I graph this?
    When I use
    . twoway line CIF contact2
    I get something crazy so I think it's the time variable that's wrong.... or maybe it's something else that I'm computing wrong.

    Any help would be appreciated

    I'm using Stata/SE 16.1 version


    Thanks,

    Kalina Abrol

  • #2
    Hello,

    I'm re-sending my question but formatted better using dataex. Each row in the dataex example is a patient.

    I would like to compute the cumulative incidence (CI) of graft versus host disease following a transplant with death being the competing event. I've gone through "Cumulative incidence estimation in the presence of competing risks" but I'm not sure if I've set this up correctly and how to graph it.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte(alive aGVHD) float(contact tx_date aGVHD_date)
    1 0 22186 21986     .
    1 1 21872 21705 21739
    1 0 21739 21558     .
    1 1 21739 21559 21598
    1 0 21763 21567     .
    2 0 21707 21566     .
    1 1 21775 21587 21641
    1 1 21783 21593 21634
    1 1 21781 21600 21704
    1 0 21811 21600     .
    1 1 21776 21603 21732
    1 1 21790 21607 21634
    1 1 21767 21608 21767
    1 0 21971 21789     .
    1 0 21812 21630     .
    1 1 21776 21635 21718
    1 0 21808 21636     .
    1 1 21816 21642 21732
    1 0 21822 21644     .
    1 0 21824 21649     .
    1 1 21823 21649 21697
    1 0 21843 21649     .
    1 1 21831 21650 21732
    1 1 21830 21651 21672
    1 1 21816 21657 21704
    1 0 21844 21669     .
    1 0 21844 21677     .
    1 1 21844 21686 21732
    1 0 21870 21691     .
    1 1 21865 21693 21760
    1 1 21874 21694 21746
    1 1 21860 21705 21767
    2 1 21864 21712 21746
    1 0 21880 21713     .
    1 1 21913 21720 21753
    1 1 21900 21726 21837
    1 0 21920 21728     .
    1 0 21927 21740     .
    1 1 21928 21748 21788
    1 1 21931 21748 21830
    1 0 21928 21749     .
    1 1 21921 21753 21799
    1 1 21931 21754 21931
    1 0 21928 21754     .
    1 0 21923 21760     .
    1 1 21928 21761 21795
    1 1 21921 21768 21809
    2 1 21902 21774 21808
    1 0 21970 21784     .
    2 0 21898 21789     .
    1 0 21957 21789     .
    1 0 21945 21790     .
    1 0 21964 21791     .
    1 1 21963 21804 21942
    1 1 21984 21817 21851
    1 1 21970 21818 21858
    1 0 21991 21826     .
    1 1 22236 21840 21879
    1 1 22049 21847 21865
    1 0 22054 21853     .
    1 1 22011 21853 21879
    1 1 22061 21854 21970
    1 0 22054 21866     .
    1 0 22048 21867     .
    1 1 22214 22035 22089
    1 0 22054 21895     .
    2 0 22016 21897     .
    1 1 22082 21902 21942
    1 1 22096 21902 21958
    1 0 22172 22014     .
    2 0 22336 22078     .
    1 1 22260 22081 22166
    end
    * generated a variable that takes on the date of death or GVHD, whichever comes first. And if no death or GVHD then it should just be last follow-up date
    Code:
    gen contact2 = contact
    replace contact2 = aGVHD_date if (aGVHD==1 & aGVHD_date<contact)
    *generate a variable to define the event of interest. So event = 1 is the outcome event (GVHD)
    Code:
    gen event = 0 // no GVHD and no death
    replace event = 1 if (aGVHD==1 & alive==1) // patient got aGVHD and patient is alive
    replace event = 2 if (alive==2 & aGVHD==0) // patient died with no GVHD prior
    *Cumulative incidence of GVHD
    Code:
    stset contact2, failure(event==1) origin(tx_date) enter(tx_date) id(crid) exit(time tx_date+(365.25))
    stcompet CIF = ci, compet1(2)
    How do I graph this?
    When I use
    . twoway line CIF contact2
    I get something crazy so I think it's the time variable that's wrong.... or maybe it's something else that I'm computing wrong.

    Any help would be appreciated


    I'm using Stata/SE 16.1 version


    Thanks,

    Kalina Abrol

    Comment

    Working...
    X