[R] Quantiles in boxplot‏

Sarah Goslee sarah.goslee at gmail.com
Fri Jan 13 17:14:08 CET 2012


The explanation is in ?boxplot.stats (as the help for boxplot states).

Details:

     The two ‘hinges’ are versions of the first and third quartile,
     i.e., close to ‘quantile(x, c(1,3)/4)’.  The hinges equal the
     quartiles for odd n (where ‘n <- length(x)’) and differ for even
     n.  Whereas the quartiles only equal observations for ‘n %% 4 ==
     1’ (n = 1 mod 4), the hinges do so _additionally_ for ‘n %% 4 ==
     2’ (n = 2 mod 4), and are in the middle of two observations
     otherwise.

And so on, with references.

Sarah

2012/1/13 René Brinkhuis <rene.brinkhuis at live.nl>:
>
> Hi,
>
> I have a simple question about quartiles in R, especially how they are calculated using the boxplot.
> Quartiles
>  (.25 and .75) in boxplot are different from the summary function and
> also don't match with the 9 types in the quantile function.
> See attachment for details.
> Can you give me the details on how the boxplot function does calculate these values?
>
> Cheers,
> Rene Brinkhuis (Netherlands)




-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list