Richard Goldstein <[email protected]>:
I would not use twoway__kdensity_gen which is for histogram bins.
Instead use the at() and gen() options on kdensity like so:
sysuse auto, clear
su mpg, meanonly
g x=r(min)+(_n-1)*(r(max)-r(min))/50 in 1/51
kdensity mpg if for==0, at(x) g(d) nogr
kdensity mpg if for==1, at(x) g(f) nogr
g diff=f-d
line d f x, name(compare)
line diff x, name(diff)
On Jan 29, 2008 4:43 PM, Richard Goldstein <[email protected]> wrote:
> I have produced a graph with two kdensity plots on it (one for the age
> of each of two groups of people) -- I am now interested in producing
> some statistics about the difference(s) between these plots; I have
> never thought about this issue before and wonder if there are any
> "standard" or common differences that are used to describe (or even to
> test) the differences between the two plots.
>
> Note that I assume I can use the undocumented twoway__kdensity_gen
> command to obtain the data underlying each plot. If anyone has used this
> and thinks I am wrong in my reading of the help file, please tell me.
>
> Note also that there may well be numerous kinds of differences and I
> don't wish to eliminate any possibilities at this time.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/