What is a z-score, and how does it help compare values on different scales?
A z-score is (value - mean) / standard deviation, the number of standard deviations a value sits from the mean. Because it removes units and scale, you can compare a Maths mark with a Physics mark fairly.
Explain it simply
Scoring 72 in one test and 78 in another says nothing until you know how tough each test was. A z-score asks: how far above the class average were you, measured in units of the class spread?
z = (x - mean) / SD
Positive means above average, negative below, and zero exactly average.
Example
- Maths: you scored 72, class mean 60, SD 8, so z = (72 - 60) / 8 = 1.5
- Physics: you scored 78, class mean 70, SD 4, so z = (78 - 70) / 4 = 2.0
Your Physics mark is relatively stronger even though the Maths gap (12 marks) is bigger in raw points.
def z(x, mean, sd):
return (x - mean) / sd
print(z(72, 60, 8)) # 1.5
print(z(78, 70, 4)) # 2.0If both subjects are roughly normal, z = 2 means you beat about 97.7% of the class.
What to say in the interview
"A z-score expresses a value in standard deviations from the mean, so different features or tests become comparable. It is also the basis of standardisation in machine learning and of the z-score outlier rule, where |z| above 3 is flagged."
Common mistakes
- Using the population SD when you only have a sample, or forgetting that z-scores are meaningful as percentiles only for roughly normal data.