Another approach is to write your own script.
This code is based on a do file posted about a week
ago in response to another question about
alternative recipes for box plots.
---------------------- anotherbox.do
// another box plot: one box p10 to p90
// other box mean +/- smidgen
// two arguments: y byvar
// examples: do anotherbox mpg rep78
// ru anotherbox mpg rep78
// NJC 9 Nov 2006
args y byvar
if "`byvar'" == "" error 198
local Y `"`: variable label `y''"'
if `"`Y'"' == "" local Y "`y'"
preserve
tempvar mean p10 p90 mean1 mean2
su `y', meanonly
local smidgen = 0.002 * (r(max) - r(min))
qui statsby "su `y', detail" `mean'=r(mean) `p10'=r(p10) `p90'=r(p90) ///
, by(`byvar')
qui gen `mean1' = `mean' + `smidgen'
qui gen `mean2' = `mean' - `smidgen'
twoway ///
rbar `p10' `p90' `byvar', bcolor(none) barw(0.2) || ///
rbar `mean1' `mean2' `byvar', bcolor(red) barw(0.2) ///
legend(off) ytitle(`"`Y'"') yla(, ang(h)) ///
note("red bars: mean; empty bars: 10%, 90% percentiles")
restore
--------------------------------------------------------------
Incidentally, note that the mean may lie beyond the
10% or 90% points, so a program depending on the
contrary may fall over, surprised though you might be
if that happened to you. That is, only one data point
need be larger (or smaller) than the mean.
Nick
[email protected]
Caleb Southworth
> I would like to make boxplots where middle = mean, hinges = 10th/90th
> pctile. I note this has come up several times before and Michael
> Blasnik had a program called boxredo.ado, but I don't seem to find
> that on SSC. Perhaps it was renamed or incorporated elsewhere? Thanks!
>
> Original post here:
> http://www.stata.com/statalist/archive/2004-06/msg00205.html
*
* 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/