Context is everything: comparing spread with CV and CQD.
In Day 4, we covered absolute measures of spread: range, variance, standard deviation, MAD, and IQR. These are all useful tools, but they share one blind spot. They give you a number, and that number has no context. Today we fix that.
Absolute measures of dispersion give you a single number for spread. Bigger number means more spread, smaller number means the data is packed tightly together. Simple enough, until you try to compare two very different datasets.
Here's the problem: is a standard deviation of 200 big or small?
The honest answer is: it depends entirely on the mean.
The number 200 means something completely different in each case. That's the core problem with absolute measures: on their own, they never tell you what "big" or "small" actually means.
Relative measures of dispersion fix this. Instead of giving you a raw number, they compare the spread to the centre of the data. The result is a ratio with no units attached, so it stays meaningful no matter what scale or units the original data used. That's what lets you fairly compare things like how consistent salaries are across two companies, or how stable satisfaction scores are across two products.
In this article we'll cover two key relative measures:
| Absolute measures | Relative measures | |
|---|---|---|
| Output | A value in the original units (like $, cm, points) | A unitless ratio or percentage |
| Useful for | Describing spread within a single dataset | Comparing spread across different datasets |
| Examples | Range, variance, SD, MAD, IQR | CV, CQD |
| Limitation | Can't be fairly compared across different scales | Needs a central value that actually makes sense to divide by |
The Coefficient of Variation turns the standard deviation into 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.
CV has no units. Whether you're comparing salaries in dollars, heights in centimetres, or temperatures in Celsius, CV gives you a fair, apples-to-apples comparison.
A recruiter wants to know which company actually offers more consistent salaries.
| Company A | Company B | |
|---|---|---|
| Mean salary | $50,000.00 | $160,000.00 |
| Standard deviation | $3,807.89 | $7,905.69 |
| CV | 7.62% | 4.94% |
If you only looked at the standard deviation, you'd say Company B's salaries are more variable, since its SD ($7,905.69) is roughly double Company A's ($3,807.89). That conclusion is misleading.
The CV tells the real story: Company B's salaries are actually more consistent relative to their own scale. A spread of about $7,900 around a $160,000 mean matters a lot less than a spread of about $3,800 around a $50,000 mean.
| Domain | How CV is used |
|---|---|
| Finance | Comparing the risk-to-return ratio across investments with different average returns |
| Manufacturing | Monitoring production consistency, where a low CV means high quality control |
| Medicine | Comparing how variable lab measurements are across tests that use completely different scales |
| Machine learning | Checking how stable a model's performance is across different cross-validation folds |
CV has two real limitations worth knowing.
First, never use CV when the mean is zero or close to it. Dividing by zero, or by a number close to zero, gives you either an undefined result or a meaninglessly huge one.
Second, be careful with CV on data that can go negative, like profit and loss figures, or temperatures in Celsius. A negative mean makes the sign of the CV confusing and hard to read. In cases like these, stick with an absolute measure instead.
In finance, a closely related idea is the Sharpe Ratio, which measures investment return compared to risk. It's basically a version of CV, built specifically for investment performance.
The Coefficient of Quartile Deviation is the relative version of the IQR. The same way CV compares the SD to the mean, CQD compares the IQR to the sum of Q1 and Q3.
The result always lands somewhere between 0 and 1 (or 0% to 100% if you multiply by 100). Closer to 0 means the middle 50% of the data is packed tightly together. Closer to 1 means it's spread wide.
Because CQD is built from quartiles instead of the mean and standard deviation, it comes with three useful properties:
That makes CQD the right tool whenever your data has outliers, is skewed, or when you specifically want to measure the consistency of your "typical" users while ignoring the extreme cases.
A market research analyst wants to compare how consistent satisfaction is across two software products. Product A has a few extremely low scores from users who happened to hit a rare bug, and the analyst wants to understand the core user experience without those outliers throwing off the result.
Customer satisfaction scores (on a 1 to 100 scale) from 11 users of each product:
Product A (sorted): 25, 78, 80, 81, 84, 85, 88, 90, 91, 95, 98
Product B (sorted): 65, 68, 70, 72, 75, 79, 85, 88, 92, 96, 99
For a sorted dataset of exactly 11 values, there's a simple shortcut:
| Product A | Product B | |
|---|---|---|
| Q1 (3rd value) | 80 | 70 |
| Q3 (9th value) | 91 | 92 |
| IQR (Q3 − Q1) | 11 | 22 |
| Q3 + Q1 | 171 | 162 |
| CQD | 11/171 ≈ 0.064 | 22/162 ≈ 0.136 |
Interpretation: Product A's CQD (0.064) is less than half of Product B's (0.136). The middle 50% of Product A's users gave far more consistent scores. And here's the important part: that outlier score of 25 for Product A had zero say in this result, since it falls completely outside the Q1 to Q3 range.
If the analyst had used standard deviation instead, Product A's outlier would have dragged its SD way up, possibly making Product A look less consistent than Product B. That would have been the wrong conclusion, driven entirely by one unlucky user's bug report.
Run the code above and you'll get 0.058 for Product A and 0.118 for Product B, not the 0.064 and 0.136 from the hand-calculated table. This is the exact same gap we ran into with IQR back in Day 1 and Day 4. NumPy's percentile function uses linear interpolation by default, while the "3rd value, 9th value" shortcut above is the plain textbook method. Neither is wrong, they're just different rulers. The good news is the conclusion survives either way: Product A's CQD is still well under half of Product B's, so the story you'd tell a stakeholder doesn't change. But if you're ever matching a manual calculation against code output number for number, check which method the code is actually using first.
| Situation | Use |
|---|---|
| Data is clean, symmetric, no major outliers | CV |
| Data has outliers or is skewed | CQD |
| Comparing investment risk vs. return | CV |
| Comparing consistency of customer satisfaction scores | CQD |
| Mean is zero or negative | Neither. Use IQR or MAD instead |
| You need one consistency benchmark across many different datasets | CV (the most widely used in practice) |
Now that we've covered both absolute and relative measures, here's the complete picture.
| Measure | Type | Outlier sensitive? | Best for |
|---|---|---|---|
| Range | Absolute | Very | A quick first look |
| Variance | Absolute | Yes | Feeding into other calculations |
| Standard deviation | Absolute | Yes | Clean, symmetric data |
| MAD | Absolute | Robust | Skewed data, anomaly detection |
| IQR | Absolute | Robust | Skewed data, box plots |
| CV | Relative | Yes | Comparing datasets with different means |
| CQD | Relative | Robust | Comparing datasets that have outliers |
Whenever you want to compare the spread of two or more datasets that have different means or different units, don't compare absolute measures directly. Switch to a relative measure first.
A quick decision rule:
Three questions to test whether this stuck.
Machine A. Its CV is 0.5/10 × 100% = 5%, while Machine B's is 0.5/200 × 100% = 0.25%. The same absolute SD is a much bigger deal relative to Machine A's smaller average part size.
Because the mean could land at or near zero, or even be negative. Dividing the standard deviation by a number near zero blows up the CV into a huge, meaningless value, and a negative mean makes the sign of the result confusing. This is exactly the kind of data CQD or an absolute measure handles better.
CQD. It's built from quartiles, so those outliers land outside the Q1 to Q3 window and have zero effect on the result. CV is built from the mean and standard deviation, both of which outliers can drag around a lot.
Correlation and Covariance: why a data scientist should care whether two variables move together, and how to measure it.