Course contentsShow
← Data Science
Lesson 72 of 2,1452. Descriptive Statistics FoundationsFree lesson

IQR Method and Tukey's Fences

Use the interquartile range (IQR) to identify outliers with lower and upper fences, robust to non-normal distributions.

IQR Method and Tukey's Fences

What you'll learn: How to use the interquartile range (IQR) to find outliers using a simple, reliable fence-building technique.

The Core Idea

Remember the IQR from earlier? It's the difference between the 75th percentile (Q3) and 25th percentile (Q1)—the middle 50% of your data. Tukey's fences use the IQR to build "boundary lines" beyond which data points are considered outliers.

Think of it like this: imagine a safe zone in the middle of your data. Tukey's method builds two fences—one below Q1 and one above Q3—each placed 1.5 × IQR away from the quartiles. Any data point outside these fences is flagged as suspicious.

The Formula

Lower fence = Q1 - (1.5 × IQR)
Upper fence = Q3 + (1.5 × IQR)

Any value below the lower fence or above the upper fence is an outlier.

Why This Works

Unlike the Z-score method (which assumes a normal distribution), the IQR method uses percentiles—making it robust to skewed or non-normal distributions. It doesn't care about the mean or standard deviation, which can be distorted by extreme values. The fences adapt to where the bulk of your data actually sits.

A Quick Example

Say Q1 = 20, Q3 = 40, so IQR = 20.
Lower fence = 20 - (1.5 × 20) = -10
Upper fence = 40 + (1.5 × 20) = 70

Any value below -10 or above 70 is an outlier. Simple!

Key Takeaway: The IQR method with Tukey's fences (1.5 × IQR beyond Q1 and Q3) is a distribution-independent, robust way to detect outliers that works well even when data isn't normally distributed.