Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: sts graph by option and totals


From   "Maarten Buis" <M.Buis@fsw.vu.nl>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: sts graph by option and totals
Date   Thu, 11 Jan 2007 15:16:49 +0100

--- Patrick Woodburn asked: 
> Is there any way to plot a survival plot across a total dataset on the
> same graph as survival time plots divided across the values of a
> particular variable?  

You can use -sts gen- to create variables
containing the values of the survival 
functions, and then graph those, like in
the example below:

Hope this helps,
Maarten

*----------- begin example ----------
sysuse cancer, clear
stset studytime, failure(died)
sts gen tsurv = s
sts gen bsurv = s, by(drug)
twoway line bsurv _t if drug==1, sort ||        /*
    */ line bsurv _t if drug==2, sort ||        /*
    */ line bsurv _t if drug==3, sort ||        /*
    */ line tsurv _t, sort                      /*
    */ xtitle("analysis time")                  /*
    */ ytitle("")                               /*
    */ title("Kaplan-Meier survival estimates") /*
    */ legend(label(1 "placebo")                /*
    */        label(2 "drug 2" )                /*
    */        label(3 "drug 3" )                /*
    */        label(4 "total"  ) )
*------------- end example ----------


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index