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   "Friedrich Huebler" <fhuebler@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: Kaplan Meier plot: adding vertical line at median survival
Date   Sun, 2 Nov 2008 21:12:23 -0500

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 <mm@pinest.org> 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" <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
*
*   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