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

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

 From Wies Kestens To "statalist@hsphsun2.harvard.edu" Subject st: RE : RE: merging two kernel density graphs into one Date Tue, 25 Oct 2011 09:49:32 +0000

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

________________________________________
De : owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] de la part de Nick Cox [n.j.cox@durham.ac.uk]
Date d'envoi : lundi 24 octobre 2011 14:14
À : 'statalist@hsphsun2.harvard.edu'
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
n.j.cox@durham.ac.uk

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:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```