Why ought IQRs, and anything that relies on them like boxplots, be used when they ignore data? I replicated Wikipedia's graphs.
-
1$\begingroup$ The values of the min and max are clearly shown in any boxplot. Sometimes positions of extreme values, so-called 'outliers' are also shown. It is by focusing on the distance between first and third quanties (interquartile range) that we get a robust and often measure of variability of a sample. (Robust means not unduly influenced by extreme values.) // Opinions as to what are useful data summaries vary by person and type of task at hand. You are free not to use boxplots if you believe they ignore features of data that are important in what you're doing. $\endgroup$– BruceETCommented Oct 24, 2019 at 1:35
2 Answers
There's a distinction between data and the information in the data.
For example, if data could be contaminated by a second process - beside the one of interest - whose values would be considered as gross errors, but the desire was to get information about the location or spread of the uncontaminated process, using potentially wildly discrepant parts of the data may be highly misleading.
As a result, it may make sense to choose robust estimates of location and spread around it, and then see where the data lay relative to those.
As an example, consider a process where a value may gain a stray digit (perhaps a typist occasionally hits an extra key, for example). Then once in a while you'll get a value typically on the order of 10 times too large (though it might be anything from only slightly too large to about 90 times too large - if the stray digit occurs first). A boxplot is not badly affected by such contamination, but something that put full weight on the most discrepant points would be.
Such plots can work fairly well for data that may be heavy-tailed and may be somewhat skew, even if there isn't a contaminating process; in those cases the most discrepant observations may not have a lot of useful information in them about location and spread (e.g. take a heavy-tailed location-scale family parametric distribution and see how much weight is put on the extremes of the data in optimal estimation of location and scale).
However, note that even the most outlying observations are not completely ignored by median or interquartile range -- they still "count" in the sense that they contribute to the positioning of those quantiles.
The IQR is the center 50% of the observations. This stabilizes as you increase the sample size, but the first and last 25% do not:
set.seed(1047)
for(i in 1:6){
x <- rnorm(10^i)
boxplot(x, ylim = c(-4, 4), col = "steelblue", main = paste("n =", 10^i))
}
Why? For any continuous distribution from $-\infty$ to $+\infty$, as the sample size increases, so does the chance of observing something further from the center. But the center 50% of a unimodal distribution remains the same. Always extending the whiskers to the extremes makes the boxplot depend heavily on the sample size:
set.seed(1047)
for(i in 1:6){
x <- rnorm(10^i)
boxplot(x, ylim = c(-4, 4), col = "steelblue", main = paste("n =", 10^i), range = 0)
}
A boxplot based on the IQR is useful when you don't want your visual summary to be (as) dependent on the sample size. I assumed here that you're using a boxplot to visualize observations that come from unimodal distributions, because otherwise a boxplot is not that useful a summary anyway.