Interquartile Range (IQR)- Definition and Calculation Method
What Is the Interquartile Range?
The interquartile range (IQR) is a measure of statistical dispersion. It tells you the spread of the middle 50% of your data. That's it. Nothing fancy.
Unlike range (which uses the extreme values), IQR focuses on where your data is actually clustered. It ignores outliers and gives you a realistic picture of your dataset's typical spread.
You calculate it by subtracting the first quartile from the third quartile:
IQR = Q3 - Q1
Why Does IQR Matter?
Here's the problem with using max minus min: outliers destroy it. One crazy high or low value and your range becomes useless.
IQR fixes this. By only looking at the middle half of your data, you get a robust measure that outliers can't corrupt. This makes it essential for:
- Identifying outliers in datasets
- Comparing variability across different distributions
- Understanding skewed data where mean and standard deviation mislead you
- Presenting data in box plots
The Quartiles Explained
Before you can calculate IQR, you need to understand quartiles. These are the values that divide your sorted data into four equal parts.
The Three Quartiles
Q1 (First Quartile): The 25th percentile. 25% of your data falls below this value.
Q2 (Second Quartile): The 50th percentile, also known as the median. Half your data is below this point.
Q3 (Third Quartile): The 75th percentile. 75% of your data falls below this value.
IQR uses Q1 and Q3. Q2 is useful for other purposes but doesn't factor into the IQR calculation.
How to Calculate IQR: Step by Step
Here's the straightforward process:
Step 1: Sort Your Data
Arrange all values in ascending order. This is non-negotiable.
Step 2: Find the Median (Q2)
Locate the middle value. If you have an odd number of data points, that's the median. If even, average the two middle values.
Step 3: Find Q1
Look at the lower half of your data (everything below the median). Find the median of that half. That's Q1.
Step 4: Find Q3
Look at the upper half of your data (everything above the median). Find the median of that half. That's Q3.
Step 5: Calculate IQR
Subtract Q1 from Q3:
IQR = Q3 - Q1
Example Calculation
Let's work through a real example. Dataset: 3, 5, 7, 8, 9, 11, 13, 15, 18, 20
Step 1: Already sorted ✓
Step 2: Median. We have 10 values (even). The middle two are positions 5 and 6: 9 and 11. Median = (9 + 11) / 2 = 10
Step 3: Q1. Lower half: 3, 5, 7, 8, 9. Median of lower half = 7
Step 4: Q3. Upper half: 11, 13, 15, 18, 20. Median of upper half = 15
Step 5: IQR = 15 - 7 = 8
The interquartile range is 8. This means the middle 50% of your data spans 8 units.
IQR vs Other Measures of Spread
Here's how IQR stacks up against alternatives:
| Measure | What It Uses | Outlier Resistant? | Best For |
|---|---|---|---|
| IQR | Middle 50% of data | Yes | Skewed data, outlier detection |
| Range | Max and Min | No | Quick estimate, no outliers |
| Variance | All data points | No | Parametric statistics |
| Standard Deviation | All data points | No | Normal distributions |
Using IQR to Detect Outliers
IQR is your go-to tool for finding outliers. Here's the standard method:
Lower bound: Q1 - 1.5 × IQR
Upper bound: Q3 + 1.5 × IQR
Any value outside these bounds is considered a potential outlier. Values beyond 3 × IQR are extreme outliers.
Practical Example
Using our previous dataset where Q1 = 7, Q3 = 15, IQR = 8:
- Lower bound: 7 - (1.5 × 8) = 7 - 12 = -5
- Upper bound: 15 + (1.5 × 8) = 15 + 12 = 27
Values below -5 or above 27 would be outliers. In our dataset (range 3-20), there are none.
When to Use IQR
IQR works best when:
- Your data is skewed (asymmetric distributions)
- You suspect outliers exist
- You need to compare variability between datasets with different scales
- You want to create or interpret box plots
- You're doing non-parametric statistics
Skip IQR when your data is normally distributed and you have no outliers. Standard deviation gives you more information in that case.
Quick Reference: IQR Formula Summary
- IQR = Q3 - Q1
- Lower outlier fence = Q1 - 1.5 × IQR
- Upper outlier fence = Q3 + 1.5 × IQR
That's everything you need to calculate and apply the interquartile range. It's a simple concept that handles real-world messy data better than most alternatives.