Measures of Spread: IQR and Standard Deviation
Measure variability with the range, quartiles, IQR and standard deviation, draw boxplots, flag outliers with the 1.5 × IQR rule and rescale data.
Welcome back!
Step 1 of 12Learn
Same average, different worlds
City A and City B both have an average daily high temperature of 64°F over the year. Should you pack the same clothes for a visit?
Not necessarily. In City A, highs stay between 55°F and 72°F all year, the kind of mild coastal climate where a light jacket always works. In City B, highs swing from 20°F in January to 98°F in July. Same center, completely different experience.
Center alone never tells the full story. You also need spread, or variability: how much the values differ from each other.
The simplest measure is the range: maximum − minimum. City A's range is 72 − 55 = 17 degrees; City B's is 98 − 20 = 78 degrees.
The range is easy to compute but fragile. It depends on just two values, the most extreme ones, so a single outlier can blow it up. One freak heat wave could double a city's range without changing what most days feel like.
Better measures use more of the data. This lesson covers the two you'll use most:
- the interquartile range (IQR), which goes with the median and resists outliers;
- the standard deviation, which goes with the mean and is the foundation of the normal distribution and inference.
Step 2 of 12Practice · Chart
Monthly highs: same 64°F average, very different spread
Tap the month where the two cities differ the most.
Tap the point that answers the question, then press Check.
| Item | City A | City B |
|---|---|---|
| Jan | 55 °F | 20 °F |
| Feb | 57 °F | 28 °F |
| Mar | 59 °F | 44 °F |
| Apr | 62 °F | 60 °F |
| May | 65 °F | 76 °F |
| Jun | 68 °F | 90 °F |
| Jul | 71 °F | 98 °F |
| Aug | 72 °F | 96 °F |
| Sep | 70 °F | 88 °F |
| Oct | 66 °F | 72 °F |
| Nov | 62 °F | 56 °F |
| Dec | 61 °F | 40 °F |
Step 3 of 12Learn
Quartiles, the IQR and the five-number summary
Quartiles split sorted data into four parts with about a quarter of the values in each.
- Q1 (first quartile) is the median of the lower half of the data.
- Q2 is the median.
- Q3 (third quartile) is the median of the upper half.
The interquartile range is IQR = Q3 − Q1: the spread of the middle 50% of the data. Because it ignores the top and bottom quarters, extreme values don't affect it. The IQR is resistant, just like the median.
Example. Eleven sorted values: 3, 7, 8, 9, 12, 13, 15, 18, 21, 24, 45.
- Median: the 6th value, 13.
- Lower half (the five values below the median): 3, 7, 8, 9, 12, so Q1 = 8.
- Upper half: 15, 18, 21, 24, 45, so Q3 = 21.
- IQR = 21 − 8 = 13.
When n is odd, leave the median out of both halves, as here. When n is even, split the data exactly in half. (Software packages sometimes use slightly different quartile rules, so small differences from a calculator are normal.)
The five-number summary is minimum, Q1, median, Q3, maximum: here 3, 8, 13, 21, 45. Those five numbers describe the center, spread and rough shape of any distribution.
Step 4 of 12Practice · Work it out
Find the IQR of these eight values: 2, 5, 6, 8, 10, 12, 15, 20.
Step 5 of 12Learn
Boxplots and the 1.5 × IQR rule
A boxplot draws the five-number summary. A box stretches from Q1 to Q3 with a line at the median, and whiskers extend to the smallest and largest values that are not outliers.
How do you decide what counts as an outlier? A widely used rule flags any value more than 1.5 × IQR beyond the quartiles:
- Lower fence = Q1 − 1.5 × IQR
- Upper fence = Q3 + 1.5 × IQR
In the example, IQR = 13, so 1.5 × IQR = 19.5. The fences are 8 − 19.5 = −11.5 and 21 + 19.5 = 40.5. The value 45 lies beyond the upper fence, so it's an outlier, drawn as a separate dot. The upper whisker stops at 24, the largest non-outlier.
Boxplots shine when comparing groups. Put several side by side on one scale and you instantly see which group has the higher median, which is more spread out, and which has outliers.
Reading skew from a boxplot: if the right whisker and the right part of the box are longer than the left, the data are skewed right.
A boxplot hides some things, though. It can't show two peaks (a bimodal distribution looks like any other box), and it says nothing about how many data points there are. For small data sets, a dotplot often shows more.
Step 6 of 12Practice · Work it out
A data set has Q1 = 20 and Q3 = 32. Using the 1.5 × IQR rule, what is the upper fence, above which values are outliers?
Step 7 of 12Learn
Standard deviation
The standard deviation measures the typical distance of the values from the mean. It's the most widely used measure of spread.
Step by step, for the sample 2, 4, 6, 8:
- Find the mean: x̄ = 20/4 = 5.
- Find each deviation from the mean: −3, −1, 1, 3. (They always add up to 0, which is why we can't just average them.)
- Square each deviation: 9, 1, 1, 9.
- Add them and divide by n − 1: (9 + 1 + 1 + 9)/3 = 20/3 ≈ 6.67. This is the variance, s².
- Take the square root: s = √6.67 ≈ 2.58.
The formula is s = √( Σ(x − x̄)² / (n − 1) ).
Why divide by n − 1? A sample's values tend to sit a little closer to their own mean than to the true population mean, so dividing by n would underestimate the spread. Using n − 1 corrects for that. For a whole population, you divide by N and write σ.
Why square, then take a root? Squaring removes negative signs and gives extra weight to large deviations; the square root brings the answer back to the original units. If the data are in minutes, s is in minutes too.
A standard deviation of 0 means every value is identical. The larger s is, the more spread out the data. Like the mean, s is not resistant: one outlier can inflate it a lot.
Step 8 of 12Try the calculator
Standard deviation calculator (5 values)
Enter five values and see the mean and sample standard deviation. Try making one value an outlier, or making all five equal, and watch s respond.
- Mean x̄
- 6
- Sample variance s²
- 10
- Sample standard deviation s
- 3.162
Step 9 of 12Practice · Choose one
Which data set has the largest standard deviation?
Step 10 of 12Learn
Choosing and transforming
Which summary should you use?
- Roughly symmetric, no outliers: mean and standard deviation.
- Skewed or with outliers: median and IQR (the five-number summary).
Mixing them, like reporting a median with a standard deviation, isn't wrong, but pairing each center with its natural spread measure keeps a description consistent.
What happens when you change units? Suppose you convert or adjust every value in a data set.
- Adding a constant to every value (everyone gets 5 bonus points) shifts the center by that constant but doesn't change the spread. The mean and median go up 5; the standard deviation, IQR and range stay the same, because the distances between values haven't changed.
- Multiplying by a constant (converting inches to centimeters, × 2.54) multiplies both the center and the spread by that constant. A standard deviation of 3 inches becomes 7.62 cm.
Temperature conversion combines both: °F = 1.8 × °C + 32. A city's mean of 20°C becomes 1.8 × 20 + 32 = 68°F, but a standard deviation of 5°C becomes 1.8 × 5 = 9°F. The + 32 doesn't affect spread at all.
These rules are a fast check on your intuition, and they're exactly what makes z-scores in the next module work.
Step 11 of 12Practice · Sort into groups
A teacher adds 5 points to every student's score. Which summaries change?
Tap an item, then tap its group (or drag it there).
Step 12 of 12Practice · Choose one
Exam scores have mean 72 and standard deviation 8. The teacher then multiplies every score by 1.25 to rescale the exam out of 125 points. What are the new mean and standard deviation?
Lesson complete!