Statistics · Representations of Data · Year 1

Outliers

An extreme value can be a genuine, if unusual, observation — or a recording error in disguise. Two calculation methods give you a precise, defensible way to decide.

9 min read 4 worked examples

What is an outlier?

An outlier is an extreme value that lies outside the overall pattern of the rest of the data. There's no single universal rule for identifying one — different questions specify different tests, and you'll always be told which test and which constant to use. Two tests come up repeatedly at this level.

Method 1: a multiple of the interquartile range

A value is classified as an outlier if it lies more than $k$ times the interquartile range beyond the nearer quartile, for some constant $k$ given in the question:

$\text{outlier if } x < Q_1 - k(Q_3-Q_1) \quad\text{or}\quad x > Q_3 + k(Q_3-Q_1).$

The value $k=1.5$ is the most common choice, but the exam may specify a different value — always use whatever $k$ the question gives, not a memorised default.

Method 2: a number of standard deviations from the mean

Alternatively, a value can be classified as an outlier if it lies more than a given number of standard deviations from the mean — commonly written using the mean $\bar x$ and standard deviation $\sigma$:

$\text{outlier if } x < \bar x - m\sigma \quad\text{or}\quad x > \bar x + m\sigma,$

where $m$ is usually $2$ or $3$. This method uses every value in the dataset (since both $\bar x$ and $\sigma$ depend on the whole dataset), whereas the interquartile-range method depends only on the two quartiles.

Watch out

These two methods can classify different values as outliers, since one is built from quartiles and the other from the mean and standard deviation. Always use exactly the method (and constant) specified in the question — don't default to whichever one you remember best.

Anomalies and cleaning data

Not every outlier should be removed. A genuinely unusual but correctly recorded value is still legitimate data and should normally stay in the dataset. An anomaly, by contrast, is a value that is clearly the result of an error — a misrecording, a units mistake, or a value that is physically impossible — and misleads any analysis if it's left in.

Cleaning the data

The process of removing anomalies from a dataset is called cleaning the data. You must be able to justify why a value is being removed — an outlier should never be discarded simply because it doesn't fit the pattern. Only remove a value when there is a clear reason to believe it's an error.

Worked example 1

The interquartile-range method
A sample of 24 delivery times (minutes) has $Q_1=20$ and $Q_3=30$. Using $k=1.5$, determine whether delivery times of $3$ minutes and $50$ minutes are outliers.
MethodFind both boundaries, then test each value
1
$\text{IQR}=30-20=10$, so $k(Q_3-Q_1)=1.5(10)=15$.
Needed for both boundaries.
2
Lower boundary: $Q_1-15=20-15=5$. Since $3<5$, the value $3$ is an outlier.
Compare against the lower cutoff.
3
Upper boundary: $Q_3+15=30+15=45$. Since $50>45$, the value $50$ is also an outlier.
Compare against the upper cutoff.
▪ solved

Worked example 2

The mean ± standard deviations method
A sample of 15 resting heart rates (bpm) has $\sum x = 1020$ and $\sum x^2 = 70200$. An outlier is defined as any value more than 2 standard deviations from the mean. Determine the outlier boundaries, and state whether a heart rate of $45$ bpm is an outlier.
MethodFind the mean and SD first, then the boundaries
1
$\bar x = 1020/15=68$.
Mean from the summary totals.
2
Variance $=\dfrac{70200}{15}-68^2=4680-4624=56$, so $\sigma=\sqrt{56}\approx 7.48$.
Computational variance formula.
3
Boundaries: $68-2(7.48)\approx 53.0$ and $68+2(7.48)\approx 82.97$.
Mean ± 2 standard deviations.
4
Since $45<53.0$, a heart rate of $45$ bpm is an outlier.
Below the lower boundary.
▪ solved

Worked example 3

Anomaly or legitimate outlier?
The recorded ages, in years, of nine people at a family gathering are: $8, 12, 15, 19, 22, 25, 31, 38, 145$. Show that $145$ is an outlier using $k=1.5$, and explain whether it should be removed before further analysis.
MethodTest the value, then reason about what it represents
1
$n=9$: $Q_1$ position $=9/4=2.25$, round up to the 3rd value $=15$; $Q_3$ position $=3(9)/4=6.75$, round up to the 7th value $=31$.
Discrete-data quartile rule.
2
$\text{IQR}=31-15=16$, so $1.5\times16=24$, giving an upper boundary of $31+24=55$.
Standard IQR-method boundary.
3
Since $145>55$, the value is an outlier.
Compare against the boundary.
4
An age of $145$ is not physically possible, so this is almost certainly a recording error (perhaps meant to be $14.5$ or $45$) rather than a genuine value, and should be treated as an anomaly and removed before analysing the data.
Impossible values are cleaned, not just flagged.
▪ explained
The key insight

Being an outlier and being an anomaly are different judgements. The calculation tells you $145$ is an outlier; only context — the fact that no human is $145$ years old — tells you it's also an anomaly that should be removed.

Worked example 4

Why the two methods can disagree · Challenge
A dataset contains one extremely large value alongside several closely clustered smaller values. Explain, without calculation, why this extreme value might be classified as an outlier by the interquartile-range method but fail to be classified as an outlier by the mean ± 2 standard deviations method.
MethodThink about what each method actually depends on
1
The quartiles $Q_1$ and $Q_3$ depend only on the middle portion of the ordered data, so a single very large value barely shifts them — the IQR boundary stays close to where it would be without that value.
Quartiles are resistant (robust) to extreme values.
2
The mean and standard deviation are calculated using every value, including the extreme one — so that single value can inflate $\bar x$ and especially $\sigma$ substantially.
Mean and SD are not robust to extreme values.
3
A larger $\sigma$ pushes the boundary $\bar x + 2\sigma$ further out — potentially so far out that the very value which inflated $\sigma$ no longer falls beyond it.
The outlier can "hide" itself by inflating its own boundary.
4
The IQR method's boundary isn't affected this way, since it never used the extreme value to build itself — so it can still flag the same value as an outlier.
This is why the two methods can disagree.
▪ explained
Look deeper

This is a genuine limitation of the mean ± standard deviations method: because $\sigma$ is calculated from the data it's testing, a single extreme enough value can distort the very boundary meant to catch it. The interquartile-range method doesn't have this problem, which is one reason it's often preferred for skewed or messy real-world data.

Common mistake

Don't switch between the two outlier methods mid-question, and don't assume $k=1.5$ or $m=2$ by default — always re-read the question for the exact method and constant it wants you to use, since both vary freely between questions.

Check yourself

A dataset has $Q_1=14$, $Q_3=26$. Using $k=2$, determine whether a value of $50$ is an outlier.
(Hint: find the IQR, then the upper boundary $Q_3+k(Q_3-Q_1)$.)

Method
1
$\text{IQR}=26-14=12$, so $k(Q_3-Q_1)=2(12)=24$.
2
Upper boundary $=26+24=50$.
3
Since $50$ is not strictly greater than $50$, it is not an outlier — it sits exactly on the boundary.
The test uses a strict inequality.
▪ solved