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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

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

Date |
Wed, 7 Oct 2009 15:53:01 +0100 |

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 n.j.cox@durham.ac.uk sjsamuels@gmail.com 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/

**Follow-Ups**:**Re: st: RE: AW: customising ranges of the axis in Kaplan Meier plot***From:*sjsamuels@gmail.com

**References**:**st: customising ranges of the axis in Kaplan Meier plot***From:*"Isabelle Deltour" <deltour@cancer.dk>

**st: RE: AW: customising ranges of the axis in Kaplan Meier plot***From:*"Isabelle Deltour" <deltour@cancer.dk>

**Re: st: RE: AW: customising ranges of the axis in Kaplan Meier plot***From:*sjsamuels@gmail.com

- Prev by Date:
**AW: st: Stata Inbuilt commands** - Next by Date:
**RE: st: difference between "Spearman" and "pwcorr / correlate"** - Previous by thread:
**Re: st: RE: AW: customising ranges of the axis in Kaplan Meier plot** - Next by thread:
**Re: st: RE: AW: customising ranges of the axis in Kaplan Meier plot** - Index(es):

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