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

From |
"Aca N.T." <acant29@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Re: RE: RE: Re: Re: Displaying mean in boxplot |

Date |
Mon, 13 Oct 2008 15:50:09 +0700 |

Thanks Nick, it works well. I didnt get any error message as Martin did.. Aca. On Mon, Oct 13, 2008 at 5:12 AM, Martin Weiss <martin.weiss1@gmx.de> wrote: > Is "mean" defined somewhere in this code? I get "r(111)" "variable mean not > found"... > > HTH > Martin > _______________________ > ----- Original Message ----- From: "Nick Cox" <n.j.cox@durham.ac.uk> > To: <statalist@hsphsun2.harvard.edu> > Sent: Sunday, October 12, 2008 8:05 PM > Subject: st: RE: RE: Re: Re: Displaying mean in boxplot > > >> Example of orthodox box plot follows. N.B. that this requires prior >> installation of -egenmore- from SSC. >> >> sysuse auto, clear >> >> egen adju = adju(mpg), by(foreign) >> >> egen adjl = adjl(mpg), by(foreign) >> >> egen loq = pctile(mpg), by(foreign) p(25) >> >> egen upq = pctile(mpg), by(foreign) p(75) >> >> stripplot mpg, /// >> over(foreign) ms(none) box(bfcolor(ltblue)) yla(, noticks) pstyle(p1) >> /// >> addplot(rcap adjl adjl foreign, horizontal pstyle(p1) /// >> || rcap adju adju foreign, horizontal pstyle(p1) /// >> || rspike upq adju foreign, horizontal pstyle(p1) /// >> || rspike loq adjl foreign, horizontal pstyle(p1) /// >> || scatter foreign mpg if !inrange(mpg, adjl, adju), mcolor(navy) >> /// >> || scatter foreign mean, ms(D) mcolor(navy) msize(*2)) >> >> Nick >> n.j.cox@durham.ac.uk >> >> Nick Cox >> >> One way to do this through marker symbols, as requested, is through >> -stripplot- from SSC. >> >> sysuse auto, clear >> >> egen mean = mean(mpg), by(foreign) >> >> stripplot mpg, over(foreign) box stack centre height(0.2) ms(sh) >> addplot(scatter foreign mean, ms(Dh) msize(*3)) >> >> With more work, you can come arbitrarily close to more conventional >> forms of the box plot. >> >> Nick >> n.j.cox@durham.ac.uk >> >> Martin Weiss >> >> Admittedly, my earlier solution did not give you the dot you were >> looking >> for, but a reference line. If you have Stata 10, fire up the graph >> editor >> afterwards, use the -add marker- tool and place the marker onto the >> reference line. Then highlight the reference line and kill it... >> If -gr box- were part of the -twoway- family of graphs, one could >> imagine >> overlaying it with a -scatteri- to get the mean onto the graph more >> reliably >> than this... >> >> Martin Weiss >> >>> ********** >>> sysuse auto, clear >>> su price, mean >>> graph box price, box(1, fcolor(none)) yline(`r(mean)') >>> ********** >> >> Aca N.T. >> >>>> Does anyone know how to put mean (preferably marked as dot) within >> >> the >>>> >>>> box using -gr 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/ >> > > > * > * 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/ > * * 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/

**Follow-Ups**:**RE: st: Re: RE: RE: Re: Re: Displaying mean in boxplot***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**References**:**st: Displaying mean in boxplot***From:*"Aca N.T." <acant29@gmail.com>

**st: Re: Displaying mean in boxplot***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**st: Re: Re: Displaying mean in boxplot***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**st: RE: Re: Re: Displaying mean in boxplot***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**st: RE: RE: Re: Re: Displaying mean in boxplot***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**st: Re: RE: RE: Re: Re: Displaying mean in boxplot***From:*"Martin Weiss" <martin.weiss1@gmx.de>

- Prev by Date:
**AW: st: question about rolling regression and nlcom** - Next by Date:
**RE: st: Re: RE: RE: Re: Re: Displaying mean in boxplot** - Previous by thread:
**st: Re: RE: RE: Re: Re: Displaying mean in boxplot** - Next by thread:
**RE: st: Re: RE: RE: Re: Re: Displaying mean in boxplot** - Index(es):

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