Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: Stacked plots of cumulative incidence functions for multinominal covariates

 From Kenji Chihaya To statalist@hsphsun2.harvard.edu Subject st: Stacked plots of cumulative incidence functions for multinominal covariates Date Mon, 20 Feb 2012 05:39:36 +0900

```Dear statalist

I am trying to estimate a model of competing risks using stcrreg with
the following commands in stata 12. The problem is that I can't get
correct predictions for all the categories of my covariate for my
stacked cumulative incidence plots.

stset age_r, id(serial) failure(failure==1) origin(time 14)
stcrreg i.race, compete(failure= 2 3)

stset age_r, id(serial) failure(failure==2) origin(time 14)
stcrreg i.race, compete(failure= 1 3)

stset age_r, id(serial) failure(failure==3) origin(time 14)
stcrreg i.race, compete(failure= 1 2)

Then I want to make a stacked cumulative incidence plot as the one in
page 388 of the third edition of "An Introduction to Survival Analysis
Using Stata", but the example there uses a binomial variable "drug",
whilst my analysis has a variable "race" with three categories.

I succeed in using predict to calculate the base cumulative incidence
function using:

predict cif_1_race1, basecif

predict cif_2_race1, basecif

and

predict cif_3_race1, basecif

The problem is that I don't know how to calculate the cumulative
incidence functions for the other categories of race

I tried using

stset age_r, id(serial) failure(failure==1) origin(time 14)

stcrreg i.race, compete(failure= 2 3)

predict cif_1_race1, basecif,

generate cif_1_race2 = 1 - (1 - cif_1_race1)^exp(_b[2.race])

generate cif_1_race3 = 1 - (1 - cif_1_race1)^exp(_b[3.race])

stset age_r, id(serial) failure(failure==2) origin(time 14)
stcrreg i.race, compete(failure= 1 3)

predict cif_2_race1, basecif

generate cif_2_race2 = 1 - (1 - cif_1_race1)^exp(_b[2.race])

generate cif_2_race3 = 1 - (1 - cif_1_race1)^exp(_b[3.race])

stset age_r, id(serial) failure(failure==3) origin(time 14)
stcrreg i.race, compete(failure= 1 2)

predict cif_3_race1, basecif

generate cif_3_race2 = 1 - (1 - cif_1_race1)^exp(_b[2.race])

generate cif_3_race3 = 1 - (1 - cif_1_race1)^exp(_b[3.race])

However, when I make the variables for the stacked plot using:

gen sum_cif__race1 = cif_1_race1 + cif_2_race1 + cif_3_race1

gen sum_cif__race2 = cif_1_race2 + cif_2_race2 + cif_3_race2

gen sum_cif__race3 = cif_1_race3 + cif_2_race3 + cif_3_race3

I get plots with cumulative incidence functions that go well over 1.00

Am I doing using the wrong formula? Is it possible to do it at all?

Guilherme Kenji Chihaya
Tohoku University

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```