help forstcompadj-------------------------------------------------------------------------------

Title

stcompadj-- Adjusted Cumulative Incidence in the presence of competing risks

Syntax

stcompadjvar[=#var ...] [if] [in],compet(#[...])[maineffect(varlist)competeffect(varlist)flexibledf(#)generate(newvar newvar)savexpanded(filename [,replace])bootcireps(#)cishowmodlevel(#)]

optionsDescription ------------------------------------------------------------------------- Optionscompet(#[#])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.flexiblecause 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 eventsavexpanded(filename)save the data file in the expanded format suitable for further analysis.bootcicompute bootstrap confidence intervals of the cumulative incidence functions.reps(#)specify#bootstrap replications; default isreps(1000).cicompute confidence intervals of the cumulative incidence functions after a flexible parametric model.showmodshows the fitted model (Cox or flexible parametric)levelset confidence level. Default is 95

You must

stsetyour data before usingstcompadj. In previous stset you must specify failure(varname==numlist) where numlist refers to the event of interest; seestset

The

morematauser 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 wheneverfailvarspecified in the previousstsettakes on any of the values of thisnumlist.

maineffect(varlist)varlistis the list of the variables acting only on the main event.

competeffect(varlist)varlistis the list of the variables acting only on the competing event. Note that the same variable can be specified both inmaineffect(varlist)andcompeteffect(varlist). Then, this variable is assumed to have different effects on the main and competing event. Variables not specified either inmaineffect(varlist)or incompeteffect(varlist)are assumed to have the same effect on the main and the competing event.

flexibleswitchesstcompadjto 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 whenflexibleis 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.

bootcicomputes 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.

ciestimates 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.

showmodshows 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

stcompadjestimates 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

nrecords, 2 for the followingnrecords 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 presentstcompadjhandles the presence of one event competing with the main. For more details see reference.After adapting the data set

stcompadjfits a Cox model whose covariates are the variables specified invar[[=#]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. Thestpm2(Lambert 2009) andrcsgen(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)andcompeteffect(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 inmaineffect(varlist)andcompeteffect(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). Ifbootciorciis 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).

ExamplesThe 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", clearstset time,failure(cause==1)

stcompadj sex=1 thick=2, compet(2) maineffect(thick) showmod nolog nohrsort _tl _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,clearstset time, f(status==1)

stcompadj ccr=0 , compet(2) maineffect(ccr) competeffect(ccr) gen(Main0Compet0)stcompadj ccr=1 , compet(2) maineffect(ccr) competeffect(ccr) gen(Main1Compet1)twoway line Main0 Main1 _t, sort c(J J) scheme(lean2) xti("Years from HIVInfection") 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(Main0Compet0) bootcistcompadj ccr=1 , compet(2) maineffect(ccr) competeffect(ccr) gen(Main1Compet1) bootci

twoway line Main1 Hi_Main1 Lo_Main1 Main0 Hi_Main0 Lo_Main0 _t , sort c(JJ J J J J) lp(l - - l - -)"scheme(lean2) xti("Years from HIVInfection") 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 cistcompadj 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_Main0Lo_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

ccrhas 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,clearxi: stcox i.ccr*i.stratum, strata(stratum) nohr nologThe coefficient for the interaction term represents the difference in the

ccreffect on the main and competing event. The correspondingzandpvalue 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

ccrhas different effects on the main and competing eventstcompadj ccr=1 , compet(2) maineffect(ccr) competeffect(ccr)savexp(silong,replace)- Fit a Cox model whose covariates are the two

ccreffects and the stratum indicator variable.use silong,clearxi: stcox Main_ccr Compet_ccr stratum, nohr nologThe 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 seeOn-line: help for stcompet, stpepemori (if installed).

ReferencesRosthoj 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.

AknowledgmentsThanks to Kerry Kammire of the tech-support for his suggestion in writing the Mata code.

Enzo Coviello (enzo.coviello@alice.it)Author