On Day 4 we measured spread with range, variance, standard deviation, MAD and the IQR. They all share one blind spot: they report spread in the data's own units, with no sense of scale. Today we fix that by measuring spread relative to the centre.
Is a standard deviation of 200 big or small?
Think about running late. Being 5 minutes late for a 10-minute video call means you missed half of it. Being 5 minutes late for a 10-hour flight's arrival is something nobody notices. The delay is the same; what changes is the size of the thing it's measured against.
Spread works the same way. An SD of 200 means something completely different depending on the mean:
- If the mean is 150, an SD of 200 is enormous. A typical value sits further from the average than the average is from zero.
- If the mean is 2,000,000, an SD of 200 is a rounding error. The values are packed extremely tightly.
That's the core problem with absolute measures: on their own, they never tell you what "big" or "small" means. It gets even harder when two datasets are in different units altogether. Is an SD of 5 cm in people's heights more or less than an SD of 8 kg in their weights? There's no way to compare centimetres with kilograms directly.
A real dataset: the iris flowers
The iris dataset is one of the oldest datasets in statistics. It holds measurements of 150 iris flowers, collected by the botanist Edgar Anderson and made famous by the statistician Ronald Fisher in 1936. It ships with scikit-learn, so you can run this yourself:
Look at the SDs alone and the two measurements seem about equally variable: 0.83 cm against 0.76 cm. But sepal length averages 5.84 cm while petal width averages only 1.20 cm. Relative to its own size, petal width varies more than four times as much (64% against 14%). That last column is today's first tool.
Relative measures of dispersion divide a measure of spread by a measure of centre. The units cancel out, leaving a pure ratio (often shown as a percentage), so you can compare datasets on different scales, or even in different units. We'll cover the two common ones:
- Coefficient of variation (CV): the standard deviation relative to the mean
- Coefficient of quartile deviation (CQD): the IQR relative to the quartiles, a robust cousin of the CV
Absolute vs. relative at a glance
| Absolute measures | Relative measures | |
|---|---|---|
| Output | A value in the data's units ($, cm, ms) | A unitless ratio or percentage |
| Good for | Describing spread within one dataset | Comparing spread across datasets with different scales or units |
| Examples | Range, variance, SD, MAD, IQR | CV, CQD |
| Main limitation | Can't be fairly compared across different scales | Only valid for positive, ratio-scale data (more on this below) |
Coefficient of variation (CV)
The coefficient of variation expresses the standard deviation as a percentage of the mean. It answers one question: how big is the spread, compared to the average?
A higher CV means more variability relative to the mean; a lower CV means the data is more consistent relative to its own average. Because the SD and the mean are in the same units, those units cancel, which is what lets you compare a CV for heights in centimetres with a CV for weights in kilograms. (Some fields also call it the relative standard deviation, or RSD.)
Worked example: which company pays more consistently?
A recruiter wants to know which of two companies offers more consistent salaries.
Judge by the SD alone and Company B looks more variable: its SD of $7,906 is about double Company A's $3,808. But a $7,900 spread around a $160,000 average is a smaller deal than a $3,800 spread around a $50,000 one. The CV makes that explicit: 4.94% for B against 7.62% for A. Relative to what people there typically earn, Company A's salaries are the less consistent ones.
There's no universal cut-off. A CV of 10% might be excellent for monthly sales and alarming for a laboratory scale. Fields set their own standards, and the most useful comparisons are between similar things: two machines making the same part, two branches of the same shop, the same metric this month and last month.
Real case: how drug labs judge their measurements
When a pharmaceutical lab develops a test to measure a drug's concentration in blood samples, regulators want proof that the test is precise. The US Food and Drug Administration's acceptance limits for this kind of test are written as CVs: repeated measurements of the same sample should have a CV of no more than 15%, loosened to 20% at the lowest concentration the test claims to measure.
Why a CV and not an SD? The same test runs at very different concentrations, and its SD in absolute units tends to grow as the concentration grows. An SD rule would be too strict at high levels and too loose at low ones. A CV rule asks the same question everywhere: how big is the wobble compared to what you're measuring?
More places you'll meet the CV
| Domain | How the CV is used |
|---|---|
| Manufacturing | Comparing how consistently different production lines or machines hit their targets, even when they make parts of different sizes. |
| Laboratory science | Reporting the precision of a measurement method across different concentrations, as in the case above. |
| Business metrics | Comparing how stable sales, demand or traffic are across stores or products of very different sizes. |
| Finance | Comparing how volatile investments are relative to their average return (see the Sharpe ratio note below). |
| Machine learning | Checking how stable a model's score is across cross-validation folds (watch out for the name clash below). |
In machine learning, "CV" almost always means cross-validation, as in scikit-learn's cv=5 argument, not the coefficient of variation. You can even compute the coefficient of variation of your cross-validation scores. When you write about either one, spell it out the first time.
In 1966 the economist William Sharpe proposed a "reward-to-variability ratio" for judging mutual funds in the Journal of Business. Today it's called the Sharpe ratio: an investment's average return above a safe benchmark, divided by the standard deviation of that extra return. It's essentially the CV turned upside down, with return on top. So the direction flips too: for a CV, lower means more consistent; for a Sharpe ratio, higher means more reward for each unit of risk.
When the CV misleads
Dividing by the mean is what makes the CV useful, and it's also where it breaks. Three situations to watch for.
1. The mean is zero or close to it
Dividing by zero is undefined, and dividing by a tiny number gives a huge, meaningless result. Daily profit-and-loss figures, temperature changes and stock price changes all hover around zero, so their CV is useless.
2. The data can be negative, or has no true zero
This one is easy to miss, and it connects straight back to Day 2. The CV only makes sense for ratio-scale data, where zero means "none of it" (lengths, weights, money, durations). For interval-scale data such as temperature in Celsius, zero is an arbitrary point, so dividing by the mean gives an arbitrary answer. Here's the proof: three temperatures, written in three different units:
The same three days give a CV of 50%, 26.5% or 3.4%, depending only on which thermometer you read. A measure that changes when you merely relabel the scale isn't measuring anything real. Only kelvin has a true zero (absolute zero), so only the kelvin CV is meaningful. The same caution applies to rating scales such as 1-to-5 stars, which are ordinal (Day 2) and have no true zero either.
3. The data has outliers
The CV is built from the mean and the SD, and Day 4 showed how easily one extreme value drags both. So the CV inherits that weakness, and one bad value can make a perfectly steady process look chaotic. That's the problem our second measure solves.
Coefficient of quartile deviation (CQD)
The coefficient of quartile deviation is the robust version of the CV. Instead of the mean and SD, it uses the first and third quartiles from Day 4:
The top of the fraction is the IQR, the width of the middle half of the data. The bottom plays the role the mean plays in the CV: it tells you the size of a typical value. For data that can't go below zero, the CQD always lands between 0 and 1. Close to 0 means the middle half is packed tightly; closer to 1 means it's spread wide relative to its size.
Why use the CQD instead of the CV?
- It shrugs off outliers. Q1 and Q3 depend only on the middle of the sorted data, so making an extreme value even more extreme doesn't move them at all.
- It handles skewed data. It doesn't lean on the mean, which skew drags around.
- It describes the typical case. It tells you how consistent the middle half of your users, orders or measurements is, ignoring the rare extremes.
One thing it does not fix: like the CV, it divides by a centre, so it needs positive, ratio-scale data. Temperatures in Celsius and star ratings are still off limits.
Worked example: two services, one timeout
An engineering team wants to know which of two web services gives users the more consistent experience. They record 11 response times, in milliseconds, for each:
Service A (search API): 82, 85, 88, 90, 91, 93, 95, 97, 99, 104, 2400
Service B (report builder): 420, 450, 480, 510, 540, 560, 600, 630, 660, 700, 760
The two services work on very different scales (around 100 ms against around 600 ms), so absolute spreads aren't comparable. That calls for a relative measure. But Service A also had one request that timed out at 2,400 ms. Watch what that does.
The quartiles by hand
For exactly 11 sorted values, the hand method from Day 4 (the median of each half, leaving out the overall median) has a shortcut: the lower half is the first 5 values, so Q1 is the 3rd value; the upper half is the last 5, so Q3 is the 9th value.
| Service A | Service B | |
|---|---|---|
| Q1 (3rd value) | 88 | 480 |
| Q3 (9th value) | 99 | 660 |
| IQR (Q3 − Q1) | 11 | 180 |
| Q3 + Q1 | 187 | 1,140 |
| CQD | 11 / 187 ≈ 0.059 | 180 / 1,140 ≈ 0.158 |
By the CQD, Service A's middle half (0.059) is far more consistent than Service B's (0.158). Now compare with the CV:
One timeout pushes Service A's CV to 230%, making it look more than ten times as erratic as Service B. Remove that single request and its CV collapses to 7.2%. The CQD barely notices either way: 0.048 with the timeout and 0.043 without.
The code's CQDs (0.048 and 0.132) are a little lower than the hand-calculated ones (0.059 and 0.158). That's the quartile-method difference from Day 4 again: NumPy interpolates between neighbouring values, while the hand method picks the 3rd and 9th values. The conclusion is the same either way, which is what matters. Just don't expect a hand calculation and a library to agree to the third decimal place unless they use the same method.
The CQD tells you how consistent a typical request is, and it does that job well. But the user who waited 2.4 seconds for a search result probably cares a lot about that timeout. Performance teams often track high percentiles, such as the slowest 1% of requests, precisely because the rare bad cases matter. Use the CQD to describe the typical experience, and look at the outliers separately rather than pretending they don't exist.
CV or CQD: which one?
| Situation | Use |
|---|---|
| Positive, ratio-scale data, roughly symmetric, no major outliers | CV |
| Positive, ratio-scale data with outliers or strong skew | CQD |
| Comparing an investment's return with its volatility | The Sharpe ratio, CV's cousin |
| A widely recognised benchmark that others will understand | CV (by far the more common of the two) |
| Mean near zero, negative values, interval scales (Celsius) or ratings | Neither. Compare absolute measures such as the IQR or MAD, on the same scale |
The full dispersion toolkit
With Days 4 and 5 together, here's the whole picture:
| Measure | Type | Robust to outliers? | Best for |
|---|---|---|---|
| Range | Absolute | No | A quick first look |
| Variance | Absolute | No | Maths and models behind the scenes |
| Standard deviation | Absolute | No | Clean, roughly symmetric data |
| MAD | Absolute | Yes | Messy data, outlier detection |
| IQR | Absolute | Yes | Skewed data, box plots |
| CV | Relative | No | Comparing clean datasets with different scales or units |
| CQD | Relative | Yes | Comparing datasets with outliers or skew |
Key takeaway
When you compare the spread of two or more datasets with different averages or different units, don't compare absolute measures directly. Divide by the centre first. Just check that dividing makes sense.
- Clean, positive, ratio-scale data: compare with the CV.
- Outliers or skew: compare with the CQD, and look at the outliers on their own.
- Mean near zero, negative values, Celsius, ratings: skip both and use absolute measures on a common scale.
- Only one dataset, nothing to compare it with: the SD or IQR from Day 4 is perfectly fine on its own.
Quick check
Five questions to test whether this stuck. The answers are one click away.
Two machines both have an SD of 0.5 mm. Machine A makes parts averaging 10 mm; Machine B makes parts averaging 200 mm. Which is less consistent?
Machine A. Its CV is 0.5 / 10 × 100% = 5%, while Machine B's is 0.5 / 200 × 100% = 0.25%. The same absolute wobble is a much bigger deal on a small part.
Why can't you compute a sensible CV for daily temperature changes, some positive and some negative?
Because their mean sits near zero, or may even be negative. Dividing by a number near zero blows the CV up into a huge, meaningless value, and a negative mean makes its sign confusing. Use an absolute measure instead.
A city's daily highs have a CV of 20% when measured in Celsius. A colleague converts them to Fahrenheit and gets a different CV. Which one is right?
Neither. Celsius and Fahrenheit are interval scales whose zero points are arbitrary, so the CV changes whenever you change the scale. Only kelvin, with its true zero, gives a meaningful CV, and in practice an absolute measure like the SD is the better way to describe temperature spread.
A dataset has a couple of extreme outliers. CV or CQD, and why?
The CQD. It's built from Q1 and Q3, which ignore how extreme the outliers are. The CV uses the mean and SD, which outliers drag around, as the 230% CV from a single timeout showed.
Your notebook reports "CV = 0.91" next to a scikit-learn model. Is that a coefficient of variation?
Probably not. In machine learning, "CV" usually means cross-validation, and 0.91 is more likely an average cross-validation score, such as accuracy. Check the code, and spell out which "CV" you mean when you write it up.
So far we've described one variable at a time. Next: how to tell whether two variables move together, and how strongly.