Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: overlapping histograms


From   Nick Cox <n.j.cox@stata.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: overlapping histograms
Date   Tue, 30 Sep 2008 10:14:48 -0500

It is good to know that you can do this. My guess is that many users would like to see it written up somewhere.

However, these histograms tend to lead only to crude inferences. Users can't read off quantitative conclusions from the graph, just stuff like "The distributions are about the same", or "... very different", etc.

Compare the road that begins

. separate mpg, by(foreign) veryshortlabel

. qqplot mpg1 mpg0

. qqplot mpg1 mpg0, xsc(log) ysc(log)

That is the start of a story: the distributions differ multiplicatively,
etc. Numbers can be then worked out.

Nick

Svend Juul wrote:

Jeph wrote - in a comment to several suggestions:

More like this:

sysuse auto

twoway ///
(histogram mpg if foreign, bin(10) gap(5) fc(gray) lc(black)) ///
(histogram mpg if !foreign, bin(10) gap(15) fc(white) lc(black)) ///
   legend(off)

It works better when there are more bins, ie, more obs - I have 100k
obs so I have lots of thin bars. The effect is quite good, though
I dislike that, as here, one distribution has thinner bars than the
other.

================================================================

Fascinating game. How about this?

twoway ///
(histogram mpg if !foreign, start(10) width(2) fc(white) lc(black)) ///
(histogram mpg if foreign, gap(50) fc(gray) lc(black) start(10)
width(2)) ///
   , legend(off) plotregion(margin(b=0))

*
*   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   |   What's new   |   Site index