[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: RE: three mean and sd plots on the same graph? |

Date |
Thu, 8 Nov 2007 17:04:47 -0000 |

-over()- indeed does not apply here; I didn't say otherwise. -stripplot- with -by()- will produce graphs of the kind you sketch: I don't see what you think is the difficulty. You would need to specify -vertical-. Nick n.j.cox@durham.ac.uk Joseph Wagner Unfortunately I can't use over with -stripplot- since I can't combine ()over with more than one variable and I have three that I wanted to compare side by side for each value of the X- axis categorical variable. by() won't work either for that matter since what I want is basically X over many Y as follows with a crude representation of my boxplot: | | - - - - | +-+ - +-+ +-+ - +-+ | |-| +-+ |-| |-| +-+ |-| | +-+ |-| +-+ +-+ |_| +-+ | - +-+ - - +-+ - | - - +------------------------------------------- var_1 var_2 var_3 var_1 var_2 var_3 age=8 age=9 Nick Cox wrote: > Now my best advice is to use -stripplot- from SSC. Its default is to > show > strips of data points, but you can jitter or stack and add boxes or > bars. > > . sysuse auto > (1978 Automobile Data) > . stripplot trunk turn mpg, bar > > . stripplot trunk turn mpg, bar > > . stripplot trunk turn mpg, bar vertical > > You can use a -by()- option as well. I'd recommend showing the data, > but you can blank it out with -ms(none)-. > > By default the bars are offset from the data which may answer your > last question. > > Joseph Wagner > > I created box plot graph with of 3 X variables over the same Y variable > but was then asked to produce a similar graph this time using mean (not > median) and +/- 95% CI. I don't think Stata can do this but thanks to > a post by Nick three years ago, I was able to (sort of) create these: > > egen mean = mean(cont), by(cat) > egen sd = sd(cont), by(cat) > gen upper = mean + sd > gen lower = mean - sd > > scatter mean cat || rcap upper lower cat > > . . . is the example Nick gave but how would (or could I?) do this for > three different X variables (in Nick's example I suppose it would be 3 > different 'cont' variables) on the same graph? I can do > this for two but not 3 which brings me to my next problem: > > The box plots I created earlier were each side by side for the same > value of X (rather than on top of one another) but the two -rcap- graphs > are on top of each other making it impossible to differentiate > the two lines (three would be even worse). Is there a way to separate > these lines or do I need to graph these data in another way altogether? * * 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/

**References**:**st: three mean and sd plots on the same graph?***From:*Joseph Wagner <joseph.wagner@wright.edu>

**st: RE: three mean and sd plots on the same graph?***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: RE: three mean and sd plots on the same graph?***From:*Joseph Wagner <joseph.wagner@wright.edu>

- Prev by Date:
**st: Majordomo results: Majordomo results: Majordomo results: RE** - Next by Date:
**Majordomo results: st: Majordomo results: Majordomo results** - Previous by thread:
**Re: st: RE: three mean and sd plots on the same graph?** - Next by thread:
**Re: st: three mean and sd plots on the same graph?** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |