Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE : RE: merging two kernel density graphs into one

From   Nick Cox <>
Subject   Re: st: RE : RE: merging two kernel density graphs into one
Date   Tue, 25 Oct 2011 11:06:26 +0100

What you want is clearer, but I wouldn't approach it your way at all.
If you pool income data for all countries, presumably weighting by
population (which you don't mention, but the problem seems meaningless
otherwise), you can then smooth that once to get a single density
curve. Adding the densities of (again presumably hundreds of)
countries, even with weighting, seems unnecessarily complicated by

Your statement that -generate()- is limited to producing 10 data
points I think only makes sense in one context, in which that is the
default because you have just 10 data points. But if that is so, I
wouldn't apply density estimation at all. Also, if you are starting
with deciles alone you have already lost much of the detail and it is
optimistic to suppose that kernel density estimation can put it back.
However, as you hint the exercise could become an essay on limitations
of method.

There are people on this list who are top experts in income
distributions who may want to add to this (or subtract from it).


On Tue, Oct 25, 2011 at 10:49 AM, Wies Kestens
<> wrote:
> Using the -kdensity- command, I become individual countries' income densities.  I'm trying to estimate the world income density by adding up all these individual countries' income densities. It's important that I work with the estimated income densities and not just with the decile shares for each country because I want to compare the effect of different choices of bandwidth and such on the global income density.
> However, I can't figure out how to add op these different income densities.
> The -generate()-option is another approach to the problem. If I could extract 1000 or more points from the income density that would be the solution as that would be a fairly good approximation of the estimated income density. But the -generate()-option only extracts 10 points from each density and therefore doesn't help me.
> Thanks for your consideration
> ________________________________________
> De : [] de la part de Nick Cox []
> Date d'envoi : lundi 24 octobre 2011 14:14
> À : ''
> Objet : st: RE: merging two kernel density graphs into one
> -save graph- is not legal Stata syntax.
> I don't understand the request. Probability [not population] density curves for quite different data can be superimposed, but usually they can not be combined otherwise. Much depends on what is meant by "combine".
> In addition, you appear to be confusing density with cumulative probability.
> -kdensity- has -generate()- options which can be used to keep the results. Then you can superimpose the curves on one graph.
> Nick
> Wies Kestens
> My problem concerns the merge of different graphs in stata.
> Each graph is made using the -kdensity- command and then saved.
> For example:
> kdensity algeria
> save graph algeria
> kdensity albania
> save graph albania
> The y-axis of these graphs shows the population density and the x-axis shows the income.
> I would like to merge those two graphs into one graph which would then
> give the combined population density on the Y-axis and the income on the
>  x-axis.
> For example:
> when 50% of the people in Albania en 100% of the people in Algeria would
>  earn 100$, the combined graph would state that 75% of the people earn
> 100$, given they both have the same population.
> No command I know of/could find information about is able to do this it seems.
> Can someone point me in the right direction?

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index