Statalist


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

Re: st: RE: Decrease range of y axis


From   sjsamuels@gmail.com
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Decrease range of y axis
Date   Mon, 31 Aug 2009 11:51:23 -0500

Thanks, Nick.  I was completely unaware of -separate-.
Correction: in my code, the phrase "if cdf<=0.5" should be "if cdf<=50"


On Mon, Aug 31, 2009 at 11:42 AM, Nick Cox<n.j.cox@durham.ac.uk> wrote:
> Note that
>
> levelsof factor, local(fac_lev)
> foreach i of local fac_lev {
> gen ydf`i' = cdf if factor==`i'
> }
>
> is pretty much equivalent to
>
> separate cdf, by(factor) gen(ydf)
>
> Nick
> n.j.cox@durham.ac.uk
>
> sjsamuels@gmail.com
>
> To plot multiple KM curves on the same graph by levels of some factor,
> create a separate variable for each with something like:
> *******************************************
> 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 , // Add remaining options below
>
> On Mon, Aug 31, 2009 at 11:27 AM, <sjsamuels@gmail.com> wrote:
>> --
>> The only solution that I've found to this problem is to generate the
>> the failure curve (1 - the survival curve), using -sts gen- and then
>> to use -twoway- with an -if- clause  to limit the range and  a
>> "connect" option to connect the points.
>> -Steve
>>
>> On Mon, Aug 31, 2009 at 7:37 AM, Philip Ryan<philip.ryan@adelaide.edu.au> wrote:
>>> sts graph...., .... ylabel(0(.1).5, ang(hor) nogrid).....
>>>
>>> Phil
>>>
>>> -----Original Message-----
>>> From: owner-statalist@hsphsun2.harvard.edu
>>> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Fiona Bruinsma
>>> Sent: Monday, 31 August 2009 10:00 PM
>>> To: statalist@hsphsun2.harvard.edu
>>> Subject: st: Decrease range of y axis
>>>
>>> Hi,
>>>
>>> I am creating a graph of a kaplan-meier curve.  The y axis (cumulative
>>> probability) ranges from 0.0 to 1.0 however all my values are less than 0.5
>>> making the data difficult to see.  I would like to decrease the range of the
>>> y axis from 0.0-1.0 to 0.0-0.50.  I have tried yscale but notice in the
>>> manual that this can only be used to increase the scale.  I have not been
>>> able to find any reference to decreasing the range.
>>>
>>> The syntax I have been using is as follows:
>>>  sts graph, by(tx_cen) failure noorigin ytitle("Cumulative probability of
>>> delivery") /*
>>>  */ xtitle("Gestation (weeks)") ylabel(,angle(horizontal) nogrid) /*
>>>  */ title(" ") /*
>>>  */ legend(position(3) ring(0)) legend(col(1)) clpattern("l" "_")
>>> legend(region(""))/*
>>>  */legend(region(lstyle(none))) graphregion(fcolor(white))
>>>
>
> *
> *   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
sjsamuels@gmail.com
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index