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: Plotting normal distributions


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Plotting normal distributions
Date   Thu, 7 Jun 2012 16:04:15 +0100

-qplot- (SJ) offers another way to look at distributions. In this case I would worry about granularity (arbitrary rounding) of birth weights and would think about smoothing the quantiles first using -hdquantile- (SSC). Either way Amal's idea of looking at distributions in groups of 4 or 5 would probably be very sensible. 

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

Svend Juul

Amal wrote:

I would like to plot normal distributions of birth weight by
nationality in the same graph for comparison, using different colours.
I wasn't able to figure out how to do this. What I've managed so far
is to plot each birth weight distribution separately in small graphs
and get it together as one image using the basic histogram command:
hist BW, by (motherland)

I have 19 nationalities. Not sure how many different colours Stata
permits  - but maybe a combination of colours and schemes (liked
dashed lines) is needed?

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

Nick gave, as usual, sensible advice and warnings. But anyway, I want
to point to -kdensity-. Try this:

--------------------------------------------------------
webuse lbw.dta, clear
kdensity bwt if race==1 , generate(x_white y_white)
kdensity bwt if race==2 , generate(x_black y_black)
kdensity bwt if race==3 , generate(x_other y_other)

twoway (line y_white x_white, sort) ///
       (line y_black x_black, sort) ///
       (line y_other x_other, sort) ///
   ,   legend(order(1 "White" 2 "Black" 3 "Other"))
--------------------------------------------------------

Think of -kdensity- curves as smoothed histograms. They may
be what you want.


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