Quartiles describe positions within an ordered dataset. The first quartile, median and third quartile locate its lower, middle and upper portions. The interquartile range, or IQR, subtracts the first quartile from the third and summarises the spread of the central part of the data.
For finite datasets, quartile algorithms are not universal. A calculator and a classroom method can return different values while both implement stated conventions correctly. This page fixes one convention and uses it consistently in the companion box-plot and outlier lessons.
On this page
The convention used in this set
Sort the observations in ascending order. Find the median. Split the data into lower and upper halves; if the sample size is odd, exclude the overall median from both halves. The median of the lower half is and the median of the upper half is .
This is the median-of-halves convention with the overall median excluded when necessary. It applies to the teaching lists here, which have at least four observations. Other resources or software may interpolate percentiles differently. Always report the method when a numerical difference matters.
Statistics Canada’s quartile introduction develops ordered-data measures of spread. The explicit algorithm above is the convention selected for the CTS examples, not a claim that every source uses it.
Work through an even-sized dataset
Use the ten synthetic journey times, in minutes:
The median averages the fifth and sixth observations:
The lower half is , whose median is 12. The upper half is , whose median is 20. Therefore
and
The IQR is a difference, so its unit is the original unit. It is not and is not the entire range, which here is minutes.
Quartiles locate the middle half of the ordered data
Diagram explanation and exact data
The lower five values are 8, 10, 12, 12 and 14; the upper five are 16, 18, 20, 22 and 48. Their medians are 12 and 20. The overall median is the average of the fifth and sixth values.
| Position | Value | Half |
|---|---|---|
| 1 | 8 | Lower |
| 2 | 10 | Lower |
| 3 | 12 | Lower |
| 4 | 12 | Lower |
| 5 | 14 | Lower |
| 6 | 16 | Upper |
| 7 | 18 | Upper |
| 8 | 20 | Upper |
| 9 | 22 | Upper |
| 10 | 48 | Upper |
Work through an odd-sized dataset
For the illustrative list , the overall median is 6. Exclude it from both halves. The lower half is and the upper half is . Thus
For comparison, an interpolation rule can place the th quantile at position in the sorted list. With , the positions for and are 2.5 and 5.5. Interpolating halfway between the neighbouring observations gives and , with IQR 5. The records have not changed; the definition of the sample quantile has.
Do not mix quartiles from one algorithm with a box plot or answer key calculated using another without explaining the difference.
What “the middle 50%” means
Quartiles are intended to locate quarter divisions of a distribution. For a finite sample with ties, saying that exactly 25% of observations are strictly below is often false.
In the journey-time example, two observations are below 12, but four are at or below 12. That is 20% strictly below and 40% at or below, not a contradiction. Two observations share the quartile value.
The interval from to describes the central spread in the selected convention. It should not be interpreted as a probability guarantee for a new individual or as a confidence interval for a population parameter.
Compare range and IQR
The range responds directly to the minimum and maximum. The IQR depends on the central order statistics. If the largest journey time changes from 48 to 80, the range becomes minutes, while , and the IQR remain 12, 20 and 8.
This resistance to one extreme change is useful for skewed data. It does not mean the IQR records everything important about the tails. A report might include the median and IQR together with a plot and a note about unusually long journeys.
Adding the same constant to every value shifts both quartiles by that constant but leaves the IQR unchanged. Multiplying all values by a positive factor multiplies the quartiles and the IQR by that factor. With a negative factor, order reverses; the new lower quartile comes from the old upper quartile.
Use fences as a screening rule
A common descriptive rule places inner fences at
For the journey times,
The value 48 is strictly above 32, so the rule flags it. The number 32 is a fence, not an observed journey time. In the modified box plot used in this set, the upper whisker ends at 22, the largest observed value still within the fence.
An observation exactly on a fence is not flagged by the strict “beyond the fence” rule. A flagged value is not automatically erroneous. Outliers explains how to investigate it.
Quartiles in grouped data and reports
Exact sample quartiles generally cannot be recovered from broad histogram bins alone. A bin can tell you that a central observation lies between two boundaries without identifying its precise value. Estimates based on interpolation within bins need additional assumptions.
When comparing published IQRs, check the variable, unit, population, sample size and quantile convention. Weighted survey quantiles can also differ from unweighted quantiles calculated directly from the responding records.
Practice questions
- Using this page’s convention, find , the median, and the IQR for .
- With and , calculate the 1.5 IQR fences.
- Does a value exactly equal to the upper fence count as an outlier under this set’s rule?
Check your answers
- Exclude the median 6 from the halves. Their medians are 3 and 9, giving , , and IQR 6.
- The IQR is 8. The fences are and .
- No. The rule flags values strictly below the lower fence or strictly above the upper fence. It is a screening convention, not a test that establishes data error.
Related topics
Box Plots turns these summaries into a display. Outliers develops the investigation process, while Mean, Median and Mode helps choose a complementary measure of centre.
