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]
st: RE: Mimicking graph bar's multiple over options in ciplot
From
Nick Cox <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
st: RE: Mimicking graph bar's multiple over options in ciplot
Date
Tue, 30 Nov 2010 11:23:34 +0000
-ciplot- is from SSC. Please explain where user-written programs you refer to come from, as requested long since in the FAQ.
This would be a small change for -ciplot- in the same sense as pigs with wings would be a small change: it's easy to imagine, but it's not possible at present, and in fact fundamental problems lie in the way. -ciplot- is a wrapper for -graph twoway- and thus does not support the functionality of -graph bar-. End of that story.
To get what you want, a better strategy is to combine the use of -statsby- to get a reduced dataset with something like -graph dot-:
sysuse citytemp, clear
local label "`: var label tempjan', deg F"
statsby mean=r(mean) ub=r(ub) lb=r(lb), by(division region) clear : ci tempjan
graph dot (asis) ub lb mean, ///
marker(1, mcolor(black) ms(oh)) marker(2, mcolor(black) ms(oh)) ///
marker(3, mcolor(black) ms(O)) ///
over(division) over(region) nofill ytitle("`label'") legend(off)
For more on -statsby- as a way -- I now think the best way -- of getting confidence interval plots, see
SJ-10-1 gr0045 . . . . . . . . . . . . . Speaking Stata: The statsby strategy
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
Q1/10 SJ 10(1):143--151 (no commands)
demonstrates the use of statsby to prepare a reduced
dataset for subsequent graphing
I am very much aware that the solution above does not extend to conventional symbols for the confidence intervals. To get that, I think you need -twoway- functionality but to reproduce the functionality from -graph dot- of handling nested groupings would be harder work. Some material within
SJ-8-2 gr0034 . . . . . . . . . . Speaking Stata: Between tables and graphs
(help labmask, seqvar if installed) . . . . . . . . . . . . N. J. Cox
Q2/08 SJ 8(2):269--289
outlines techniques for producing table-like graphs
might help.
Nick
[email protected]
Venable
I would like to create a graph of estimates of means with standard
error bars. ciplot seems like an excellent tool for this. I would like
to make one small change, though: I would like to arrange the
estimates in a format similar to that produced by graph bar with
multiple over() options.
As an example:
sysuse citytemp, clear
// ciplot produces the content I want
// mean plotted with a point
// confidence interval around point estimate plotted with capped bar
ciplot tempjan, by(division)
// graph bar produces the formatting I want
// separating first by region and then by division within region
gr bar (mean) tempjan, over(division) over(region) nofill
How could I produce a graph that combines these?
*
* 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/