Title
stpm2cif -- Competing risks post-estimation tool to estimate cumulative incidence function after stpm2
Syntax
stpm2cif newvarlist [, options]
options Description ------------------------------------------------------------------------- cause1...cause10 obs specifies the number of observations (of time) to predict for ci calculates confidence intervals for cumulative incidence function mint the minimum value of follow up time maxt the maximum value of follow up time timename name of time variable derived by code hazard predicts cause-specific hazard function for each cause contmort predicts the contribution to total mortality conthaz predicts the contribution to hazard -------------------------------------------------------------------------
Description
stpm2cif can be used after stpm2 to obtain cumulative incidence functions for up to 10 causes of death.
Options
Note: in the table below, vn is an abbreviation for varname.
+------+ ----+ Main +-------------------------------------------------------------
cause1(vn # [vn # ..])..cause10(vn # [vn # ..]) requests that the covariates specified by the listed varname(s) be set to # when predicting the cumulative incidence functions for each cause. It is complusory to specify cause1 and cause2.
obs(integer) specifies the number of observations (of time) to predict for (default 1000). Observations are evenly spread between the minimum and maximum value of follow-up time.
ci calculates a 95% confidence interval for the cumulative incidence function and stores the confidence limits in CIF_newvar_lci and CIF_newvar_uci.
mint(#) the minimum value of follow up time. The default is set as the minimum event time from stset.
maxt(#) the maximum value of follow up time. The default is set as the maximum event time from stset.
timename(newvarname) this is the time variable generated during predictions for the cumulative incidence function (default _newt). Note that this is the variable for time that needs to be used when plotting curves for the cumulative incidence function and the cause-specific hazard function.
hazard predicts cause-specific hazard function for each cause.
contmort predicts the contribution to total mortality.
conthaz predicts the contribution to hazard.
Examples
This example is taken from a paper by Putter et al. (2007) where data were anal > yzed on 324 homosexual men from the Amsterdam Cohort Studies on HIV infection and AIDS. For a more detailed descrip > tion of the web based data see Example 4 in the following document http://www.stata.com/features/competing-ris > ks/stcrreg.pdf.
Expand the data set so that each patient has a row of data for each of the two > competing events - time to SI phenotype appearance and diagnosis of AIDS.
webuse hiv_si gen id=_n expand 2
Create a cause variable variable for each of the two competing events. Generate > an event indicator by setting the cause variable equal to the status variable. The status variable indicates > whether the patient has experienced either of the two events. Once this has been generated use it to stset the data > .
bysort id: gen cause= _n gen si=cause==1 gen aids=cause==2 gen event=(cause==status) stset time, failure(event)
Run stpm2 including each of the two competing events in the model.
stpm2 si aids, scale(hazard) tvc(si aids) nocons rcsbaseoff dftvc(3)
Run stpm2cif to obtain the cumulative incidence function for each cause. Note t > hat the names in the newvarlist are in capital letters so as not to overwrite the original variables with those > names.
stpm2cif SI AIDS, cause1(si 1) cause2(aids 1)
A plot of the two cumulative incidence functions for SI appearance and diagnosi > s of AIDS can be obtained as follows:
twoway (line CIF_SI _newt)(line CIF_AIDS _newt), xtitle(Years from HIV infection) ytitle(Cumulative Incidence Function) ylabel(, angle(0))
The variables CIF_SI and CIF_AIDS are the cumulative incidence functions genera > ted by the stpm2cif command. Note that the curve is plotted against _newt which is the new time variable gen > erate by stpm2cif during the predictions.
In order to plot a stacked graph of the cumulative incidence functions you need > to sum up the two functions.
gen tot1=CIF_SI gen tot2=CIF_SI+CIF_AIDS
Now the stacked cumulative incidence graph can be plotted as follows:
twoway (area tot2 _newt)(area tot1 _newt), xtitle(Years from HIV infection) ytitle(Cumulative Incidence Function) ylabel(, angle(0))
Note that the legend shows tot1 which represents CIF_SI and tot2 which represen > ts CIF_AIDS.
Also see
Online: [ST] stpm2 [ST] stpm2_postestimation;