16

I have constructed some box-plots in R and have several outliers. I know that the default criteria to set outlier limits are:

  • Q3 + 1.5*IQR
  • Q1 - 1.5* IQR

However, I would like outliers classified as values that fall outside of the boundaries:

  • Q3 + 3*IQR
  • Q1 - 3* IQR

Is it possible to set this in R?

csgillespie
  • 59,189
  • 14
  • 150
  • 185
ilaria
  • 161
  • 1
  • 1
  • 4
  • 1
    This recent questions also seems relevant here: http://stackoverflow.com/questions/4946964/in-ggplot2-what-do-the-end-of-the-boxplot-lines-represent – Chase Feb 14 '11 at 17:06

2 Answers2

25

From ?boxplot

range: 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.

So set range=3

Ryan Ward Valverde
  • 6,458
  • 6
  • 37
  • 48
Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
19

I'd encourage you not to do this without a lot of thought - people expect that the whiskers extend 1.5 IQRs. Changing the range will violate these assumptions and make it easy for people to draw incorrect conclusions from your graphic.

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
hadley
  • 102,019
  • 32
  • 183
  • 245
  • I agree that Tukey's box-plots are extremely useful for visualizing outliers. However, in some cases, it is useful to use "5-points plots" to compare the distribution on the data within different samples from min to max, without the distraction of the outliers This should be explained in the text. – Marco Stamazza Jan 26 '23 at 04:37