about the 95%CI around the median...

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

about the 95%CI around the median...

Fernando Marmolejo-Ramos
Dear people

I've learnt that by using the "boxplot.stats" command in the "grDevices" library
I can get the 5-number summaries of a boxplot, plus other important information,
like the confidence interval around the median.

I'm interested in knowing the actual formula to used in that package to
calculate that confidence interval.

Can someone help me with this?

Cheers,

Fernando

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: about the 95%CI around the median...

Simon Blomberg-4
See ?fivenum in the stats package. If you just type

stats::fivenum

you will get the code. The crucial calculations are in the last few
lines.

Simon.

On Mon, 2008-08-04 at 16:19 +0930, Fernando Marmolejo Ramos wrote:

> Dear people
>
> I've learnt that by using the "boxplot.stats" command in the "grDevices" library
> I can get the 5-number summaries of a boxplot, plus other important information,
> like the confidence interval around the median.
>
> I'm interested in knowing the actual formula to used in that package to
> calculate that confidence interval.
>
> Can someone help me with this?
>
> Cheers,
>
> Fernando
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Simon Blomberg, BSc (Hons), PhD, MAppStat.
Lecturer and Consultant Statistician
Faculty of Biological and Chemical Sciences
The University of Queensland
St. Lucia Queensland 4072
Australia
Room 320 Goddard Building (8)
T: +61 7 3365 2506
http://www.uq.edu.au/~uqsblomb
email: S.Blomberg1_at_uq.edu.au

Policies:
1.  I will NOT analyse your data for you.
2.  Your deadline is your problem.

The combination of some data and an aching desire for
an answer does not ensure that a reasonable answer can
be extracted from a given body of data. - John Tukey.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: about the 95%CI around the median...

Gavin Simpson
On Mon, 2008-08-04 at 17:00 +1000, Simon Blomberg wrote:
> See ?fivenum in the stats package. If you just type
>
> stats::fivenum
>
> you will get the code. The crucial calculations are in the last few
> lines.

That will only give the code to calculate the five number summary, but
Fernando wants to know how the confidence interval is calculated in
boxplot.stats.

To see the code just type boxplot.stats followed by return at the
command line in R.

The relevant line is:

    conf <- if (do.conf)
        stats[3] + c(-1.58, 1.58) * iqr/sqrt(n)

Which is working on the median (stats[3]). Details of this computation
are in ?boxplot.stats which should have been Fernando's first port of
call. Two works are cited in support of the calculation with full
references in the References section of that help page.

HTH

G

>
> Simon.
>
> On Mon, 2008-08-04 at 16:19 +0930, Fernando Marmolejo Ramos wrote:
> > Dear people
> >
> > I've learnt that by using the "boxplot.stats" command in the "grDevices" library
> > I can get the 5-number summaries of a boxplot, plus other important information,
> > like the confidence interval around the median.
> >
> > I'm interested in knowing the actual formula to used in that package to
> > calculate that confidence interval.
> >
> > Can someone help me with this?
> >
> > Cheers,
> >
> > Fernando
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: about the 95%CI around the median...

Frank Harrell
Gavin Simpson wrote:

> On Mon, 2008-08-04 at 17:00 +1000, Simon Blomberg wrote:
>> See ?fivenum in the stats package. If you just type
>>
>> stats::fivenum
>>
>> you will get the code. The crucial calculations are in the last few
>> lines.
>
> That will only give the code to calculate the five number summary, but
> Fernando wants to know how the confidence interval is calculated in
> boxplot.stats.
>
> To see the code just type boxplot.stats followed by return at the
> command line in R.
>
> The relevant line is:
>
>     conf <- if (do.conf)
>         stats[3] + c(-1.58, 1.58) * iqr/sqrt(n)
>
> Which is working on the median (stats[3]). Details of this computation
> are in ?boxplot.stats which should have been Fernando's first port of
> call. Two works are cited in support of the calculation with full
> references in the References section of that help page.
>
> HTH
>
> G

I wonder why we don't just use the exact nonparametric confidence
interval for the median, which is just as easy to compute.  Also, it
will be asymmetric if the data are skewed, as it should be.

Frank

>
>> Simon.
>>
>> On Mon, 2008-08-04 at 16:19 +0930, Fernando Marmolejo Ramos wrote:
>>> Dear people
>>>
>>> I've learnt that by using the "boxplot.stats" command in the "grDevices" library
>>> I can get the 5-number summaries of a boxplot, plus other important information,
>>> like the confidence interval around the median.
>>>
>>> I'm interested in knowing the actual formula to used in that package to
>>> calculate that confidence interval.
>>>
>>> Can someone help me with this?
>>>
>>> Cheers,
>>>
>>> Fernando
>>>

--
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Frank Harrell
Department of Biostatistics, Vanderbilt University
Reply | Threaded
Open this post in threaded view
|

Re: about the 95%CI around the median...

Rolf Turner

On 5/08/2008, at 1:31 AM, Frank E Harrell Jr wrote:

        <snip>

> I wonder why we don't just use the exact nonparametric confidence  
> interval for the median, which is just as easy to compute.  Also,  
> it will be asymmetric if the data are skewed, as it should be.

        <snip>

The boxplot.stats() function gives the same ``confidence interval''  
for the median as the
boxplot() function. This isn't however *really*  a confidence interval.

The help on boxplot() (see the ``notch'' argument) indicates that  
this ``confidence interval''
actually provides a rough *hypothesis test* of the equality of *two*  
medians. The null hypothesis
is rejected if the notches (confidence intervals) don't overlap.

        cheers,

                Rolf

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.