[R] Boxplot not doing what I think it should
Uwe Ligges
ligges at statistik.tu-dortmund.de
Sat Feb 26 17:57:19 CET 2011
On 24.02.2011 19:15, Greg Snow wrote:
> Look at ?quantile, especially the detail section on "type" and the second reference (and the see also section). There are many different definitions of quantiles/quartiles and different functions use different versions.
>
Particularly ?boxplots points to ?boxplot.stats and that points to
Tukey's "original" ?fivenum.
Uwe Ligges
>> -----Original Message-----
>> > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
>> > project.org] On Behalf Of Lewis Berman
>> > Sent: Thursday, February 24, 2011 8:38 AM
>> > To: r-help at R-project.org
>> > Subject: [R] Boxplot not doing what I think it should
>> >
>> > My box plot below is drawing its upper whisker all the way to the last
>> > point, instead of showing the point as an outlier. Am I
>> > misunderstanding, or is it a bug?
>> >
>> > Help(boxplot) states for the parameter "range" that "this determines
>> > how far the plot whiskers extend out from the box. If range is
>> > positive, the whiskers extend to the most extreme data point which is
>> > no more than range times the interquartile range from the box. A value
>> > of zero causes the whiskers to extend to the data extremes."
>> >
>> > To my understanding, the code below, which drew the boxplot, should
>> > have drawn the right-hand whisker only to 387 and shown 496 as an
>> > outlier point. But it didn't. Using a range of 1.3 does. Horizontal
>> > versus vertical does not matter.
>> >
>> > Also, the right edge of the box does not show the same 3rd Quartile as
>> > does "summary." Explain, please.
>> >
>> >
>>> > > sort(t5g24times)
>> > [1] 111 135 201 234 283 283 284 285 300 370 387 496
>>> > > summary(t5g24times)
>> > Min. 1st Qu. Median Mean 3rd Qu. Max.
>> > 111.0 225.8 283.5 280.8 317.5 496.0
>>> > > iqr <- 317.5 - 225.8
>>> > > iqr
>> > [1] 91.7
>>> > > 317.5 + 1.5 * iqr
>> > [1] 455.05
>>> > > pdf()
>>> > > boxplot(c(t5g24times), horizontal=1, range=1.5)
>> >
>> >
>> > R version info:
>> > platform x86_64-apple-darwin9.8.0
>> > arch x86_64
>> > os darwin9.8.0
>> > system x86_64, darwin9.8.0
>> > status
>> > major 2
>> > minor 12.0
>> > year 2010
>> > month 10
>> > day 15
>> > svn rev 53317
>> > language R
>> > version.string R version 2.12.0 (2010-10-15)
> ______________________________________________
> R-help at r-project.org 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.
More information about the R-help
mailing list