2
$\begingroup$

Top whisker in a boxplot is located at 1.5*IQR + Q3 (if max data value is larger than this). Now please consider the following data as written in R:

d<-c(seq(from = 1, to = 2, by = 0.2 ), seq(10, 100, by = 10), 200, 400)
IQR(d)           # 75.65
quantile(d)[4]   # 77.5    (upper hinge of boxplot)

So top whisker should be located at (77.5 + 1.5 * 75.65) = 190.75. Max value of d is 400. But 'boxplot.stats()' gives the location of upper whisker at 100. How?

> boxplot.stats(d)
$stats
[1]   1.0   1.8  35.0  80.0 100.0

$n
[1] 18

$conf
[1]  5.877572 64.122428

$out
[1] 200 400

I totally nonplussed. An explanation will be greatly appreciated.

$\endgroup$
5
  • 2
    $\begingroup$ The upper whisker always stops at a data point. It is never at upper quartile + 1.5 IQR unless that coincides with a data point. Rather that is as high as the upper whisker can possibly extend, but the data often (I'd say usually) imply otherwise. It's easy to think up examples where upper quartile + 1.5 IQR could be higher than the maximum in the data, but you wouldn't expect the upper whisker to extend beyond the range of the data, would you? $\endgroup$
    – Nick Cox
    Commented May 2, 2018 at 9:51
  • 1
    $\begingroup$ Personally I think it's a lot simpler if whiskers extend to identified percentiles, e.g. 1 and 99% points or 5 and 95% so long as these are explained. Tukey-type box plots often aren't explained clearly in papers or texts either. But no design suits all distributions. It's arguable that the 1.5 IQR rule of thumb is past its sell-by date, as e.g. (1) it often proves confusing at introductory or elementary level (2) it was never intended as anything but heuristic, yet it's often warped into an universal criterion for outliers. $\endgroup$
    – Nick Cox
    Commented May 2, 2018 at 9:58
  • $\begingroup$ Thanks for very clear explanation. Sorry, I am unable to upvote your answer because of my score. $\endgroup$
    – ashok
    Commented May 2, 2018 at 10:08
  • $\begingroup$ Thanks for the appreciation and your intention to upvote my comment. $\endgroup$
    – Nick Cox
    Commented May 2, 2018 at 10:27
  • $\begingroup$ I have upvoted the question for being usefull and clear (as a first question), so @ashok 's score will increase and upvoting comments will soon be possible. $\endgroup$
    – Bernhard
    Commented May 2, 2018 at 11:01

1 Answer 1

1
$\begingroup$

Because top whisker is located at (from wikipedia): "the lowest datum still within 1.5 IQR of the lower quartile, and the highest datum still within 1.5 IQR of the upper quartile (often called the Tukey boxplot)" and 190 is not one of your data, while 100 is the highest datum still within 1.5 IQR of the upper quartile.

In this answer, referring to: https://en.wikipedia.org/wiki/Box_plot

I am assuming that your plot is of the second type cited. As remarked in Bernhard's comment below however, you should refer to the manual of the function you are using to be sure of this.

You might have an additional confirmation by having 180 (instead of 200) in the data and see whether the upper whisker changes.

$\endgroup$
1
  • 1
    $\begingroup$ Good and concise answer right on the spot. The best source to refer to IMHO is not wikipedia, but the R manual of the R function used. Type help(boxplot.stats) at the R console and see, how the whiskers can be controlled via an argument coef that is preset to 1.5 if you do not specify otherwise: " If coef is positive, the whiskers extend to the most extreme data point which is no more than coef times the length of the box away from the box. A value of zero causes the whiskers to extend to the data extremes (and no outliers be returned).". $\endgroup$
    – Bernhard
    Commented May 2, 2018 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.