Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: RE: AW: AW: RE: -ciplot- -eclplot- combine with box-options?

From   "Nick Cox" <>
To   <>
Subject   st: RE: AW: AW: RE: -ciplot- -eclplot- combine with box-options?
Date   Sun, 9 May 2010 18:21:40 +0100

It's a pity that Marc missed a (simpler) solution with -stripplot- that
requires no dataset manipulation at all. 

sysuse bpwide 

stripplot bp_before bp_after , by(sex, compact) stack vertical bar

gets you there directly. 

If you really want only the c.i. bars, so that the data points are
suppressed, that's perverse, but you can do it too: 

stripplot bp_before bp_after , by(sex, compact) vertical bar boffset(0)
ms(none) xsc(r(0.8 2.2))

In short, -stripplot- for two or more variables and two or more groups
requires -by()- not -over()-. As program writer, I saw no point trying
to re-create a complicated set-up when -by()- does it for you for free. 


Kaulisch, Marc

Okay, it seems that -statsby- does the trick together with -dsconcat-

Preliminary without labels etc:

sysuse bpwide
tempfile tf1 tf2
statsby mean1=r(mean) ub1=r(ub) lb1=r(lb) N1=r(N), by(agegrp)
saving(`tf1') subsets total: ci bp_before
statsby mean2=r(mean) ub2=r(ub) lb2=r(lb) N2=r(N), by(agegrp)
saving(`tf2') subsets total: ci bp_after
dsconcat `tf1' `tf2'
twoway rcap ub1 lb1 agegrp || scatter mean1 agegrp || rcap ub2 lb2
agegrp || scatter mean2 agegrp 

Kaulisch, Marc


Thanks a lot for this extensive answer. I learn a lot. I haven't had
time yet to go deeper in the opportunities to work with statsby (will do
this later). But experimenting with -stripplot- I come very early to an

I would like to create a graph such as
. sysuse bpwide
. graph hbox bp_before bp_after, over(sex) over(agegrp), sort(1)

But I do not want a boxplot but a ci-bar as in stripplot...

-stripplot- does not allow two vars with over.

. ciplot bp_before bp_after, by(agegrp)
looks closer to my interest...

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index