Statalist The Stata Listserver


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

RE: st: Box graph question


From   "Maarten Buis" <M.Buis@fsw.vu.nl>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Box graph question
Date   Wed, 1 Nov 2006 19:48:34 +0100

Nick:
Great graph, but I think that you added a || too many. 
Shouldn't the graph command be:

twoway scatter mean rep78 || ///
rbar mean max rep78, bcolor(none) barw(0.2) || ///
rbar mean min rep78, bcolor(none) barw(0.2) || ///
rbar meanmsd meanpsd rep78 , barw(0.1) bcolor(red) ///  removed ||
legend(off) ytitle(Miles per gallon) yla(, ang(h)) ///
note(red bars: mean +/- sd; empty bars show range)

HTH,
Maarten

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

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z434 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of n j cox
Sent: woensdag 1 november 2006 19:15
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Box graph question

My advice in a nutshell: forget any idea that -graph box- is the
way to do this. Produce your own results set and then build your
own graph as a set of calls to -twoway-.

sysuse auto, clear

statsby "su mpg" mean=r(mean) max=r(max) min=r(min) sd=r(sd), by(rep78)

// here k = 1; tune to choice
gen meanpsd = mean + sd
gen meanmsd = mean - sd

// use -line- or -connected- not -scatter-
twoway scatter mean rep78 || ///
rbar mean max rep78, bcolor(none) barw(0.2) || ///
rbar mean min rep78, bcolor(none) barw(0.2) || ///
rbar meanmsd meanpsd rep78 , barw(0.1) bcolor(red) || ///
legend(off) ytitle(Miles per gallon) yla(, ang(h)) ///
note(red bars: mean +/- sd; empty bars show range)

Not so long ago someone was complaining about the overlay idea
as unnatural. Here I designed a novel kind of graph purely
from very basic ingredients. It works!

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

Rodrigo A. Alfaro <ralfaro76@hotmail.com>

I am not graphic at all. I cannot find a simple solution for my problem.
Probably the answer is simple, but I need help to find it. I want to create
a box graph with a line connecting the means (not the medians), but the
boxes have to cover the range (not the IQR)... also with boxes covering
k*std_deviation.


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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