Changing the outlier rule in a boxplot

a 夏天 提交于 2019-12-28 13:23:48

问题


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?


回答1:


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

(You could have looked a little harder at the documentation ...)




回答2:


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.



来源:https://stackoverflow.com/questions/4994313/changing-the-outlier-rule-in-a-boxplot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!