Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: box plots of main effect relative risks


From   Nick Cox <[email protected]>
To   [email protected]
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
<[email protected]> 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 <[email protected]>
>> 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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index