zscore() — Z-scores
How many standard deviations a value sits from the mean.
zscore(value, mean, sd)
Key idea
- A z-score is (value − mean) ÷ sd: how many standard deviations (typical gaps) the value sits from the mean. (e.g. (90 − 75) / 10.8 = 1.39)
- z = 0 is the mean; a positive z is above it, a negative z is below. (e.g. z = −2 -> two SDs below)
- It puts different scales on one ruler, so values can be fairly compared. (e.g. height vs exam score)
- On a normal (bell-shaped) curve about 95% of values have |z| < 2; a |z| > 3 is a rare outlier.
Definition
z=σx−μ
- x
- the value you are scoring
- μ
- the mean
- σ
- the standard deviation
- z
- the z-score (number of SDs from the mean)
z=10.890−75=1.39⇒1.39 SDs above the mean
In plain words
Instead of saying "90 marks", a z-score says "1.4 standard deviations above average" — a fairer way to compare across different tests.
Where you'd use it
- Comparing a 1.5 z-score in maths with a 0.8 z-score in English shows the student was more exceptional in maths, even if the raw marks differ.
- Spotting outliers in sensor data: any reading with
|z| > 3 is flagged as suspicious. - Standardizing features before training a model so a column measured in thousands does not swamp one measured in tenths.
Frequently asked questions
- How do I read a z-score?
- It’s how many SDs a value sits above (+) or below (−) the mean.
- Is |z| = 2 unusual?
- Roughly the outer 5% — fairly unusual. |z| > 3 is rare.