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 at the end of May, and its replacement, statalist.org is already up and running.


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

RE: st: Stacked histogram - empty bins


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Stacked histogram - empty bins
Date   Fri, 29 Jul 2011 17:26:15 +0100

Downtown or Manhattan skyline plots are a few lines to get going:

. twoway__histogram_gen mpg if foreign, gen(f_foreign f_mpg) start(10) width(2)

. twoway__histogram_gen mpg if !foreign, gen(f_domestic g_mpg) start(10) width(2)

. line f_foreign f_mpg, c(J) || line f_domestic g_mpg, c(J)

-- but the result needs more work to be made presentable and I dislike them with a passion, so sorry, no .ado from me. 

Nick 
n.j.cox@durham.ac.uk 

David Radwin

This topic of comparing distributions using multiple histograms has
appeared before, usually in the form of showing overlapping histograms.
See, e.g., http://www.stata.com/statalist/archive/2008-09/msg01336.html ,
http://www.stata.com/statalist/archive/2003-05/msg00653.html, or a couple
of examples on http://www.survey-design.com.au/Stata%20Graphs.html . There
are also numerous cautions against using histograms at all and ideas (like
Nick Cox's earlier suggestions) for alternative graph types.

I have occasionally wished for a "line histogram" that would just show a
line for the top and sides of each histogram without the other lines
defining each bar, similar in appearance to Stata's -kdensity- but with
right angles only (approximately like -kdensity- with the option
-kernel(rectangular)-). If I were a better programmer, I would write such
a program myself.

In the meantime, one more suggestion (but not quite what you want) is
Austin Nichols's -bihist- or -byhist-, both available from SSC.


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