Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: kdensity

Subject   Re: st: kdensity
Date   Fri, 22 Apr 2005 16:39:48 -0400

I used to:
kdensity X, gen(aa bb) nogr
cumul bb, g(cum_bb)
ksm cum_bb bb
If you want the density at each point
you could :
qui cou
local n = r(N)
kdensity X, gen(aa bb) nogr n(`n')

Amadou DIALLO.

                      "Branko Milanovic"                                                                                                       
                      <bmilanovic@carnegieendow        To:       <>                                              
            >                        cc:                                                                                     
                      Sent by:                         Subject:  st: kdensity                                                                  
                      04/22/2005 01:40 PM                                                                                                      
                      Please respond to                                                                                                        

When you do kdensity X, STATA charts a kernel density fct of X's. Now,
is there a command that would allow me to take the density function thus
generated and chart a cumulative density (or distribution) function?
Ideally, I would like to do that for both densities, that is to go from
a overlay graph

twoway (kdensity X) (kdensity Y)

To a similar overlay graph of two cumulative density functions.

Or is the only way to use:

kdensity X, gen(aa bb)

And then generate a cumulative function of aa? By the way, I tried that
but the graph did not turn out well.


Branko Milanovic


You can start using my new (old) Email address:

Carnegie Endowment for International Peace
1779 Massachusetts Avenue NW
Washington DC 20036
Email: or
tel: 202-473-6968 (leave a message)

*   For searches and help try:

*   For searches and help try:

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