I want to determine outliers in a data frame using quantiles and 1.5*IQR. I have used the boxplot function and compared the resulting outliers to the ones computed using quantiles and iqr.
I am noticing a difference between the two methods. The boxplot method detects less outliers than the Q1-1.5*IQR, Q3+1.5*IQR computation. I have tried setting the range
in boxplot to 1.5 but it still detects fewer outliers. Is range the correct boxplot option to set or is there another option that i need to set?
Any help is greatly appreciated.
x <- c(-8.4849, -8.4848, -8.8485, -8.4848, -8.4848, -8.4848, -8.7879, -8.4848,
-8.4849, -8.6061, -8.3838, -8.2424, -8.4849, -8.3636, -8.2424, -8.7273)
qnt = quantile(x, probs=c(.25, .75))
iqt = 1.5 * IQR(x)
x[x < (qnt[1] - iqt)]
[1] -8.8485 -8.7879 -8.6061 -8.7273
x[x > (qnt[2] + iqt)]
[1] -8.2424 -8.3636 -8.2424
boxplot(x, range = 1.5)$out
[1] -8.8485 -8.7879 -8.2424 -8.2424 -8.7273