Statalist


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

Re: st: Re: Kaplan Meier plot: adding vertical line at median survival


From   Michael McCulloch <mm@pinest.org>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: Kaplan Meier plot: adding vertical line at median survival
Date   Sun, 2 Nov 2008 15:14:20 -0800

Thanks Martin! This works splendidly. May I ask: the legend adds another group entitled "y/yb", which seems to refer to the vertical lines created. Is there a way to suppress this?
Michael

You could also automate some of your calculations:

**********
sysuse cancer.dta, clear
stset studytime
levelsof(drug), loc(levdrug)
foreach lev of loc levdrug{
_pctile studytime if drug==`lev'
loc a`lev'=r(r1)
}
sts graph, by(drug) addplot((pci -0.035 `a1' 0.5 `a1' -0.035 `a2' 0.5 `a2' -0.035 `a3' 0.5 `a3', lcolor(black))) yline(0.5, lpattern(dash))
**********

HTH
Martin
_______________________
----- Original Message ----- From: "Michael McCulloch" <mm@pinest.org>
To: "Statalist" <statalist@hsphsun2.harvard.edu>
Sent: Sunday, November 02, 2008 4:04 AM
Subject: st: Kaplan Meier plot: adding vertical line at median survival

Greetings,
I'd like to plot a Kaplan Meier graph with a vertical line at the point of median survival, where the line begins at the x-axis and ends at the point where that vertical line intersects the survival curve.

For example:
sysuse cancer.dta
stset studytime
sts graph, by(drug)

In this example, for drug2 median survival is at 13 months, and for drug3, at 25 months, so I'd . Is this possible within the -sts graph- command? I'm using v9.2 and so don't have the manual graphical editing features of v10.

Thank you.

--

Best wishes,
Michael McCulloch



Pine Street Foundation
124 Pine St., San Anselmo, CA 94960-2674
Tel: (415) 407-1357
Fax: (415) 485-1065
mcculloch@pinestreetfoundation.org
www.pinestreetfoundation.org
*
*   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/



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