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

# Re: st: Multiple graph with stcompet

 From Phil Clayton To statalist@hsphsun2.harvard.edu Subject Re: st: Multiple graph with stcompet Date Sat, 22 Jan 2011 01:37:01 +1100

```You may also want a curve for event==0:
gen CumIn0=CumInc if event==0

You can easily plot the different cumulative incidence curves like this:
twoway (line CumIn0 _t, sort c(J)) (line CumIn1 _t, sort c(J)) ...

Alternatively you could -sort _t- first and then leave out the sort command from each graph. The c(J) option gives you stairstep connectors which are recommended for cumulative incidence curves.

Phil

On 21/01/2011, at 11:47 PM, gambaaz garnaal wrote:

> Dear Statalister,
>
> I'm trying to use Stcompet with multiple events (0, 1, 2, 3). Now I want graph functions for each event.
>
> I used the following code, following 'help stcompet':
>
> .stset time, f(event==0)
> .stcompet CumInc = ci, compet1(1) compet2(2) compet3(3)
> .gen CumIn1 = CumInc if even ==1
> .gen CumIn2 = CumInc if even ==2
> .gen CumIn3 = CumInc if even ==3
>
> Now the next step... how can I graph functions (cumulative incidence) relating to each event in just one plot. Hope someone can help me with the script.
>
>
> Olivier
>
>
>
> *
> *   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/

*
*   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/
```