Interactive statistics
Module 1: Descriptive statistics
Progresscompleted 0 / 63

Spread and standard deviation

The "Mama John's" chain has grown to two locations. The average salary at both is exactly 35k: at pizzeria A everyone earns roughly the same, at pizzeria B some earn much less, some much more. Same mean โ€” completely different teams. To catch that difference you need a second characteristic: how far the values scatter around the center.

Pizzeria A (even)ฯƒ = 6.1 k263033374044Pizzeria B (contrasting)ฯƒ = 14.5 k132333374757
Pizzeria A (even): mean 35.0 k, ฯƒ 6.1 kPizzeria B (contrasting): mean 35.0 k, ฯƒ 14.5 k

Two pizzerias, both with an average salary of exactly 35k โ€” the dashed line sits in the same spot in both rows. But the points of Pizzeria B are scattered noticeably wider than A's. To the right of each row is its ฯƒ ("sigma"), the measure of spread this whole lesson is about.

What it means

Back to our two pizzerias. Both have the same average salary โ€” 35k โ€” but ฯƒ is about 6 at Pizzeria A and about 14 at Pizzeria B. The center coincides, yet life inside is completely different: at Pizzeria A salaries are predictable and stay close together, at Pizzeria B the gap between people is huge.

Hence the main takeaway of the lesson: the center is almost never looked at alone. "Mean plus spread" is the minimal honest pair that describes data: where it concentrates and how widely it diverges around that center.

Where it shows up

Spread is everywhere that not only the magnitude but also the stability matters. Two couriers deliver in 30 minutes on average, but one stays within 25โ€“35 while the other jumps from 10 to 60: same mean, different reliability โ€” and ฯƒ shows it at once.

The same underlies the volatility of stocks (that is the ฯƒ of returns: the larger, the riskier) and quality control in manufacturing, where "beyond 3ฯƒ" is treated as a defect (why exactly 3 โ€” we'll see in the normal distribution lesson).

Next we'll look at what shapes data takes at all. There the mean and ฯƒ come into their own together: for a bell-shaped, "normal" distribution they almost fully define it.

Definitions

Deviationxiโˆ’xห‰x_i - \bar{x}
The difference between a single value and the mean. It shows how far that value sits from the center, and in which direction.
In plain words: how far a particular value has strayed from the mean.
Varianceฯƒ2=โˆ‘(xiโˆ’xห‰)2N\sigma^2 = \dfrac{\sum (x_i - \bar{x})^2}{N}
The mean of the squared deviations from the mean. Squaring removes the signs and penalizes distant values more heavily. It is measured in squared original units, so it is usually not read directly โ€” you take its square root instead. The formula above is for the whole population; for a sample (i.e. almost always) it is adjusted slightly โ€” see the optional deep dive below.
In plain words: the average squared deviation from the mean.
Standard deviation (ฯƒ)ฯƒ=โˆ‘(xiโˆ’xห‰)2N\sigma = \sqrt{\dfrac{\sum (x_i - \bar{x})^2}{N}}
A measure of how widely the values are scattered around their mean. It is the square root of the variance, so it is expressed in the same units as the data and reads as the "typical deviation from the mean".
In plain words: the typical distance from a point to the mean, in ordinary units.
Coefficient of variationCV=ฯƒxห‰CV = \dfrac{\sigma}{\bar{x}}
The standard deviation divided by the mean โ€” the spread as a fraction (or percentage) of the mean. It is independent of the units, so it lets you compare variability across quantities of different scale.
In plain words: the spread as a percentage of the mean โ€” comparable across different quantities.

When the method lies (assumptions)

Standard deviation relies on the mean, so it inherits its weakness: one strong outlier inflates ฯƒ so much that the "typical spread" stops describing typical data. For skewed quantities (incomes, response times) it is more honest to look at spread through percentiles.

Deep dive: the math and the mechanism (optional)

Working through the derivation below isn't required. For practice, one fact is enough to remember: if you're computing variance or ฯƒ on a sample (which is almost always the case), the denominator should be nโˆ’1, not n.

The formula in the definition above is for the whole population, where the mean is known in advance and doesn't depend on the data itself. In practice, though, we compute the mean from the very same sample we're measuring spread on, and that quietly fits the data to its own mean. Because of this, the sum of squared deviations comes out a bit smaller than it honestly should be, and the /N formula systematically underestimates the population's spread.

To remove this bias, sample variance uses nโˆ’1 in the denominator instead of n. One way to see why: once you've fixed the mean from n values, only nโˆ’1 of them are free to vary โ€” the last one is already determined, since you can always back it out from the rest plus the mean. Hence the name: degrees of freedom.

This is exactly why the same numbers sometimes give a different ฯƒ in different tools. Excel and pandas divide by nโˆ’1 by default (the sample calculation), while numpy divides by n by default, and you have to explicitly ask for nโˆ’1. It's not a bug or a discrepancy โ€” it's two different questions: how spread out is THIS data (n), or what does this data say about spread in the whole population (nโˆ’1). In analytics you almost always need the second answer.

Next โ†’
Breakdowns like this live in the channel

Data analytics in plain words: how to count metrics, how not to fool yourself in an A/B test, what gets asked in interviews and how this site gets built. The channel is in Russian.

Open the Telegram channel