What is the coefficient of variation, and when is it useful?
The coefficient of variation is standard deviation divided by mean, often shown as a percentage. It measures relative spread, so you can compare variability between datasets with different units or very different averages.
Explain it simply
A standard deviation of 5 means different things for a sample whose mean is 10 and one whose mean is 1,000. In the first, 5 is huge; in the second, it is tiny. The coefficient of variation (CV) divides by the mean to make spread comparable.
CV = standard deviation / mean.
Example
Two machines fill packets. Machine A targets 50 g, machine B targets 10 g. Five readings each:
- A: 48, 50, 52, 50, 50 gives mean 50, sample SD about 1.41, so CV = 1.41 / 50 = 2.8%
- B: 8, 10, 12, 10, 10 gives mean 10, sample SD about 1.41, so CV = 1.41 / 10 = 14.1%
Both have the same SD, but B is five times more erratic relative to its target.
import numpy as np
b = np.array([8, 10, 12, 10, 10])
print(round(b.std(ddof=1) / b.mean(), 3)) # 0.141What to say in the interview
"CV is SD divided by mean, a unit-free measure of relative variability. I use it to compare consistency across different scales, like the volatility of two stocks or the stability of two sensors. It only makes sense for ratio-scale data with a positive mean and breaks down when the mean is near zero."
Common mistakes
- Using CV on data that can be negative or has a mean close to zero, such as temperature in Celsius.