Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: differences between kdensity plots


From   "Austin Nichols" <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: differences between kdensity plots
Date   Tue, 29 Jan 2008 16:59:00 -0500

Richard Goldstein <richgold@ix.netcom.com>:

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 <richgold@ix.netcom.com> 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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index