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, statalist.org is already up and running.


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

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


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: -ciplot- -eclplot- combine with box-options?
Date   Fri, 7 May 2010 13:12:24 +0100

As this kind of question probably interests several people, my answer
will range more widely than your question. 

I am the author of -ciplot-. Roger Newson, author of -eclplot-, may well
have another  answer.

Can you combine -graph box- with user-written commands?
=======================================================

The short answer is No. The reason is that -graph box- cannot be
combined with anything else! This works both ways: -graph box- doesn't
have an option to call anything else graphical, and nothing else
graphical could be used to call up -graph box-. Those aware of -plot()-
and -addplot()- options should also know that they don't apply to -graph
box-. For -box- read also -hbox-. 

End of short answer. 

Here is a longer answer. 

-ciplot- is a program I haven't touched since 2004 and it's not going
anywhere. That aside, there isn't an easy way to add box plots to the
display of -ciplot-. But there are other possibilities. 

-stripplot- (SSC, also by me) offers dot plots together with confidence
intervals for means through its -bar- option. It also offers a -box-
option. There isn't a very easy way to have both box and bar together,
but it is in principle manageable through some previous calculation and
-stripplot-'s -addplot()- option. My own stance is that box and bar
together are typically less helpful and less attractive than dot plot
and bar together, which is why I do not offer bar and box options
together. 

A further message is that it is not too difficult to re-create box plots
for yourself, regardless of -graph box-. Indeed, that way you can have
your own personal variations of box plots. For example, I tend to prefer
boxes PLUS whiskers to 5 and 95% percentiles PLUS detail beyond to the
boxes PLUS whiskers to data point within 1.5 IQR of the nearer quartiles
that remain more common. (I usually prefer quantile plots and dot plots
to either, but that is another story.) 

This theme is discussed in some detail within two recent articles in the
Stata Journal: 

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

SJ-9-3  gr0039  . . . . . . . . Speaking Stata: Creating and varying box
plots
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N.
J. Cox
        Q3/09   SJ 9(3):478--496                                 (no
commands)
        explains how to use egen to calculate the statistical
        ingredients needed for box plots and variations of box
        plots; shows the use of twoway to then create the plots

Can you have two -over()- options within user-written commands?
===============================================================

Silly answer: Yes, if the syntax diagram says you can. Otherwise no. 

It seems that you want two -over()- options within -ciplot- or
-eclplot-. 

-ciplot- is, once again, less flexible for showing group structure than
-stripplot-. -stripplot- has a -by()- and an -over()- option which come
very close to two -over()- options in their effect. Compare, e.g. 

. sysuse auto 

. graph box mpg, over(rep78) over(foreign)

. stripplot mpg, box vertical over(rep78) by(foreign, compact)

What about sorting on means?
============================

You have to do this yourself with my programs, so far as I can recall.
But here is some technique illustrated by example:

. stripplot mpg, over(rep78) bar

. egen mean = mean(mpg), by(rep78)

. egen axis = axis(mean rep78), label(rep78)
(5 missing values generated)

. stripplot mpg, over(axis) bar ytitle("`: var label rep78'")

The crucial detail here is that the -egen- function -axis()- is _not_
official. You need to install -egenmore- (also SSC). 

Nick 
n.j.cox@durham.ac.uk 

Kaulisch, Marc

I have a question about -ciplot- and -eclplot- (both from ssc).
Basically I have not found out yet if there is the option with these
programs to combine it with two options I very much appreciate in -graph
box-.

I would like to combine these graphs with two "over" (in graph box)
groups and to use the over-option sort(1) in order to sort the display
of confidence intervals by the mean of the first variable.

Background: I have two variables with scales 1 to 5. Boxplots on
individual values are not very informative. Collapsing the dataset
creates boxplots representing the distribution of group means but would
not represent the distribution of individual values. That is why I want
to calculate (and present) the ci of these vars by certain groups.

Is there a workaround to get such a ci-graph?

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index