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 <[email protected]>
To   [email protected]
Subject   Re: st: Re: Kaplan Meier plot: adding vertical line at median survival
Date   Sun, 2 Nov 2008 18:19:00 -0800

Thanks Friedrich, the -legend(order(1 2 3))- really does the trick!
Michael


Michael,

See -help legend order-. You can suppress legend entries by omitting
them from the list.

. 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) legend(order(1 2 3))))
yline(0.5, lpattern(dash))

Friedrich

On Sun, Nov 2, 2008 at 6:14 PM, Michael McCulloch <[email protected]> wrote:
 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" <[email protected]>
 To: "Statalist" <[email protected]>
 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
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index