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   Thu, 8 Oct 2009 09:05:31 -0400

You are quite right Nick.  -levelsof- and -separate- give identical
results. The difference I saw arose because y I named the augmented
(0,0) points incorrectly when I tested -separate-.

-Steve


On Wed, Oct 7, 2009 at 10:53 AM, Nick Cox <[email protected]> wrote:
> I don't see any reason why using -separate- as compared with generating
> separate variables yourself should mean anything different in ensuing
> graphs. The result is the same, a bunch of disjoint variables.
>
> Nick
> [email protected]
>
> [email protected]
>
> 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....)
>
> **************************************************
>
>
> *
> *   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