Welcome back. In our last lesson, we focused on constructing and interpreting boxplots, seeing them as a powerful tool for visualizing a dataset's five-number summary. We briefly touched upon how boxplots can highlight unusual data points, and today we will explore that topic in depth.
This lesson is dedicated to mastering one of the most common techniques in exploratory data analysis: using the Interquartile Range (IQR) method with a boxplot to identify potential outliers. Outliers can be critical signals in a dataset—they might represent errors, rare events, or phenomena worth deeper investigation. Understanding how to systematically identify them is a foundational skill for data cleaning and building robust statistical models.
In line with your interest in both the practical application and the mathematical underpinnings of statistics, we will not only cover how to apply this rule but also explore the statistical reasoning why the specific multiplier of 1.5 is used, connecting it to the properties of the normal distribution.
The IQR Method: A Rule for Identifying Outliers
In the previous lesson, we learned that a modified boxplot displays outliers as individual points beyond the "whiskers." The rule that determines what constitutes an outlier is based on the Interquartile Range (IQR), which measures the spread of the middle 50% of your data.
An outlier is formally defined as any data point that falls outside of a specific range, often called the "fences." Here is the procedure:
- Calculate Quartiles and IQR: First, determine the first quartile (Q1), the third quartile (Q3), and the interquartile range ().
- Establish the Fences: Calculate the lower and upper fences which serve as the boundaries for our data.
- Lower Fence =
- Upper Fence =
- Identify Outliers: Any data point that is less than the lower fence or greater than the upper fence is flagged as a potential outlier.
The diagram below provides a clear visual representation of this rule in the context of a boxplot.

A Practical Example
Let's walk through the process with a simple dataset. Imagine we have the following data points:[6, 2, 1, 5, 4, 3, 50]
It's immediately obvious that 50 is an unusual value compared to the others, but let's see if our formal rule confirms this intuition.
- Order the data:
[1, 2, 3, 4, 5, 6, 50] - Calculate Quartiles and IQR:
- The median (Q2) is the 4th value: 4.
- Q1 is the median of the lower half
[1, 2, 3], which is 2. - Q3 is the median of the upper half
[5, 6, 50], which is 6. - The IQR is .
- Establish the Fences:
- Lower Fence = .
- Upper Fence = .
- Identify Outliers:
- Our range for "normal" data is
[-4, 12]. - Comparing our data points to this range, we find that
50is greater than the upper fence of 12. Therefore,50is identified as an outlier.
- Our range for "normal" data is
To see this process in action, the following video provides a concise demonstration of calculating the fences and identifying an outlier in a modified boxplot.
Five Number Summary, Boxplots, and Outliers | Statistics Exercises
This video by Wrath of Math quickly shows how to apply the 1.5*IQR rule to a dataset and adjust the boxplot to display the outlier.
Please watch the segment from "consider a modified box plot", where the narrator calculates the fences for a sample dataset and identifies an outlier.
Your background in computer science makes it natural to think of this as an algorithm. To see how this procedure translates directly into code, you can review the following article from GeeksforGeeks. It walks through the same steps using Python's NumPy library.
Interquartile Range to Detect Outliers in Data
This article provides a clear, code-based implementation of the IQR outlier detection method.
Read the introduction under the heading "Detecting Outlier with IQR" for a recap of the formula. Then, follow the Python example from Step 1 to Step 5, which applies this algorithm to a dataset very similar to our example.
The Rationale: Why 1.5?
Now for the question that stimulates a deeper understanding: why the number 1.5? Why not 1 or 2? The choice of 1.5 is a convention established by John Tukey, the creator of the boxplot, but it is a well-reasoned one. It strikes a balance between being too sensitive and not sensitive enough, and its justification is rooted in the properties of the normal distribution.
For data that is approximately normally distributed (i.e., follows a "bell curve"), we know that:
- Approximately 99.7% of the data falls within 3 standard deviations () of the mean (). Data points beyond are extremely rare and are often considered outliers.
- For a perfect normal distribution, the quartiles have a fixed relationship with the standard deviation:
- Q1 ≈
- Q3 ≈
- This means the Interquartile Range is .
Now, let's substitute this relationship into our fence formulas:
Upper Fence:
Lower Fence:
So, the rule creates fences at approximately from the mean for normally distributed data. This is quite close to the threshold often used to identify extreme values. The value 1.5 serves as a robust and practical heuristic that effectively flags points that are "unlikely" under the assumption of normality.
The following article provides a superb walk-through of this mathematical derivation, exploring what would happen if we used different multipliers.
Why 1.5 Is Used in the IQR Rule for Outlier Detection
This article from Built In offers a fantastic, math-focused explanation for the choice of 1.5 in the IQR rule.
First, quickly review the section "What Is the IQR Method" to solidify the formulas. Then, read the section "How the 1.5 IQR Rule Works" carefully. It walks through the derivation we just discussed and shows why multipliers of 1 or 2 are less ideal.
Conclusion
In this lesson, we moved from constructing boxplots to using them as a powerful analytical tool for outlier detection. You now have both the practical procedure and the theoretical justification for one of statistics' most common heuristics.
Key Takeaways:
- The 1.5 x IQR rule provides a standardized method for flagging potential outliers in a dataset.
- The procedure involves calculating lower and upper fences ( and ) and identifying any points that lie beyond them.
- The choice of 1.5 as a multiplier is a reasoned convention based on the properties of the normal distribution, creating outlier boundaries at approximately standard deviations from the mean.
- Boxplots visually implement this rule by representing outliers as individual points, making them easy to spot.
In our journey through exploratory data analysis, we have now examined frequency distributions with histograms and five-number summaries with boxplots. In our next lesson, we will explore a more fluid way to visualize distributions by learning about Kernel Density Estimation (KDE), which can be thought of as a smoothed, continuous version of a histogram.