Bookmark and Share

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


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

Re: st: barcharts with error plot + legend?


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: barcharts with error plot + legend?
Date   Thu, 24 Nov 2011 09:42:38 +0000

Muhammad's suggestion to start with -graph bar- would get you only
part of the way, as the problem of adding error bars would still
remain and with that route be immensely difficult without higher-level
trickery. The UCLA FAQ is quite correct in principle: you need to look
at -twoway- and plot the bars one way and the error bars another way.

I wouldn't describe the solution as "incredibly tedious" but the way
to make it more palatable would be to write a Stata program to include
the less interesting operations. I am not aware that anyone has done
that for modern Stata graphics.

As it happens, many statistically-minded people dislike these plots
intensely. The remarkable and distinguished biostatistician Frank
Harrell I think coined the name "dynamite plots" and Statalist's own
Paul Seed I think independently called them "detonator plots".
Googling "Vanderbilt dynamite plots" points to much critical material
and constructive alternatives.  Both names are intended pejoratively.

The objection is at least twofold:

1. They suppress detail about univariate distributions that is likely
to be interesting and/or important.

2. They confuse careful interpretation by giving a strong visual
signal for size of point estimate and a weak visual signal for error
bar. One form not exemplified in the UCLA FAQ but very common --
especially it seems in various biological sciences -- even suppresses
the lower part of the error bar, hence the names above.

I have a positive alternative, as do Vanderbilt biostatisticians and
many others: use -dotplot- or -stripplot- (SSC). -stripplot- was not
originally written to as a superset of -dotplot-  but it can mimic
what -dotplot- does and do more besides. They let you show
distributions, means and error bars. -stripplot- supports both -by()-
and -over()- options. A legend is usually unnecessary as axis labels
and panel titles carry the same information.

Nick

On Thu, Nov 24, 2011 at 4:38 AM, Muhammad Anees <[email protected]> wrote:
> You can get an idea to start from
>
> -help graph bar-
>
> and a bar chart could be generated from
>
> -graph ()bar (mean) yournumericalvariable, over(region) by(anothervariable)-
>
> and the paranthesis before -bar- can contain -h- for horizontal if you
> desire otherwise simple -bar- would give a vertical bar chart.
>
> On Thu, Nov 24, 2011 at 4:25 AM, Guo Xu <[email protected]> wrote:

>> I'm looking for a procedure that can swiftly create barcharts with
>> over(.) and by(.) + allows me to add a legend. Basically, I'm looking
>> for an easy way to create this:
>>
>> http://www.ats.ucla.edu/stat/stata/faq/barcap.htm
>>
>> The procedure described on the website, however, is incredibly tedious
>> and I failed to find a shortcut. I'd be grateful for any suggestions
>> or hints!
>>
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index