Statalist The Stata Listserver


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

Re: st: Box plot-like graph with mean, 95 percent CI


From   "Sebastian F. Büchte" <sfbuechte@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Box plot-like graph with mean, 95 percent CI
Date   Thu, 8 Mar 2007 09:03:12 +0100

Seb,

you can achieve what you describe through overlaying two graphs. You
will need a graph of type -scatter- and a graph of type -spike-.

Let's say you dataset contains four variables:

mean_var  ->   variable holding the mean
lcl_var   ->   variable holding the lower confidence limit
ucl_var   ->   variable holding the upper confidence limit
x_var     ->   some variable over which you want to graph the above
              mentioned variables

The apppropiate -graph- command would then be:

twoway                                          ///
    || scatter mean_var x_var, [options]       ///
    || rspike lcl_var ucl_var x_var, [options]  ///
    || , [overall options,eg, legendoptions]

This could of course also be written down differently,eg, just in line
omitting the "||" and the "///", but I just like the very structured
appearance of the above presented.

regards
Sebastian

On 3/8/07, Sebastian Bauhoff <sbauhoff@gmail.com> wrote:
Dear Statalisters,

I need to make a graph that looks like a box plot, but shows the mean
and 95 percent CI.  Basically I want the graph to have a dot for the
mean and a thin like for the CI, and all that for about 10 variables on
the x-axis.  I unsuccessfully tried to get a twoway graph to work using
the code on
http://www.ats.ucla.edu/stat/stata/library/GraphExamples/code/tworcap.htm

Any suggestions very much appreciated!

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