Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

RE: st: Plotting normal distributions

From   Nick Cox <>
To   "''" <>
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. 


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:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index