# [R] Competing Risks Analysis

Kevin E. Thorpe kevin.thorpe at utoronto.ca
Fri May 25 15:04:38 CEST 2007

```I am working on a competing risks problem, specifically an analysis of
cause-specific mortality.  I am familiar with the cmprsk package and
have used it before to create cumulative incidence plots.  I also came
across an old (1998) s-news post from Dr. Terry Therneau describing
a way to use coxph to model competing risks.  I am re-producing the
post at the bottom of this message.

I would like to know if this approach is still reasonable or are there
other ways to go now.  I did an RSiteSearch with the term
"competing risks" and found some interesting articles but nothing as
specific as the post below.

----- S-news Article Begins -----
Competing risks

It's actually quite easy.

Assume a data set with n subjects and 4 types of competing events. Then
create a data set with 4n observations
First n obs: the data set you would create for an analysis of
"time to event type 1", where all other event types are censored. An
extra variable "etype" is =1.
Second n obs: the data set you would create for "time to event type 2",
with etype=2
.
.
.

Then
fit <- coxph(Surv(time,status) ~ .... + strata(etype), ....

1. Wei, Lin, and Weissfeld apply this to data sets where the competing
risks are not necessarily exclusive, i.e., time to progression and time
to death for cancer patients. JASA 1989, 1065-1073. If a given subject
can have more than one "event", then you need to use the sandwich estimate
of variance, obtained by adding ".. + cluster(id).." to the model
statement above, where "id" is variable unique to each subject.
(The method of fitting found in WLW, namely to do individual fits and
then glue the results together, is not necessary).

2. If a given subject can have at most one event, then it is not clear
that the sandwich estimate of variance is necessary. See Lunn and McNeil,
Biometrics (year?) for an example.

3. The covariates can be coded any way you like. WLW put in all of the
strata * covariate interactions for instance (the "x" coef is different for
each event type), but I never seem to have a big enough sample to justify
doing this. Lunn and McNeil use a certain coding of the treatment effect,
so that the betas are a contrast of interest to them; I've used similar
things
but never that particular one.

4. "etype" doesn't have to be 1,2,3,... of course; etype= 'paper',
'scissors', 'stone', 'pc' would work as well.

Terry M. Therneau, Ph.D.
----- S-news Article Ends -----

--
Kevin E. Thorpe
Biostatistician/Trialist, Knowledge Translation Program
Assistant Professor, Department of Public Health Sciences
Faculty of Medicine, University of Toronto
email: kevin.thorpe at utoronto.ca  Tel: 416.864.5776  Fax: 416.864.6057

```