Statalist


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

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


From   Jacob Wegelin <[email protected]>
To   [email protected]
Subject   st: zoom in on a Kaplan-Meier plot (display only a subset of the timeaxis)
Date   Wed, 1 Oct 2008 16:50:41 -0400 (EDT)

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:

clear
set seed 5
set obs 30
gen ID=_n
gen x=invnormal(uniform())
gen y= -2 * x + invnormal(uniform())
twoway (scatter y x , aspectratio(1))
twoway (scatter y x if x<1/2 & x>0, aspectratio(1))

/*
The second plot "zooms in" on the first.

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


Thanks for any ideas

Jacob A. Wegelin
[email protected] Assistant Professor
Department of Biostatistics
Virginia Commonwealth University
730 East Broad Street Room 3006
P. O. Box 980032
Richmond VA 23298-0032
U.S.A. http://www.people.vcu.edu/~jwegelin


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