In descriptive statistics, the interquartile range, also called the midspread, middle 50%, or Hspread, is a measure of statistical dispersion, being equal tothe difference between 75th and 25th percentiles, or between upper and lower quartiles, IQR = Q3 − Q1. In other words, the IQR is the first quartile subtracted from the third quartile; these quartiles can be clearly seen on a box plot on the data. It is a trimmed estimator, defined as the 25% trimmed range, and is a commonly used robust measure of scale. The IQR is a measure of variability, based on dividing a data set into quartiles. Quartiles divide a rank-ordered data set into four equal parts. The values that separate parts are called the first, second, and third quartiles; and they are denoted by Q1, Q2, and Q3, respectively.
The IQR of a set of values is calculated as the difference between the upper and lower quartiles, Q3 and Q1. Each quartile is a median calculated as follows. Given an even 2n or odd 2n+1 number of values The second quartile Q2 is the same as the ordinary median.
This means the 1.5*IQR whiskers can be uneven in lengths.
Distributions
The interquartile range of a continuous distribution can be calculated by integrating the probability density function. The lower quartile, Q1, is a number such that integral of the PDF from -∞ to Q1 equals 0.25, while the upper quartile, Q3, is such a number that the integral from -∞ to Q3 equals 0.75; in terms of the CDF, the quartiles can be defined as follows: where CDF−1 is the quantile function. The interquartile range and median of some common distributions are shown below
Distribution
Median
IQR
Normal
μ
2 Φ−1σ ≈ 1.349σ ≈ σ
Laplace
μ
2b ln ≈ 1.386b
Cauchy
μ
2γ
Interquartile range test for normality of distribution
The IQR, mean, and standard deviation of a population P can be used in a simple test of whether or not P is normally distributed, or Gaussian. If P is normally distributed, then the standard score of the first quartile, z1, is −0.67, and the standard score of the third quartile, z3, is +0.67. Given mean = X and standard deviation = σ for P, if P is normally distributed, the first quartile and the third quartile If the actual values of the first or third quartiles differ substantially from the calculated values, P is not normally distributed. However, a normal distribution can be trivially perturbed to maintain its Q1 and Q2 std. scores at 0.67 and −0.67 and not be normally distributed. A better test of normality, such as Q-Q plot would be indicated here.
Outliers
The interquartile range is often used to find outliers in data. Outliers here are defined as observations that fall below Q1 − 1.5 IQR or above Q3 + 1.5 IQR. In a boxplot, the highest and lowest occurring value within this limit are indicated by whiskers of the box and any outliers as individual points.