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

Re: st: three mean and sd plots on the same graph?

From   Maarten buis <>
Subject   Re: st: three mean and sd plots on the same graph?
Date   Wed, 7 Nov 2007 21:20:06 +0000 (GMT)

--- Joseph Wagner <> wrote:

> I created box plot graph with of 3 X variables over the same Y
> variable but was then asked to produce a similar graph this time
> mean (not  median) and +/- 95% CI.   I don't think Stata can do this
> but thanks to a post by Nick three years ago, I was able to (sort of)
> create these:
> egen mean = mean(cont), by(cat) 
> egen sd = sd(cont), by(cat) 
> gen upper = mean + sd
> gen lower = mean - sd 
> scatter mean cat || rcap upper lower cat 

Notice that this way you won't get a 95% confidence interval but a 68%
confidence interval (assuming you have many cases (say 100+))

> . . .  is the example Nick gave but how would (or could I?) do this
> for three different X variables (in Nick's example I suppose it would
> be 3 different 'cont' variables) on the same graph?  I can do 
> this for two but not 3 which brings me to my next problem: 
> The box plots I created earlier were each side by side for the same
> value of X (rather than on top of one another) but the two -rcap-
> graphs are on top of each other making it impossible to differentiate
> the two lines (three would be even worse).  Is there a way to
> separate these lines or do I need to graph these data in another way
> altogether?  

you can shift the axes around by adding and subtracting numbers

In addition to Nick's suggestion I reccomend
Newson R. Confidence intervals and p-values for delivery to the end
user. The Stata Journal 2003; 3(3): 245-269. You can download a
pre-publication draft from Roger's website:

Hope this helps,

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

Want ideas for reducing your carbon footprint? Visit Yahoo! For Good
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index