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

RE: st: kdensity


From   [email protected]
To   [email protected]
Subject   RE: st: kdensity
Date   Mon, 25 Apr 2005 10:23:51 -0400

Thanks a lot, Nick. It works very nicely.

branko


Email: [email protected] or [email protected]
tel: 202-473-6968
Address:
World Bank, Room MC 3-581
1818 H Street NW
Washington D.C. 20433

Publications and income inequality data:
www.worldbank.org/research/inequality

For papers see:
http://econpapers.hhs.se/
http://papers.ssrn.com/sol3/cf_dev/AbsByAuth.cfm?per_id=149002


                                                                                                               
                      "Nick Cox"                                                                               
                      <[email protected]>           To:       <[email protected]>              
                      Sent by:                         cc:                                                     
                      owner-statalist@hsphsun2.        Subject:  RE: st: kdensity                              
                      harvard.edu                                                                              
                                                                                                               
                                                                                                               
                      04/25/2005 05:58 AM                                                                      
                      Please respond to                                                                        
                      statalist                                                                                
                                                                                                               
                                                                                                               
                                                                                                               
                                                                                                               




If you want a plot of a (?smoothed) distribution function,
this is at best a rather indirect route.

Note first that -distplot- is a program dedicated
to plotting distribution functions. -search distplot-
points to locations. It is smart enough that you can
go directly to something like

. distplot line Y X

without doing overlays.

If the results are not smooth enough, an alternative is
to base a plot on estimated rather than observed quantiles.

One command for quantile estimation is -hdquantile-
from SSC.

Nick
[email protected]

Amadou Diallo

> 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')
> etc...

Branko Milanovic

> 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.

*
*   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/



*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index