Z-Scores and Standardisation: Comparing Apples to Oranges

In the last lesson, we learned that if data follows a Normal Distribution, we can use the Empirical Rule (68-95-99.7) to instantly understand exactly where a data point falls compared to the rest of the group.

But there is a major problem with the real world: data doesn’t all come on the same scale.

Imagine you are a university admissions officer. You are looking at two high school seniors.

  • Applicant A took the SAT and scored a 1350.
  • Applicant B took the ACT and scored a 30.

Who is the better student? You cannot compare a 1350 to a 30. They are entirely different tests, with different maximum scores, different averages, and different spreads. It is the ultimate “apples to oranges” problem.

To solve this, data scientists use a translation tool called Standardisation to convert every normal distribution in the universe into a single, universal language: The Z-Score.

What is a Z-Score?

A Z-Score is simply the exact number of standard deviations a data point is away from its mean.

Instead of measuring someone’s height in inches, or their test in points, you measure them in standard deviations. This strips away the original units (inches, pounds, points, dollars) and leaves you with a pure measurement of relative performance.

To standardise any normal distribution, you map it onto the Standard Normal Curve. This is a special, universal bell curve where:

  • The Mean is exactly 0 (meaning a Z-Score of 0 is perfectly average).
  • The Standard Deviation is exactly 1 (meaning a Z-score of +1.0 is exactly one standard deviation above average).

The Z-Score Formula

To calculate a Z-Score, you take the data point you want to measure ($X$), subtract the Mean of the group ($\mu$), and divide by the Standard Deviation of the group ($\sigma$).

$$Z = \frac{X – \mu}{\sigma}$$

Example: SAT vs. ACT

Let’s return to our two applicants and translate their raw scores into Z-Scores so we can compare them head-to-head.

Applicant A (The SAT)

  • The national Mean ($\mu$) for the SAT is 1050.
  • The Standard Deviation ($\sigma$) is 100.
  • Applicant A scored ($X$) 1350.
  • $$Z = \frac{1350 – 1050}{100} = +3.0$$
  • Applicant A is exactly 3 standard deviations above the mean.

Applicant B (The ACT)

  • The national Mean ($\mu$) for the ACT is 21.
  • The Standard Deviation ($\sigma$) is 5.
  • Applicant B scored ($X$) 30.
  • $$Z = \frac{30 – 21}{5} = +1.8$$
  • Applicant B is 1.8 standard deviations above the mean.

The Verdict: Even though both students did very well, Applicant A is the clear winner. A Z-score of +3.0 puts them in the top 0.15% of the country, while Applicant B’s score of +1.8 is much closer to the average. By stripping away the points and looking only at Z-Scores, the “apples to oranges” comparison becomes incredibly easy.

How to Calculate Z-Scores in Software

While the math is simple enough to do on a calculator, doing it for a dataset of 50,000 customers requires software. Here is how you standardise data in your preferred tool.

Microsoft Excel

Excel has a dedicated function that runs the exact formula above. Assume cell A2 contains your raw data point, B2 contains the Mean, and C2 contains the Standard Deviation:

  • Formula: =STANDARDIZE(A2, B2, C2)
Python

If you are using Python, you rarely calculate a single Z-score. You usually want to translate an entire column of a dataset at once. The scipy library does this instantly.

import numpy as np
from scipy import stats

# An array of raw test scores
raw_scores = np.array([85, 90, 78, 92, 88, 95])

# Calculate Z-scores for the entire array instantly
z_scores = stats.zscore(raw_scores)

print(z_scores) 
# Output: [-0.34,  0.59, -1.66,  0.97,  0.22,  1.53]
R

In R, standardising a dataset is so common that it is built directly into the base language using the scale() function. It automatically finds the mean and standard deviation of your vector and returns the Z-scores.

raw_scores <- c(85, 90, 78, 92, 88, 95)

# Calculate Z-scores for the entire vector
z_scores <- scale(raw_scores)

print(z_scores)

Z-Score Comparator

Use this interactive Z-Score comparator to test this out yourself. Input the stats for two completely different environments (like height vs. test scores, or temperature vs. stock prices) and watch how the Z-Score translates them onto the exact same universal number line.

Z-Score Universal Translator

Dataset A (e.g. SAT)

Dataset B (e.g. ACT)

A
B
A has a Z-Score of +3.00. B has a Z-Score of +1.80.

Now that you know how to standardise any normal distribution, we have one final, massive question to answer: What if your original data isn’t normal at all?

What if it is wildly skewed and chaotic? In the final lesson of this module, we will learn the ultimate magic trick of statistics: The Central Limit Theorem.

πŸ—ΊοΈ Part of Path 3: Probability & Distributions

You are reading step 3 of our module on predicting outcomes. Continue your journey below or view the full syllabus.

← Previous Lesson
Normal Distribution & Empirical Rule
Next Lesson β†’
The Central Limit Theorem