Statalist


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

st: Labelling survival curves in Stata (sts point-labelling / multiple lines / coincident lines)


From   "Allan Reese (Cefas)" <allan.reese@cefas.co.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Labelling survival curves in Stata (sts point-labelling / multiple lines / coincident lines)
Date   Mon, 17 Nov 2008 17:10:19 -0000

The Stata "Survival Analysis" manual (v9 - I must update!) states "sts
generate is a rarely used command" and "sts generate is provided in case
you want to make a calculation, listing, or graph that sts cannot
already do for you."

I've just been plotting survival curves for a large number of groups.
The sts features to identify curves by colour were not particularly
useful.  The manual didn't provide an alternative to the legend, but the
following worked as a quick and dirty solution:

sts generate mys= s , by(family)
gen mpos=mod(family,13)
sts graph if family<20, by(fam) addplot( scatter mys _t /*
  */ if fam<20, ms(i) mlab(fam) mlabvpos(mpos) mlabsize(vsmall))
legend(off)

The mlabvpos helps to locate the curve intended by each value (by giving
a bearing) as well as reducing overlap when lines coincide.

I also found a work-round for plotting more than 20 groups on one graph.
Now balks at about 70 levels:

sts graph , by(fam) pstyle(p1 .. ) scheme(s1mono) legend(off) ti(K-M)

Allan


***********************************************************************************
This email and any attachments are intended for the named recipient only.  Its unauthorised use, distribution, disclosure, storage or copying is not permitted.  If you have received it in error, please destroy all copies and notify the sender.  In messages of a non-business nature, the views and opinions expressed are the author's own and do not necessarily reflect those of the organisation from which it is sent.  All emails may be subject to monitoring.
***********************************************************************************


*
*   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