Quartiles and the Interquartile Range
Split the sorted data into four, then measure the middle half: a spread that a single extreme value cannot inflate.
- Find the three quartiles of a small sorted dataset by hand
- Compute the interquartile range and say what it measures
- Use the 1.5 × IQR rule to flag likely outliers
- Draw and read a five-number summary and a box plot
What it means
The median splits sorted data in half. Split each half again and you have quartiles: three cut points that divide the data into four groups of roughly equal size.
- , the first quartile: 25% of values are at or below it.
- , the second quartile: the median, 50% below.
- , the third quartile: 75% below.
The interquartile range is the distance between the outer two:
It is the width of the middle half of the data — the range that contains the typical case and ignores both tails.
Why it adds something
The standard deviation squares its distances, so one extreme value can dominate it. The IQR uses positions, exactly like the median, so no single value — however extreme — can move it. Reach for the IQR when the tails of the data are long or when you suspect a few entries are wrong but have not confirmed it.
The IQR also gives a principled way to say “this value is suspiciously far out”: the 1.5 × IQR rule. Anything below or above is flagged. It is a convention, not a law, but it is the one box plots draw.
Worked by hand
Eleven sorted waiting times in minutes:
Step 1 — the median. With the middle position is 6, so .
Step 2 — split into halves. Below the median: . Above: .
Step 3 — the quartiles are the medians of those halves. Each half has five values, so and .
Step 4 — the IQR.
Step 5 — the outlier fence. Lower fence ; upper fence . The value 40 lies above 29, so it is flagged. The standard deviation of this data is about 10.6, which is inflated by that same 40; the IQR is unmoved.
Note that the fences are not “delete this value” instructions. They mark a value worth checking: a typo, a different unit, or a genuinely unusual case.
The five-number summary and the box plot
Five numbers describe the shape without any assumption about it:
A box plot draws exactly those: a box from to with a line at the median, whiskers to the most extreme values inside the fences, and points for anything beyond. The width of the box is the IQR, so the plot makes spread visible at a glance.
You can build one and drag the values in the GeoGebra box-plot tool; watching the box stay put while a whisker stretches is the clearest way to see what the IQR tolerates.
The same thing in Python
times = [2, 4, 4, 5, 7, 9, 11, 12, 14, 18, 40]
import statistics as st
q1 = st.quantiles(times, n=4) # [4, 9, 14]
iqr = q1[2] - q1[0]
print(q1, iqr) # [4, 9, 14] 10
low, high = q1[0] - 1.5 * iqr, q1[2] + 1.5 * iqr
print(low, high) # -11.0 29.0
print([t for t in times if t < low or t > high]) # [40]With pandas the same quantities come from describe(), which prints the five-number summary plus the mean and standard deviation in one call:
import pandas as pd
s = pd.Series(times)
print(s.describe())When to use it
- Skewed data: incomes, prices, latencies, anything with a long tail.
- Suspicious data: the fence rule finds entries worth checking before they distort a mean.
- Comparing groups with different sample sizes, where a box plot per group is more informative than two means.
Limitations
- It throws away the tails. Two datasets can share a five-number summary and differ in everything else.
- Quartile definitions differ. Different software computes and slightly differently for small samples, so a hand answer can be one step off a package’s. The IQR is stable enough for practical use.
- No arithmetic. Like the median, it does not add across groups.
- Small samples give coarse quartiles. With fewer than about eight values the quartiles are barely more informative than the min and max.
Common pitfalls
- Not sorting first. Quartiles are positional like the median; unsorted data gives nonsense.
- Reading a box plot’s whiskers as min and max. Whiskers stop at the fence; points beyond are drawn separately.
- Treating an outlier flag as an error. It is a prompt to look, not a verdict.
- Comparing IQRs across units. Minutes and dollars are not comparable; use the coefficient of variation if you must compare spread.
🧩 Challenges
🧩 Challenge, think first, then reveal
Data: . Compute the IQR and the standard deviation. Which summary describes the middle better, and what would you report to a reader?
💡 Answer: $Q_1 = 3$, $Q_3 = 8$, IQR $= 5$; the mean is 14.5 and the standard deviation is about 29.4, both dominated by the 100. Report the median (5.5) and the IQR (5), and note the 100 as a separate observation. The five-number summary stays honest where the mean and SD describe a dataset that does not exist.
🤔 Socratic Questions
- Why can no single value change the IQR the way it changes the range?
- If the box in a box plot is very narrow but the whiskers are long, what does the data look like?
- Why is the 1.5 multiplier a convention rather than a rule derived from the data?
- What does a box plot show that a histogram does not, and what does it hide?
✅ Quick check
1. What does the interquartile range measure?
2. Q1 = 20 and Q3 = 50. Above what value does the 1.5 × IQR rule flag a point?