STAT 200 · Statistics for Economics
Spread: Variance and Standard Deviation
Measure how far data scatter around the middle with the range, variance and standard deviation, worked out step by step.
Key takeaways
- Spread describes how far values scatter, and two data sets with the same mean can differ enormously in spread.
- The range is quick to compute but depends entirely on the two most extreme values.
- The variance is an average of squared distances from the mean, using n − 1 in the denominator for a sample.
- The standard deviation is the square root of the variance and is measured in the same units as the data.
- Comparing spread across very different scales calls for a relative measure such as the coefficient of variation.
Two bus routes will get you to your new job. Both take 30 minutes on average. You pick one with a coin flip. Bad idea.
On Route A, the last five trips took 28, 29, 30, 31 and 32 minutes. On Route B they took 20, 25, 30, 35 and 40 minutes. If your shift starts exactly on the hour and your boss is the sort who looks at the clock, these are very different routes. Route B sometimes hands you ten free minutes and sometimes ten minutes of explaining.
The mean cannot tell them apart. You need a second number that says how much the values scatter. We will build that number with Marcus, who runs a small pizza delivery shop and is tired of customers asking, "So when will it really get here?"
The range: fast and fragile
The range is the largest value minus the smallest. For Route A it is 32 − 28 = 4 minutes. For Route B it is 40 − 20 = 20 minutes. Instantly, B looks five times as spread out.
The trouble is that the range listens to only two data points, usually the strangest two. One day with a flat tire could turn Route A's range into 40, even if every other trip stayed calm. And the range tends to grow as you collect more data, simply because you have more chances to see something wild. We want a measure that listens to everyone.
Distances from the mean
A natural idea is to ask how far each value sits from the mean. That distance, with its sign, is called a deviation: value minus mean.
For Route B, with mean 30, the deviations are −10, −5, 0, +5 and +10. Average them to get a typical distance and you hit a wall:
(−10) + (−5) + 0 + 5 + 10 = 0 They always add to zero, because the mean is the balance point of the data, as you saw in mean, median and mode. Negative and positive deviations cancel.
We need to get rid of the signs. You could drop them and average the absolute sizes. That gives the mean absolute deviation, which is sensible and easy to explain: for Route B it is (10 + 5 + 0 + 5 + 10) ÷ 5 = 6 minutes. The more common choice is to square each deviation. Squares are never negative, they give extra weight to big misses, and they have mathematical properties that make later tools work neatly.
Variance and standard deviation
The variance is the sum of the squared deviations divided by a count. The standard deviation is the square root of the variance. Which count you divide by depends on what your data are.
If your values are the entire population you care about, divide by n (often written N). The symbols are σ² for variance and σ for standard deviation.
If your values are a sample used to learn about something bigger, divide by n − 1. The symbols are s² and s.
The symbol Σ (capital "sigma") simply means "add up all of these."
Why n − 1? Your deviations are measured from the sample mean, which was computed from the same data and therefore sits as close to those values as any number can. So the squared distances come out a bit too small compared with distances from the true population mean. Dividing by a slightly smaller number nudges the answer up and corrects that tilt on average. Another way to see it: once you know the mean and n − 1 of the deviations, the last deviation is forced, since they must total zero. Only n − 1 of them are free to vary.
A worked example: delivery times
Marcus times eight deliveries in minutes beyond the promised window: 2, 4, 4, 4, 5, 5, 7, 9.
Step one, the mean: (2 + 4 + 4 + 4 + 5 + 5 + 7 + 9) ÷ 8 = 40 ÷ 8 = 5.
Step two, subtract the mean from each value. Step three, square. A table keeps you honest.
| Value | Deviation | Squared |
|---|---|---|
| 2 | −3 | 9 |
| 4 | −1 | 1 |
| 4 | −1 | 1 |
| 4 | −1 | 1 |
| 5 | 0 | 0 |
| 5 | 0 | 0 |
| 7 | 2 | 4 |
| 9 | 4 | 16 |
| Total | 0 | 32 |
Step four, divide. Step five, take the square root.
Treating the eight as a sample:
s² = 32 ÷ 7 ≈ 4.57
s = √4.57 ≈ 2.14 minutes
If these eight were the whole population:
σ² = 32 ÷ 8 = 4
σ = √4 = 2 minutes Marcus's eight deliveries are a sample of all his deliveries, so he reports s ≈ 2.14 minutes.
Reading a standard deviation
Variance comes out in squared units. "4.57 square minutes" means nothing to a hungry customer. Taking the square root brings you back to minutes, which is why the standard deviation is the one usually reported.
Think of it as a typical distance from the mean. It is not exactly the average distance, but it is in that neighborhood. A standard deviation of zero means every value is identical. It can never be negative.
Now compare the bus routes. Route A has squared deviations 4, 1, 0, 1, 4, totaling 10. So s² = 10 ÷ 4 = 2.5 and s ≈ 1.58 minutes. Route B has 100, 25, 0, 25, 100, totaling 250. So s² = 250 ÷ 4 = 62.5 and s ≈ 7.91 minutes.
Route B's times scatter about five times as widely as Route A's. Hypothetical example: the numbers are made up to show the method, not a quote or an average.
Notice that B's deviations are exactly five times A's. So its standard deviation is five times as large, while its variance is 5² = 25 times as large.
A rule of thumb for bell shapes
If a distribution is roughly symmetric and bell shaped, about 68% of values fall within one standard deviation of the mean, and about 95% within two. A delivery measure with mean 5 and standard deviation 2 would, if bell shaped, put about 95% of cases between 1 and 9. The word "if" is doing heavy lifting. Lopsided data can break this rule badly. You will study the bell curve properly in the normal distribution and z-scores.
A looser guarantee, known as Chebyshev's inequality, holds for any shape: at least 1 − 1 ÷ k² of the values lie within k standard deviations of the mean, for k greater than 1. With k = 2, that is at least 75%.
How unusual is one delivery?
The standard deviation also works as a measuring stick for a single value. Suppose a delivery runs 9 minutes past the window. Its deviation from the mean is 9 − 5 = 4 minutes. Divide by the standard deviation of about 2.14, and you get 4 ÷ 2.14 ≈ 1.87. That delivery sits not quite two standard deviations above the mean.
Why is that helpful? Because "4 minutes late compared with usual" means different things for different shops. At a shop with a standard deviation of 10 minutes, 4 extra minutes is nothing, just 0.4 of a standard deviation. At a shop with a standard deviation of 1 minute, it is 4 standard deviations, and someone should check whether the driver is all right.
Marcus can use this to make a promise he can keep. Quoting only the mean of 5 extra minutes would disappoint many customers, since some deliveries run well beyond it. Padding the quote by a couple of standard deviations covers most of the slow ones, at the price of sounding slower. The right balance is a business decision. The standard deviation tells him what he is trading.
Shifting, stretching and comparing
Add 3 minutes to every delivery and the mean rises by 3, but the standard deviation stays the same. Everything slid together, so the distances did not change. Double every value and the standard deviation doubles, while the variance is multiplied by 4.
What if two data sets live on different scales? A standard deviation of $5 is huge for the price of a cup of coffee and trivial for the price of a car. The coefficient of variation divides the standard deviation by the mean:
Coffee: mean $4, s = $1 → 1 ÷ 4 = 25%
Cars: mean $30,000, s = $3,000 → 3,000 ÷ 30,000 = 10% In relative terms, these made-up coffee prices vary more than the car prices. Use this only for quantities with a true zero and a positive mean. It behaves wildly when the mean is near zero.
Economists care about spread because it often stands for risk or instability. Investors use standard deviation as one measure of how much returns jump around. Macroeconomists compare how bumpy growth is across periods, part of the story of booms and recessions.
A common mistake: the square root shortcut
Marcus has a pickup step with standard deviation 3 minutes and a driving step with standard deviation 4 minutes. Is the total standard deviation 7?
Not in general. If the two steps are independent (knowing one tells you nothing about the other), the variances add:
Variance of total = 3² + 4² = 9 + 16 = 25
Standard deviation = √25 = 5 minutes Five, not seven. Long pickups and long drives do not always arrive together, so they partly offset. If the two are linked, you must also account for how they move together, the subject of covariance and correlation.
Two other slips are common. Rounding the mean too early can distort the squares, so keep extra decimals until the end. And forgetting the square root leaves you reporting a variance with the confidence of a standard deviation.
Finally, remember that squaring makes outliers loud. One wild value can inflate the standard deviation dramatically. When that happens, you want the sturdier tools in percentiles, skew and outliers.
Words to know
Range the largest value in a data set minus the smallest.
Deviation a value minus the mean of its data set.
Variance the sum of squared deviations divided by n for a population or n − 1 for a sample.
Standard deviation the square root of the variance, expressed in the original units.
Mean absolute deviation the average of the distances from the mean, ignoring their signs.
Coefficient of variation the standard deviation divided by the mean.
Degrees of freedom the number of values that are free to vary after a constraint such as a known mean.
Check yourself
- What is the range of 12, 7, 19, 10 and 15?
- Find the sample variance and standard deviation of 2, 4 and 6.
- Why do the deviations from the mean fail as a measure of spread when you simply average them?
- If every price in a data set rises by $10, what happens to the standard deviation?
- A bell-shaped set of test scores has mean 70 and standard deviation 8. About what share lies between 54 and 86?
- Explain why a sample variance divides by n − 1 instead of n.
Show the answers
- The range is 19 − 7 = 12.
- The mean is 4, the squared deviations are 4, 0 and 4, so the variance is 8 ÷ 2 = 4 and the standard deviation is 2.
- Positive and negative deviations cancel exactly, so their sum and average are always zero.
- It does not change, because every value and the mean shift by the same $10.
- The limits are two standard deviations either side of 70, so about 95%.
- Deviations measured from the sample mean tend to be too small, and dividing by n − 1 corrects this on average.