{smcl}
{* 26jan2004}{...}
{hline}
help for {hi:stcompet}{right:(SJ4-2: st0059)}
{hline}

{title:Generate Cumulative Incidence in presence of Competing Events}

{p 4 13 2}{cmd:stcompet} {it:newvar} {cmd:=} {c -(} {cmd:ci} | {cmd:se} | {cmd:hi} |
{cmd:lo} {c )-}
[[{it:newvar} {cmd:=} {it:...}] [{it:...}] ] [{cmd:if} {it:exp}] [{cmd:in}
{it:range}] {cmd:,}
{cmd:compet1(}{it:numlist}{cmd:)} [{cmd:compet2(}{it:numlist}{cmd:)}
{cmd:compet3(}{it:numlist}{cmd:)}
{cmd:compet4(}{it:numlist}{cmd:)} {cmd:compet5(}{it:numlist}{cmd:)}
{cmd:compet6(}{it:numlist}{cmd:)}
{cmd:by(}{it:varname}{cmd:)} {cmdab:l:evel}{cmd:(}{it:#}{cmd:)} ]

{p 4 4 2}
{cmd:stcompet} is for use with survival-time data; see help {help st}. You
must have {cmd:stset} your data before using this command; see help 
{help stset}.{p_end}

{p 4 4 2}
In the previous {cmd:stset}, you must specify
{cmdab:f:ailure(}{it:failvar}[{cmd:==}{it:numlist}]{cmd:)} where {it:numlist}
refers to the event of interest.


{title:Description}

{p 4 4 2}
In survival or cohort studies, the failure of an individual may be one of
several distinct failure types. In such a situation, we observe an event of
interest and one or more competing events whose occurrence precludes or alters
the probability of occurence of the first one.  {cmd:stcompet} creates
variables containing cumulative incidence, a function that, in this case,
appropriately estimates the probability of occurrence of each endpoint,
corresponding standard error, and confidence bounds.{p_end} 

{p 4 4 2}The values in {it:numlist} of the previous {cmd:stset} are assumed as
occurrence of event of interest.  In the {cmd:compet}{it:#}{cmd:()} options,
you can specify {it:numlist} relating to the occurrence of up to six competing
events.{p_end}


{title:Functions}

{p 4 8 2}
{cmd:ci} produces the cumulative incidence function.

{p 4 8 2}
{cmd:se} produces the standard error of the cumulative incidence.

{p 4 8 2}
{cmd:hi} produces the higher bound of the confidence interval based on 
ln[-ln({cmd:ci})].

{p 4 8 2}
{cmd:lo} produces the lower bound of the confidence interval based on 
ln[-ln({cmd:ci})].


{title:Options}

{p 4 8 2}
{cmd:compet1(}{it:numlist}{cmd:)} is not optional because at least one event
must compete with the event of interest. A failure of a competing event occurs
whenever {it:failvar}, specified in the previous {cmd:stset}, takes on any of
the values of this {it:numlist}. The function calculated will be
estimated with this competing event and the event of interest.

{p 4 8 2}
{cmd:compet2(}{it:numlist}{cmd:)} {it:...} {cmd:compet6(}{it:numlist}{cmd:)} 
refer to failures for other competing events.

{p 4 8 2}
{cmd:by(}{it:varname}{cmd:)} produces separate functions by making
separate calculations for each group identified by equal values of the
{cmd:by()} variable taking on integer or string values.

{p 4 8 2}
{cmd:level(}{it:#}{cmd:)} specifies the confidence level, as a percentage, for
the pointwise confidence interval around the cumulative incidence functions;
see help {help level}.


{title:Remarks}

{p 4 4 2}
Cumulative incidence is estimated by summing to {it:t} 
S{it:(t-1)} * h'{it:(t)}, where S{it:(t-1)} is the KME of the overall survival
function and h'{it:(t)} is the cause-specific hazard at the time {it:t}.

{p 4 4 2}
Standard errors are computed according to the formula in Marubini & Valsecchi
(1995, 341). They derive the estimator using delta method.{p_end}

{p 4 4 2}
Applying delta method Choudhury obtains an other formula presented as Dinse
and Larson's variance estimator of the cumulative incidence. He provides also
S-Plus codes to compute it. In my checks, using these codes in S-Plus, standard
errors are exactly the same as computed using Marubini & Valsecchi's formula
in Stata.

{p 4 4 2}
Choudhury proposed and showed that log(-log) trasformation improve coverage
accuracy of the confidence intervals. Thus, they are estimated using formula 4
of his article.


{title:Examples}

{p 4 4 2}Generate variables containing cumulative incidence and standard error{p_end}

{p 12 20 2}{cmd:. stset survtime, f(event==1)}{p_end}
{p 12 20 2}{cmd:. stcompet CumInc = ci SError = se, compet1(2) compet2(4)}{p_end}

{p 4 4 2}Generate variables containing cumulative incidence confidence bounds{p_end}

{p 12 20 2}{cmd:. stcompet High = hi Low = lo, compet1(2) compet2(4)}{p_end}

{p 4 4 2}Note that each created variable contains the function for all competing
events; i.e., the event of interest specified in stset statement and the
events in {cmd:compet}{it:#}{cmd:()} options. So if you want graph functions
relating to each event you need to type:{p_end} 
{p 12 20 2}{cmd:. gen CumInc1 = CumInc if event==1}{p_end}
{p 12 20 2}{cmd:. gen CumInc2 = CumInc if event==2}


{title:References}

{p 4 8 2}Marubini, E. and M. G. Valsecchi. 1995. 
{it:Analysing Survival Data from Clinical Trials and Observational Studies}.
Chichester, UK: John Wiley & Sons.

{p 4 8 2}Choudhury, J. B. 2002. Nonparametric confidence interval estimation
for competing risks analysis: application to contraceptive data. 
{it:Statistics in Medicine} 21: 1129-1144.

{p 4 8 2}Gooley, T. A., W. Leisenring, J. Crowley, and B. E. Storer. 1999.
Estimation of failure probabilities in the presence of competing risks: new
representations of old estimators.  {it:Statistics in Medicine} 18: 695-706.


{title:Authors}

        Enzo Coviello, Azienda U.S.L. BA/1, Italy
        coviello@mythnet.it
        
        May Boggess, StataCorp
        mboggess@stata.com

 
{title:Also see}

{p 4 13}
Online:  help for {help sts}, {help stset}{p_end}

{p 4 13}
Manual:  {hi:{bind:[R] st sts}}, {hi:{bind:[R] st sts generate}},
{hi:{bind:[R] st sts graph}}{p_end}
