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]

Re: st: Combining histograms


From   Ronan Conroy <rconroy@rcsi.ie>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Combining histograms
Date   Mon, 23 May 2011 10:07:44 +0100

On 2011 Beal 20, at 19:35, Michael Hecker wrote:

> Dear list,
> I create two histograms using:
> 
> hist X, saving(normal, replace)
> hist Y, saving(changed, replace)
> 
> Is it possible two merge both gph-files into a single graph?
> I didn't manage to get the result with "graph combine".
> I want to have both histograms in a single chart to compare the 
> distributions.

Histograms are not a great way of comparing distributions. 

sysuse auto
histogram mpg, bin(10) frequency
histogram mpg, bin(10) start (10) frequency
histogram mpg, bin(10) frequency
histogram mpg, bin(12) start (10) frequency
histogram mpg, width(2.5) frequency

Have a look at the resulting histograms, or use -combine- to pop them into a single chart. You will see that it is possible to change the appearance of a histogram very significantly by arbitrary choices of bin, start and width arguments, of which there are limitless combinations. Note, in particular, the last one, which uses bins of 2.5, thus creating a saw-toothed effect. 

If you can draw a large number of different histograms from the same data, how can you tell which differences between two histograms are due to data differences and which are due to differences in the underlying distribution?




Ronán Conroy
rconroy@rcsi.ie
Associate Professor
Division of Population Health Sciences
Royal College of Surgeons in Ireland
Beaux Lane House
Dublin 2


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