Skip to content

Measures of Spread

In this lesson you’ll learn to compute range, variance, and standard deviation, understand why we square the deviations, and know why the sample formula divides by n1n-1 instead of nn.

Two datasets can share a mean and be completely different.

Both of these have a mean of 50. One clusters tightly; the other sprawls. If they were test scores, the first class is uniformly prepared and the second contains both A students and failures. Reporting only the mean hides that entirely.

Spread (or dispersion, or variability) measures how far the data typically strays from the center. It’s every bit as important as the center, and often more actionable.

The simplest measure:

Range=maximumminimum\text{Range} = \text{maximum} - \text{minimum}

For 12, 15, 18, 22, 30: range =3012=18= 30 - 12 = 18.

It’s easy and nearly useless for serious work, because it depends entirely on the two most extreme values and ignores everything in between. One outlier sets it. Two datasets with the same range can have wildly different shapes.

To measure typical distance from the center, start with the deviation of each value:

xxˉx - \bar{x}

Natural next step: average the deviations. That fails immediately, because the deviations always sum to zero. The positives and negatives cancel exactly, since the mean is the balance point.

For 2, 4, 9 with xˉ=5\bar{x} = 5: deviations are 3,1,+4-3, -1, +4, summing to 0. Always.

Two fixes exist. You could take absolute values, giving the mean absolute deviation, which is perfectly sensible and occasionally used. Statistics instead squares the deviations, because squares behave well under calculus and algebra, which makes the whole theory of inference tractable later.

Variance is the mean of the squared deviations.

For a population:

σ2=(xμ)2N\sigma^2 = \frac{\sum (x - \mu)^2}{N}

For a sample:

s2=(xxˉ)2n1s^2 = \frac{\sum (x - \bar{x})^2}{n - 1}

Note the denominators differ. More on that below.

Variance has one annoying property: its units are squared. Variance of a set of heights in cm comes out in cm², which is not interpretable. That’s what the standard deviation fixes.

Standard deviation is the square root of the variance, which puts it back in the original units.

s=(xxˉ)2n1σ=(xμ)2Ns = \sqrt{\frac{\sum (x - \bar{x})^2}{n-1}} \qquad \sigma = \sqrt{\frac{\sum (x - \mu)^2}{N}}

Interpretation: roughly the typical distance of a value from the mean. If test scores have xˉ=75\bar{x} = 75 and s=8s = 8, a typical student is about 8 points from 75.

Properties worth knowing:

  • s0s \geq 0 always. It’s zero only when every value is identical.
  • Same units as the data.
  • Sensitive to outliers, since squaring magnifies large deviations.

The procedure never changes:

  1. Find the mean.
  2. Subtract the mean from each value to get deviations.
  3. Square each deviation.
  4. Add the squares.
  5. Divide by n1n-1 (sample) or NN (population). That’s the variance.
  6. Take the square root. That’s the standard deviation.

A useful check at step 2: your deviations must sum to zero. If they don’t, the mean is wrong.

This is the question everyone asks, and it has a real answer.

When you compute a sample variance, you use xˉ\bar{x} rather than the true μ\mu. But xˉ\bar{x} is itself computed from the same data, and it sits at the exact center of your sample, which makes your deviations slightly smaller than deviations from the real population mean would be. Dividing by nn therefore underestimates the population variance systematically.

Dividing by n1n-1 corrects for it exactly. The technical name is Bessel’s correction, and n1n-1 is called the degrees of freedom: once you know the mean and n1n-1 of the values, the last value is determined, so only n1n-1 of the deviations are genuinely free.

Practical note: for large nn the correction barely matters (n=1000n=1000 vs 999999 is a 0.1% difference). For small samples it matters a lot.

Use NN only when you genuinely have every member of the population.

To compare spread across different scales, use the coefficient of variation, the standard deviation as a percentage of the mean:

CV=sxˉ×100%CV = \frac{s}{\bar{x}} \times 100\%

A standard deviation of 5 is large for values near 20 and tiny for values near 5,000. The CV makes that comparison possible.

Example 1: Sample standard deviation, fully worked.

Data: 4, 8, 6, 10, 12 (a sample)

Solution.

Step 1, mean:

xˉ=4+8+6+10+125=405=8\bar{x} = \frac{4+8+6+10+12}{5} = \frac{40}{5} = 8

