Range and interquartile range
The range and interquartile range are the simplest ways to describe how spread out data are. One looks at the whole span, the other at the middle half. Together they give a quick sense of a variable’s shape, and they’re the building blocks of the box plot.
The range
Range = maximum − minimum
Fuel economy for the 32 cars in R’s mtcars dataset runs from 10.4 to 33.9 mpg, a range of 23.5 mpg.
It’s easy to calculate and to understand, but it depends on just two values, both of them extremes. A single unusual case can double it, and it tends to grow as you collect more data. Report the minimum and maximum as context, and use the IQR or SD as your main measure of spread.
Quartiles
Quartiles split sorted data into four equal parts:
- Q1 (first quartile, 25th percentile): a quarter of values are below it.
- Q2 (median, 50th percentile): half are below it.
- Q3 (third quartile, 75th percentile): three-quarters are below it.
The interquartile range
IQR = Q3 − Q1
For mpg, Q1 = 15.43 and Q3 = 22.80, so IQR = 7.38. The middle half of these cars get between about 15 and 23 mpg. The median is 19.20.
How to find quartiles by hand
- Sort the values from smallest to largest.
- Find the median (Q2).
- Q1 is the median of the lower half, and Q3 is the median of the upper half.
For 1, 3, 4, 6, 8, 9, 12, 15: the median is (6 + 8) / 2 = 7. The lower half is 1, 3, 4, 6, so Q1 = 3.5. The upper half is 8, 9, 12, 15, so Q3 = 10.5. IQR = 7.
Why software gives slightly different quartiles
There are several accepted ways to interpolate quartiles. R’s quantile() offers nine. R and Excel’s QUARTILE.INC default to the same one (R’s “type 7”). SPSS uses a different default, so small discrepancies between packages are normal and don’t mean anything is wrong. Analytika uses type 7, so its quartiles match R’s defaults.
Why the IQR is robust
The IQR ignores the top and bottom 25% of values, so extremes can’t pull it around. If the most efficient car got 339 mpg instead of 33.9, the range would explode, but the IQR wouldn’t change at all. That’s why the IQR, with the median, is the standard summary for skewed data such as incomes, house prices and reaction times.
The 1.5 × IQR rule for outliers
A common convention flags values more than 1.5 × IQR below Q1 or above Q3 as possible outliers. For horsepower in mtcars: Q1 = 96.5, Q3 = 180, IQR = 83.5, so the upper fence is 180 + 1.5 × 83.5 = 305.25. One car, the Maserati Bora at 335 hp, lies beyond it. See outliers for what to do next. A flag means “look at this”, not “delete this”.
Box plots
A box plot draws the IQR as a box with a line at the median. Whiskers extend to the most extreme values within the 1.5 × IQR fences, and any points beyond are plotted individually. It shows centre, spread, skew and outliers at a glance, and it’s an excellent way to compare groups side by side.
Reporting
Fuel economy had a median of 19.20 mpg (IQR = 15.43–22.80; range 10.4–33.9).
Some styles give the IQR as a single number (7.38). Others give the two quartiles, which tells the reader more. For the full set of spread measures, see measures of variability.
More in Descriptive statistics
Try it with the free tools
Run this on your own data
Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.