Statalist


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

Re: st: RE: AW: customising ranges of the axis in Kaplan Meier plot


From   [email protected]
To   [email protected]
Subject   Re: st: RE: AW: customising ranges of the axis in Kaplan Meier plot
Date   Tue, 6 Oct 2009 14:40:56 -0400

This question has been before on statalist, and a google search
(statalist restrict range kaplan-meier) would have found an answer
(e.g. http://www.stata.com/statalist/archive/2005-03/msg00229.html)

The ordinary graph axis commands don't work with -sts graph-. The only
way  to restrict the axes is to  generate the points for the CDF with
-sts- gen (see below) and plot them with -twoway-.   I use -levelsof-
below.  Nick Cox pointed out that -separate-  should do essentially
the same thing, but I've observed that the plot connections look
different.  To make the graph look nice you might have to augment the
data for each group with a fake point at (0,0), since zero times are
not  allowed in -sts- .

-Steve


*******************************************
sts gen surv = s, by(factor)
gen cdf =100*(1-surv)

****************************************************
* Create a separate CDF for each factor level
****************************************************
sort factor outcome
levelsof factor, local(fac_lev)
foreach i of local fac_lev {
gen ydf`i' = cdf if factor==`i'
}

twoway scatter ydf* outcome  if  cdf<= 0.5,
connect(J J....)

**************************************************

On Tue, Oct 6, 2009 at 9:57 AM, Isabelle Deltour <[email protected]> wrote:
> Thank you, Martin, for pointing out this article.
> Isabelle
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Martin Weiss
> Sent: Tuesday, October 06, 2009 3:26 PM
> To: [email protected]
> Subject: st: AW: customising ranges of the axis in Kaplan Meier plot
>
>
> <>
>
>
> http://www.stata-journal.com/sjpdf.html?articlenum=gr0019
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: [email protected]
> [mailto:[email protected]] Im Auftrag von Isabelle
> Deltour
> Gesendet: Dienstag, 6. Oktober 2009 15:25
> An: [email protected]
> Betreff: st: customising ranges of the axis in Kaplan Meier plot
>
> Hi listers,
>
> My dataset contains  cancer occurrence in children, which is a rare
> event.
> I have produced Kaplan-Meier survival graphs.
>
> . sts graph, by(var1)
>
> The 2 lines corresponding to the groups of var1  are superimposed. (and
> the overwhelming
> majority of subjects have not experienced the event by the end of the
> follow up).
> I wanted to enlarge the y axis and focus the graph on the area of the y
> values between 0.9 till 1,
> where the survival curve is placed.
> However, I have not succeeded to modify the scale using the ylabel
> option.
>
> . sts graph , by(var1)  ylabel(.9 (.05) 1)
>
> I would appreciate any suggestions.
> Isabelle
>
> *
> *   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/
>
> *
> *   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/
>



-- 
Steven Samuels
[email protected]
18 Cantine's Island
Saugerties NY 12477
USA
845-246-0774

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