Bookmark and Share

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]

Re: st: box plots of main effect relative risks


From   "Roger B. Newson" <r.newson@imperial.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: box plots of main effect relative risks
Date   Mon, 24 Sep 2012 11:32:41 +0100

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.

I hope this helps.

Best wishes

Roger

Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: r.newson@imperial.ac.uk
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/

Opinions expressed are those of the author, not of the institution.

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/

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index