[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: AW: Making scatterplot instead of box plot... |

Date |
Fri, 15 May 2009 12:32:24 +0100 |

Thanks for the plug. That was my reading of the question too. By the way, the official command -dotplot- also has -bar mean- and -bar median- options that offer rudimentary mean-based confidence intervals and median-and-quartiles boxes, respectively. I think it's fair to say, however, that -dotplot- as revised for Stata 8 (and little changed since) was a fairly literal translation of the previous version and entered little into the spirit of the new graphics. -stripplot- can in total offer more. There are detailed comments in its help, so I will stop there. Nick n.j.cox@durham.ac.uk Sam Norton sorry, missing parentheses in second example. It should be *** egen meanmpg = mean(mpg), by(foreign) egen sdmpg = sd(mpg), by(foreign) gen lb = meanmpg - sdmpg gen ub = meanmpg + sdmpg stripplot mpg, over(for) box stack centre vertical /// addplot(sc meanmpg foreign || rcap lb ub foreign) *** 2009/5/15 Sam Norton <samjnorton@googlemail.com>: > I don't really understand what is wanted, but you might find Nick > Cox's -stripplot- available from SSC helpful. For example, > > *** > sysuse auto, clear > stripplot mpg, over(foreign) box stack centre vertical // overlays box plot > stripplot mpg, over(foreign) bar stack centre vertical // overlays > mean and 95% CI > *** > > Alternatively, to display mean with bars showing +/- 1SD you could: > > *** > egen meanmpg = mean(mpg), by(foreign) > egen sdmpg = sdmpg, by(foreign) > gen lb = meanmpg - sdmpg > gen ub = meanmpg + sdmpg > stripplot mpg, over(for) box stack centre vertical addplot(sc meanmpg > foreign || rcap lb ub foreign) > *** > > 2009/5/14 Martin Weiss <martin.weiss1@gmx.de>: > >> Ok, overlays between Stata graphs work best with the -twoway- family, but >> -graph box- does not have membership status there. So let me guess what your >> best shot at the prob could be: >> >> ************* >> sysuse bpwide, clear >> >> //before >> graph box bp_before,/* >> */ over(sex) name(first, replace) /* >> */ nodraw >> >> scatter bp_before sex, /* >> */name(second, replace) nodraw >> >> //after >> graph box bp_after,/* >> */ over(sex) name(third, replace) /* >> */ nodraw >> >> scatter bp_after sex, /* >> */name(fourth, replace) nodraw >> >> //combine 'em >> gr combine first second third fourth >> ************* Amr Al Sayed" <asyoussef@yahoo.com> >>> Thanks for your help. I want complete representation of all the data set >>> in the graph as scatter plot with added indicator bar showing the mean and >>> sd of each scatter plot. >>> >>> I found your idea of combining box plot and graph bar in a single figure >>> also working. Then, my question is: >>> could you help me with making box plot and scatter plot (instead of bar >>> chart) in a single figure? > >>> --- On Fri, 5/15/09, Martin Weiss <martin.weiss1@gmx.de> wrote: >>> >>>> From: Martin Weiss <martin.weiss1@gmx.de> >>> >>>> You can stack inside the -graph bar- >>>> >>>> *** >>>> graph bar (mean) bp_before bp_after (sd) bp_before >>>> bp_after, over(sex) stack >>>> *** >>>> >>>> but apart from that, can you rephrase your request? I >>>> really do not get what >>>> you want... >>>> >>>> ----- Original Message ----- From: "Amr Al Sayed" >>>> > It worked! However, I want to show the data as scatter >>>> plot with all the >>>> > values are represented as dots plus an indicator bar >>>> beside every scatter >>>> > blot to show the mean and sd. If it is not possible, >>>> then I can use your >>>> > idea of combining box plot with scatter plot as the >>>> 2nd graph to the >>>> > right. >>>> > So, could you help with making scatter plot instead of >>>> graph bar (on the >>>> > 2nd graph) >>>> > OR to add the sd value to the top of each graph bar as >>>> a whiskers? >>>> > >>>> > --- On Thu, 5/14/09, Martin Weiss <martin.weiss1@gmx.de> >>>> wrote: >>>> > >>>> >> From: Martin Weiss <martin.weiss1@gmx.de> >>>> >> Not sure how a scatter plot can have bars, but >>>> here is >>>> >> something you could >>>> >> try: >>>> >> >>>> >> >>>> >> ************* >>>> >> sysuse bpwide, clear >>>> >> >>>> >> graph box bp_before bp_after,/* >>>> >> */ over(sex) name(first, replace) /* >>>> >> */ nodraw >>>> >> graph bar (mean) bp_before bp_after /* >>>> >> */(sd) bp_before bp_after, over(sex)/* >>>> >> */ name(second, replace) nodraw >>>> >> >>>> >> gr combine first second >>>> >> ************* >>>> >> Im Auftrag von Amr Al Sayed >>>> >> I have simple problem with transforming a box plot >>>> of two >>>> >> continuous >>>> >> variables (y1 and y2) measured over 4 time points >>>> (x, with >>>> >> x is a >>>> >> categorical variable 0,1, 2, 3) into scatter graph >>>> with bar >>>> >> indicating their >>>> >> means and standard deviation. The rationale is a >>>> more >>>> >> informative way of >>>> >> data display. >>>> >> >>>> >> I used the stata command (Stata 9.2): graph box y1 >>>> y2, >>>> >> over(x) >>>> >> >>>> >> Could you help me to display my data as >>>> scatterplot instead >>>> >> of blind box? * * 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/

**References**:**Re: st: AW: Making scatterplot instead of box plot...***From:*Amr Al Sayed <asyoussef@yahoo.com>

**Re: st: AW: Making scatterplot instead of box plot...***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**Re: st: AW: Making scatterplot instead of box plot...***From:*Sam Norton <samjnorton@googlemail.com>

**Re: st: AW: Making scatterplot instead of box plot...***From:*Sam Norton <samjnorton@googlemail.com>

- Prev by Date:
**Re: st: AW: Making scatterplot instead of box plot...** - Next by Date:
**Re: st: RE: Covariates in ANOVAs** - Previous by thread:
**Re: st: AW: Making scatterplot instead of box plot...** - Next by thread:
**Re: st: AW: Making scatterplot instead of box plot...** - Index(es):

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