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: Boxplots - avoiding the box in a strata with a small number of observations


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Boxplots - avoiding the box in a strata with a small number of observations
Date   Tue, 4 Sep 2012 09:07:40 +0100

Allowing two or more -over()- options is characteristic only of -graph
box-, -graph dot-, -graph bar- etc. It is not possible in practice
with (a) -graph twoway- or (b) any command based on -twoway- such as
-dotplot- (although (b) at least is programmable).

-stripplot- (SSC) offers most if not of the flexibility you need. To
concoct a problem similar to yours, I typed

sysuse auto
gen himpg = mpg > 20

Then after some experimentation, this plot

stripplot weight , over(rep78) by(himpg) vertical box(barw(0.5)
blcolor(gs8))  width(100) center stack height(0.4)

seems adequate.

-stripplot- helps because

1. Both -over()- and -by()- are supported, thus allowing two-way
classifications.

2. If a group contains only one value, the box would be a bar of zero
length, which Stata won't (can't) show visibly.

3. You can adjust the box colour to play down the boxes while keeping
them visible. I think this is a good idea generally.

4. You can tinker with bin width, spacing of points and box width

Nick

N.B. One stratum, two or more strata.

On Tue, Sep 4, 2012 at 1:37 AM, Richard Hiscock
<[email protected]> wrote:

> I have continuous data (plasma level of drug) in patients, who received a dose determined by body weight (in five strata), measured at three time points.
> Whilst the lower strata have 40+ patients the highest two levels the number of patients is very small n = 5 & 2.
> To graphically present the plasma levels I would prefer to show individual data points but using dotplots however the command doesn't seem to allow for over commands (with data now in the long form).
>
> dotplot plasma_level , over(time) over(wtstrata)
>
> I can achieve close to what I want using boxplots, however I feel that boxes for the strata  with 5 & 2 only observations is not appropriate. Is there anyway to have individual data points displayed for these strata? The command I'm using in Stata 12 is
>
> gr box  Baseline Firstdose Thirddose , over(wtstrata)
>
> Any help or other presentation suggestions would be much appreciated
*
*   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