Steps 2–3, deviations and squares:

xxxxˉx - \bar{x}(xxˉ)2(x-\bar{x})^2
4−416
800
6−24
1024
12416

Deviations sum to 4+02+2+4=0-4+0-2+2+4 = 0

Step 4, sum of squares: 16+0+4+4+16=4016+0+4+4+16 = 40

Step 5, variance:

s2=4051=404=10s^2 = \frac{40}{5-1} = \frac{40}{4} = 10

Step 6, standard deviation:

s=103.16s = \sqrt{10} \approx 3.16

So values sit typically about 3.16 units from the mean of 8.

Example 2: Population versus sample on the same data.

Using the data above, what if those five values were the entire population?

Solution.

σ2=405=8σ=82.83\sigma^2 = \frac{40}{5} = 8 \qquad \sigma = \sqrt{8} \approx 2.83

Compare to s3.16s \approx 3.16. The sample formula gives a larger answer, which is the correction doing its job: it inflates the estimate to account for the fact that a sample underrepresents the population’s true spread.

Example 3: Same mean, different spread.

Two classes, both with mean 80.

Class A: 78, 79, 80, 81, 82 Class B: 60, 70, 80, 90, 100

Solution.

Class A squared deviations: 4,1,0,1,44, 1, 0, 1, 4, summing to 10.

sA=104=2.51.58s_A = \sqrt{\frac{10}{4}} = \sqrt{2.5} \approx 1.58

Class B squared deviations: 400,100,0,100,400400, 100, 0, 100, 400, summing to 1000.

sB=10004=25015.81s_B = \sqrt{\frac{1000}{4}} = \sqrt{250} \approx 15.81

Identical means, standard deviations differing by a factor of 10. Class A is uniformly at the level; Class B has a huge range of ability. Any teaching decision would differ completely between them, and the mean alone would never tell you.

Example 4: Coefficient of variation.

Compare variability: a set of adult heights (xˉ=170\bar{x} = 170 cm, s=8s = 8 cm) versus a set of annual incomes (xˉ=52,000\bar{x} = 52{,}000, s=21,000s = 21{,}000).

Solution.

CVheight=8170×100%4.7%CV_{\text{height}} = \frac{8}{170} \times 100\% \approx 4.7\% CVincome=21,00052,000×100%40.4%CV_{\text{income}} = \frac{21{,}000}{52{,}000} \times 100\% \approx 40.4\%

Income is roughly nine times more variable relative to its own scale. Comparing the raw standard deviations (8 versus 21,000) would have been meaningless, since the units differ.

Example 5: Zero standard deviation.

What does s=0s = 0 tell you?

Solution. Every value is identical. If s=0s = 0 then (xxˉ)2=0\sum(x-\bar{x})^2 = 0, and since squares can’t be negative, every single deviation must be zero, so every xx equals xˉ\bar{x}.

If you compute this on real data, suspect a mistake: a column of copied values, or a measurement instrument that’s stuck.

Investment risk is standard deviation, essentially by definition. Two funds with the same average return but different standard deviations are not the same product: the high-ss fund swings harder in both directions. “Volatility” in finance is the standard deviation of returns, and most portfolio theory is about trading expected return against it.

Manufacturing quality control is built on it. Six Sigma takes its name from requiring the tolerance limits to sit six standard deviations from the mean, so almost nothing falls outside spec. A process with a good mean and a large σ\sigma produces plenty of defective units.

Weather and climate comparisons need spread. Two cities can share an annual mean temperature while one is mild year-round and the other swings between extremes. San Diego and a continental city can average the same and feel nothing alike.

Grading on a curve uses the standard deviation to set boundaries, which is also where z-scores come from in the next lessons.

In A/B testing, the variance of your metric determines how large a sample you need. High-variance metrics (revenue per user, say) require far more traffic to detect a real effect than low-variance ones (click-through rate).

Why can't we simply average the deviations from the mean to measure spread?
For the sample 3, 5, 7, the sum of squared deviations is 8. What is the sample variance?
Why does the sample variance formula divide by n − 1 instead of n?
Two datasets both have a mean of 100. Dataset A has s = 2 and dataset B has s = 25. What does this tell you?
What does a standard deviation of exactly 0 indicate?