Statalist


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

Re: st: zoom in on a Kaplan-Meier plot (display only a subset of the timeaxis)


From   Svend Juul <[email protected]>
To   <[email protected]>
Subject   Re: st: zoom in on a Kaplan-Meier plot (display only a subset of the timeaxis)
Date   Thu, 2 Oct 2008 13:36:08 +0200

Jacob Wegelin wrote:

Is there a way to create a Kaplan-Meier plot that is "zoomed in" on a
subset of the time axis? To make this concrete: It is easy to create a
twoway plot that is "zoomed in" on a portion of the axes, for instance:

...

But what if we have survival data? The second sts graph command below
does *not* do what I want; it creates a subset of the data and builds a
Kaplan-Meier plot afresh using that subset. Is there any straightforward
way to make a "zoomed-in" Kaplan-Meier plot? /*

clear
set seed 5
set obs 30
gen ID=_n
gen t=exp(uniform()) - 1
stset t
sts graph sts graph if t > 0.5 & t < 0.8

=====================================================================

The -tmin()- and -tmax()- options to -stset graph- do remove parts of
the curve, as I think Peter Lachenbruch suggested, but I did not succeed
in restricting the x-axis length. But using -sts generate- works:

   sts generate s=s
   sort t
   twoway scatter s t if t>0.5 & t<0.8 , msymbol(none) connect(J)

Hope this helps
Svend

__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone:  +45 8942 6090
Home:   +45 8693 7796
Email:  [email protected]
__________________________________________ 

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



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