Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: competing risks with repeated ordered events

From   Marina Daskalopoulou <>
Subject   Re: st: competing risks with repeated ordered events
Date   Fri, 26 Apr 2013 15:06:39 +0100

Dear Christophe

If you want to fit the model for all your events simultaneously you need to
augment the data set by n number of events and then generate an identifier
for each failure type.

expand 3 /* if you have 3 events for example */

bys id: gen k=_n /* sort by your identifier and then the first record of
each subject will be their failure type (1,2,3...) */

Then generate a binary failure indicator:

gen failed=(event==k) /* make sure there are no missing values in "failed"

Declare the data as survival data:

stset time, f(failed) /* include censoring/origin date etc */

And run your proportional hazards model

xi: stcox i.varname i.varname2 i.varname3 i.k

You could also run it in a loop:
forvalues i=1/3 {
stcox i.varname i.varname2 i.varname3 if k==`i'

The CASCADE collaboration has an excellent manual on competing risks on the
MRC CTU website.

Hope this helps,
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index