Bookmark and Share

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Multiple graph with stcompet

From   Nick Cox <>
To   "''" <>
Subject   RE: st: Multiple graph with stcompet
Date   Fri, 21 Jan 2011 17:47:49 +0000

You can get the separate responses by 

separate CumInc, by(even) veryshortlabel

You can also call -line- with several y variables, e.g. 

line CumInc? _t


Phil Clayton

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.

On 21/01/2011, at 11:47 PM, gambaaz garnaal wrote:
> 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.

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index