Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: RE: Graphing multiple cdf's in the same graph (using either -distplot- or -cdfplot-) |
Date | Tue, 5 Mar 2013 10:43:34 +0000 |
Thanks to David for the explanation. However, although -distplot- is available from SSC, it was first published in the STB and subsequent updates have continued in the Stata Journal. -findit distplot- yields the sequence SJ-10-1 gr41_4 . . . . . . . . . . . . . . . . . Software update for distplot (help distplot if installed) . . . . . . . . . . . . . . . N. J. Cox Q1/10 SJ 10(1):164 new reverse(ge) option specifies plotting probabilities or frequencies greater than or equal to any data value SJ-5-3 gr0018 . . . . . . . . . . Speaking Stata: The protean quantile plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox Q3/05 SJ 5(3):442--460 (see gr41_3 and gr42_3 for commands) discusses quantile and distribution plots as used in the analysis of species abundance data in ecology SJ-5-3 gr41_3 . . . . . . . . . . . . . . . . . Software update for distplot (help distplot if installed) . . . . . . . . . . . . . . . N. J. Cox Q3/05 SJ 5(3):471 simplified syntax; both by() and over() are now allowed SJ-4-2 gr0004 . Speaking Stata: Graphing categorical and compositional data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox Q2/04 SJ 4(2):190--215 (no commands) discusses graphical possibilities for categorical and compositional data SJ-4-1 gr0003 . . . . . . . . . . . . Speaking Stata: Graphing distributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox Q1/04 SJ 4(1):66--88 (no commands) a review of official and user-written commands for graphing univariate distributions; includes tricks beyond what is obviously and readily available SJ-3-4 gr41_2 . . . . . . . . . . . . . . . . . Software update for distplot (help distplot if installed) . . . . . . . . . . . . . . . N. J. Cox Q4/03 SJ 3(4):449 option tscale() renamed as trscale() SJ-3-2 gr41_1 . . . . . . . . . . . . . . . . . Software update for distplot (help distplot if installed) . . . . . . . . . . . . . . . N. J. Cox Q2/03 SJ 3(2):211 enhanced to use Stata 8 graphics and provides new options STB-51 gr41 . . . . . . . . . . . . . . . . . . Distribution function plots (help distplot if installed) . . . . . . . . . . . . . . . N. J. Cox 9/99 pp.12--16; STB Reprints Vol 9, pp.108--112 plots the cumulative distribution function or survival function and allows multiple variables Hence the software should be downloaded from SJ 10-1. The syntax has changed since the version used by Max. My longer articles (in STB-51; SJ 4-1, 4-2, 5-3) retain whatever use or interest they had as discussions of method. All that said, no version of -distplot- supports what Max wants, given its treatment of missing values and as David and Maarten have explained you need to do that otherwise. Nick On Mon, Mar 4, 2013 at 10:26 PM, David Radwin <dradwin@mprinc.com> wrote: > Please remember to cite sources for user-written programs. -distplot- is > by Nick Cox and -cdfplot- is by Adrian Mander. Both are available from > SSC. > > You can create your own CDFs using -cumul- and then plot them using > -twoway line-. The following example is based on this message by Nick Cox: > http://www.stata.com/statalist/archive/2005-04/msg00800.html > > sysuse nlsw88, clear > gen wageodd=wage if mod(_n,2)==1 // odd-numbered observations > gen wageeven=wage if mod(_n,2)==0 // even-numbered observations > > kdensity wageodd, gen(a b) > cumul b, gen(cb) > > kdensity wageeven, g(c d) > cumul d, gen(cd) > > twoway (line cb b, sort ) (line cd d, sort lpattern(dash)) Max.Livingston >> I'm trying to plot two cdf's on the same axis. -distplot- allows me to > do >> this (simple example: distplot line var1 var2, lc(red blue) ) , but >> there's a wrinkle in my data that makes this more complicated. The data > is >> arranged such that var1 and var2 are never both non-missing. That is, > for >> every observation where var1 exists, var2 is missing, and vice versa. I > am >> able to graph this using kernel density: >> twoway (kdensity var1, lp(solid) lc(blue)) >> || (kdensity var2, lp(solid) lc(red)) >> >> But I can't seem to find a similar implementation for -distplot- (or >> -cdfplot- for that matter). If anyone has any ideas, I would greatly >> appreciate it. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/