Title
stcompadj -- Adjusted Cumulative Incidence in the presence of competing risks
Syntax
stcompadj var [= # var ...] [if] [in] , compet(# [...] ) [ maineffect(varlist) competeffect(varlist) flexible df(#) generate(newvar newvar) savexpanded(filename [,replace]) bootci reps(#) ci showmod level(#) ]
options Description ------------------------------------------------------------------------- Options compet(# [#]) A failure of a competing event occurs whenever failvar specified in the previous stset takes on any of the values of this numlist. It is not an option. maineffect(varlist) covariates acting only on the main event. competeffect(varlist) covariates acting only on the competing event. flexible cause a flexible parametric, instead of a Cox, model is fitted to the data. df(#) degrees of freedom for the underlying flexible parametric model. generate(newvar1 newvar2) specify the names of covariates containing the cumulative incidence of the main and competing event savexpanded(filename) save the data file in the expanded format suitable for further analysis. bootci compute bootstrap confidence intervals of the cumulative incidence functions. reps(#) specify # bootstrap replications; default is reps(1000). ci compute confidence intervals of the cumulative incidence functions after a flexible parametric model. showmod shows the fitted model (Cox or flexible parametric) level set confidence level. Default is 95
You must stset your data before using stcompadj. In previous stset you must specify failure(varname==numlist) where numlist refers to the event of interest; see stset
The moremata user package must be installed on the system (Jann 2005). See ssc describe moremata.
Options
compet(# [#]) is not an option. A failure of a competing event occurs whenever failvar specified in the previous stset takes on any of the values of this numlist.
maineffect(varlist) varlist is the list of the variables acting only on the main event.
competeffect(varlist) varlist is the list of the variables acting only on the competing event. Note that the same variable can be specified both in maineffect(varlist) and competeffect(varlist). Then, this variable is assumed to have different effects on the main and competing event. Variables not specified either in maineffect(varlist) or in competeffect(varlist) are assumed to have the same effect on the main and the competing event.
flexible switches stcompadj to fit a flexible parametric model to the expanded data. This allows to easily obtain the confidence intervals of the covariate-adjusted CI.
df(#) specifies the degrees of freedom for the restriced cubic spline function used for the flexible parametric model. This option has effect only when flexible is also specified. Allowed values are 1-10. The default is 4.
generate(newvarname1 newvarname2) gives two alternative names to the variables containing the covariate-adjusted CI function for the main and competing event. Default names are CI_Main and CI_Compet.
savexpanded(filename [,replace]) states the name of the file where the expanded data are to be saved. See examples below for the use of this file.
bootci computes CI confidence intervals by resampling observations from the expanded dataset. This method is only available when the Cox model is used for fitting the effect of the covariates.
reps(#) sets the number of bootstrap replications to be performed. The default is 1000.
ci estimates CI confidence intervals when a parametric flexible model is used for fitting the effect of the covariates. When data are sparse a small number of df is recommended for estimating confidence intervals.
showmod shows the model, Cox or flexible parametric, fitted to the expanded data. This can be usefull for checking that the model fitted is as you expect.
level(#) sets the confidence level; default is level(95) or as set by set level
Remarks
stcompadj estimates the adjusted cumulative incidence function based on a Cox or a flexible parametric regression model in the presence of competing risks.
Cox regression in the presence of competing risks is usually performed by fitting separate models for each failure type. It is possible to obtain the same results by using a single analysis after appropriately adapting the data set. In short this consists of expanding each observation for each cause of failure, creating a stratum indicator taking on a value of 1 for the first n records, 2 for the following n records and so on, and modifying the failure indicator so that it attains the value 1 for each observation of death caused by the main event in the first stratum, for each observation of death caused by the competing event in the second stratum and so on. This way of representing data (expanded format) allows to model both identical and different effects of the same covariate on the main and competing events. Note that at present stcompadj handles the presence of one event competing with the main. For more details see reference.
After adapting the data set stcompadj fits a Cox model whose covariates are the variables specified in var [[= #] var ...]. Then, from the baseline cumulative hazard and the linear predictor it computes and saves in two variables the cumulative incidence (CI) function for the main and competing event adjusted to the mean or to the specified number of each covariate if the = # part is specified.
As an alternative to the Cox model, a flexible parametric model can be fitted to the expanded data set by specifying flexible. This allows one to easily estimate the confidence intervals of the CI function. The stpm2 (Lambert 2009) and rcsgen (Nelson, Lambert, Rutherford 2008) user packages must be installed on the system. See net describe stpm2 and ssc describe rcsgen.
By default the fitted model considers the covariates as having the same effect on the main as on the competing event. The options maineffect(varlist) and competeffect(varlist) allow to fit a model where some of the previously stated variables have effect only on the main or on the competing event. If the same variable is specified both in maineffect(varlist) and competeffect(varlist) then it is assumed that it has different effects on the main and competing event.
By default the CI function for the main and competing event is saved in two variables named CI_Main and CI_Compet. Other names can be specified by using generate(newvar1 newvar2). If bootci or ci is also specified then higher and lower confidence bounds of the CI are saved in four new variables whose names are prefixed by Hi_ and Lo_.
Data in the expanded format can be saved by using savexpanded(filename). This format allows to test the equality of the effects of a covariate on the main and on the competing event and the difference between the hazards of the main and competing event under the assumption of the cause-specific hazards being proportional (see example below).
Examples
The cumulative incidence is estimated in a model where sex has the same effect on the main as on the competing event, and thick has effect only on the main event. The function is evaluated for males (sex=1) and thickness of the tumor 2 mm above the mean (thick=2):
use "C:\Data\malignantmelanoma", clear stset time,failure(cause==1)
stcompadj sex=1 thick=2, compet(2) maineffect(thick) showmod nolog nohr sort _t l _t CI_Main CI_Compet in 1/12
Adjusted cumulative incidence is estimated for two levels of a covariate and two graphs are produced for the main and competing event (fig. 5 in the second reference).
use si.dta,clear stset time, f(status==1)
stcompadj ccr=0 , compet(2) maineffect(ccr) competeffect(ccr) gen(Main0 Compet0) stcompadj ccr=1 , compet(2) maineffect(ccr) competeffect(ccr) gen(Main1 Compet1) twoway line Main0 Main1 _t, sort c(J J) scheme(lean2) xti("Years from HIV Infection") yti("Cumulative Incidence") yla(0(.1).5,glp(shortdash)) xla(0(2)12) legend(pos(11) ring(0) label(1 "WW") label(2 "WM")) ti("AIDS")
twoway line Compet0 Compet1 _t if _t<13.5, sort c(J J) scheme(lean2) xti("Years from HIV Infection") yti("Cumulative Incidence") yla(0(.1).5,glp(shortdash)) xla(0(2)12) legend(pos(11) ring(0) label(1 "WW") label(2 "WM")) ti("SI Appearance")
Confidence intervals of the cumulative incidence are estimated by sampling with replacement (see bsample) from data.
stcompadj ccr=0 , compet(2) maineffect(ccr) competeffect(ccr) gen(Main0 Compet0) bootci stcompadj ccr=1 , compet(2) maineffect(ccr) competeffect(ccr) gen(Main1 Compet1) bootci
twoway line Main1 Hi_Main1 Lo_Main1 Main0 Hi_Main0 Lo_Main0 _t , sort c(J J J J J J) lp(l - - l - -)" scheme(lean2) xti("Years from HIV Infection") yti("Cumulative Incidence") yla(0(.1).65,nogrid) xla(0(2)12) legend(pos(11) ring(0) label(1 "WW") label(4 "WM") order(1 4)) ti("AIDS")
The estimate of the confidence intervals may be time and memory consuming mainly if starting data are large. Note also that the confidence intervals obtained by using this approach is not yet validated.
Confidence intervals of the cumulative incidence are now obtained by fitting a flexible parametric model (see stpm2) to the expanded data set.
stcompadj ccr=0 , compet(2) maineffect(ccr) competeffect(ccr) gen(Fl_Main0 Fl_Compet0) flexible ci stcompadj ccr=1 , compet(2) maineffect(ccr) competeffect(ccr) gen(Fl_Main1 Fl_Compet1) flexible ci
twoway line Fl_Main1 Hi_Fl_Main1 Lo_Fl_Main1 Fl_Main0 Hi_Fl_Main0 Lo_Fl_Main0 _t , sort c(J J J J J J) lp(l - - l - -)" scheme(lean2) xti("Years from HIV Infection") yti("Cumulative Incidence") yla(0(.1).65,nogrid) xla(0(2)12) legend(pos(11) ring(0) label(1 "WW") label(4 "WM") order(1 4)) ti("AIDS")
After saving data in the expanded format the equality of the effect of a covariate on the main and competing event can be tested as follows:
- Saving expanding format data assuming that the covariate ccr has the same effect on the main and competing event
stcompadj ccr=1 , compet(2) savexp(silong,replace)
- Fit a Cox model where the ccr effect interacts with stratum indicator variable use silong,clear xi: stcox i.ccr*i.stratum, strata(stratum) nohr nolog
The coefficient for the interaction term represents the difference in the ccr effect on the main and competing event. The corresponding z and p value assess the significance of this difference.
In the expanded data format the difference of the hazards of the main and competing event can also be checked under the assumption that they are proportional.
- Saving expanded data format assuming that the covariate ccr has different effects on the main and competing event stcompadj ccr=1 , compet(2) maineffect(ccr) competeffect(ccr) savexp(silong,replace)
- Fit a Cox model whose covariates are the two ccr effects and the stratum indicator variable. use silong,clear xi: stcox Main_ccr Compet_ccr stratum, nohr nolog
The coefficient for the stratum term represents the difference of the cause-specific hazards of the competing vs. the main event under the assumption that they are proportional.
Downloading ancillary files in one of your `"`c(adopath)'"' directory you can run this example.
(click to run)
Also see
On-line: help for stcompet, stpepemori (if installed).
References
Rosthoj S., Andersen P. K., and Abildstrom S. Z. SAS macros for estimation of the cumulative incidence functions based on a Cox regression model for competing risks. Computer methods and Programs in Biomedicine (2004) 74: 69-75.
Putter H., Fiocco M., and Geskus R. B. Tutorial in biostatistics: Competing risks and multi-state models. Statistics in Medicine (2007) 26: 2389-2430.
Aknowledgments
Thanks to Kerry Kammire of the tech-support for his suggestion in writing the Mata code.
Author Enzo Coviello (enzo.coviello@alice.it)