Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: Multiple density plots, rotated and distributed on x-axis


From   Venable <venablito@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Multiple density plots, rotated and distributed on x-axis
Date   Mon, 1 Aug 2011 14:26:48 -0400

Dear Statalist,

I would like to create a graph that contains several kernel density
plots, but with the plot rotated 90% right from the usual orientation,
and with each plot aligned to a point on the x axis.

To be more concrete (borrowing an example from Angrist and Pischke,
Mostly Harmless Econometrics, Figure 3.1.1), suppose I wanted to show
the distribution of incomes in the US at different levels of eduction,
e.g. 8 years, 12 years, 14, 16, etc. The x-axis of the graph would be
years of education and the y axis the level of income.  Above each
year, there would be a kernel density plot of incomes for that year,
with each rotated to the right, so that the "height" (density) is
horizontal distance.

An additional bonus would be to be able to mark a few quantiles on
each density and connect these between years. For example, mark the
25th, median and 75th percentile for each year and have these points
connected.

Is this possible in Stata?

I fear I may not be explaining this well in words, in spite of the
fact that it is very easy to show as a picture. Unfortunately Figure
3.1.1 is not available in the Google Preview version of Mostly
Harmless Econometrics, so I have posted a simple hand-drawn version
here:

http://dl.dropbox.com/u/2937392/density-plot-sketch.pdf

Many thanks.

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


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