Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: box plots of main effect relative risks |

Date |
Mon, 24 Sep 2012 11:44:30 +0100 |

Alpna must speak for Alpna, but "whiskers" are not defined in the same way by everyone. Tukey, the inventor of the term "box plot", but not the idea, played with different ideas, but that most imitated is based on this recipe: 1. calculate quartiles and thus their difference the IQR. 2. draw whiskers that extend to the (smallest, largest) data points within [p25 - 1.5 IQR, p75 + 1.5 IQR]. 3. plot any points outside that interval individually. The recipe given by Roger here will often, but not always, give the same result, depending on whether there are any points as defined by #3. This is the recipe used by -graph box- and -graph hbox- and one that is obtainable with -stripplot- (SSC). Nick On Mon, Sep 24, 2012 at 11:32 AM, Roger B. Newson <r.newson@imperial.ac.uk> wrote: > I don't know if Alpna really wanted to produce box plots or just confidence > interval plots. However, as it happens, you CAN do box plots with whiskers > using -eclplot-. This is done using the -baddplot()- option to add the > whiskers. (That was my reason for adding the -baddplot()- option to > -eclplot-.) > > As in: > > sysuse auto, clear; > collapse (min) min=weight (p25) p25=weight (p50) p50=weight (p75) p75=weight > (max) max=weight, by(foreign); > list; > eclplot p50 p25 p75 foreign, hori rplottype(rbar) baddplot(rspike min max > foreign, hori) ylab(0 1); > > This code will produce a horizontal box plot, with the dots indicating > medians, in front of the bars indicating 25th and 75th percentiles, in front > of the whiskers indicating the minimum and the maximum car weight in the > group. -eclplot- has numerous options that can be used to alter the look of > the graph, including adding a scatter plot to include extreme data points. > > > On 22/09/2012 08:11, Nick Cox wrote: >> >> -parmby-, -sencode-, -eclplot- are all user-written commands: you are >> asked to explain where you got them. See Statalist FAQ. >> >> As I understand it, -eclplot- does not purpoort to do box plots with >> whiskers. Therefore, use -graph box- or -graph hbox-. >> >> Nick >> >> On Sat, Sep 22, 2012 at 5:44 AM, Alpna Agrawal Kapur <alpna007@gmail.com> >> wrote: >> >>> I would like to -- >>> (1) produce box plots with whiskers of relative risks >>> (2) graph the main effect relative risks from multiple regressions and >>> produce box plots of all these relative risks in one graph. >>> >>> I am using Stata 10 >>> >>> The code I have tried -- >>> parmby "xi: glm y x1 covar1 covar2 covar3, fam(poisson) link(log) >>> nolog robust eform", label norestore eform >>> sencode label, gene(parmlab) >>> eclplot estimate min95 max95 parmlab >>> >>> parmby "xi: glm y x2 covar1 covar2 covar3, fam(poisson) link(log) >>> nolog robust eform", label norestore eform >>> sencode label, gene(parmlab) >>> eclplot estimate min95 max95 parmlab >>> >>> Problems are -- >>> (1) does not graph box plots with whiskers >>> (2) I want to graph RRs of x1 and x2 together in same graph, but this >>> code creates two different datasets and includes RRs for the >>> covariates as well which I do not want. I'd like to create one dataset >>> that only stores estimates x1 and x2, then graph these RRs as box >>> plots with whiskers. * * 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: box plots of main effect relative risks***From:*Alpna Agrawal Kapur <alpna007@gmail.com>

**References**:**st: box plots of main effect relative risks***From:*Alpna Agrawal Kapur <alpna007@gmail.com>

**Re: st: box plots of main effect relative risks***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: box plots of main effect relative risks***From:*"Roger B. Newson" <r.newson@imperial.ac.uk>

- Prev by Date:
**Re: st: box plots of main effect relative risks** - Next by Date:
**RE: st: Add new observations.** - Previous by thread:
**Re: st: box plots of main effect relative risks** - Next by thread:
**Re: st: box plots of main effect relative risks** - Index(es):