Using the same example,
sysuse citytemp, clear
distplot tempjan tempjuly, lc(blue navy)
gets you there pretty directly. There is no need to restructure the data
or to figure out the basic graphics.
You do need to install -distplot-, which is user-written:
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
There are broader discussions, all freely accessible, at
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
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
Starting from Jeetendra's starting point, something like
distplot yield, over(caste)
seems indicated.
Nick
[email protected]
Martin Weiss
sysuse citytemp, clear
cumul tempjan, gen(cjan)
cumul tempjuly, gen(cjuly)
stack cjan tempjan cjuly tempjuly, ///
into(c temp) wide clear
//first in blue, second in navy
twoway (line cjan temp, sort lcolor(blue)) ///
(line cjuly temp, sort lcolor(navy))
Jeetendra Aryal
>
> In order to compare if the cummulative distribution function of yield
are
> different between two caste groups, I used the follwing command:
> -----------------------------
> cumul yield if caste==0, gen(highcaste)
> cumul yield if caste==1, gen(lowcaste)
> stack highcast yield lowcast yield, into(c productivity) wide clear
> line highcast lowcast productivity, sort ytitle("CDF")
> ---------------------------
>
> The command produced the desired result. BUT, I like to know if there
is
> any way to change the color of the graph (or mark symbol) it produces
> because there are two CDFs. I tried to use option (mcolor), but it
says
> that option is not allowed.
*
* 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/