Four ways to detect outliers
- IQR fences (Tukey): flags values below Q1 − 1.5 × IQR or above Q3 + 1.5 × IQR. Simple and robust, and the method behind box plots.
- z-score: flags |z| > 3. Familiar, but weak in small samples because the outlier inflates the SD.
- Modified z-score: uses the median and the median absolute deviation (MAD), and flags |M| > 3.5, following Iglewicz and Hoaglin.
- Grubbs’ test: a formal significance test for the single most extreme value in roughly normal data.
Worked example
In the example data, 48 stands far from the rest, which run from 12 to 21. The IQR fences are 9.38 and 24.38, so 48 is flagged. Its modified z-score is 10.6, and Grubbs’ test agrees (G = 2.76 against a critical value of 2.29). But its ordinary z-score is only 2.76, below the usual cut-off of 3. This is called masking: including 48 raises the SD from 2.74 to 10.34. See how to detect outliers.
What to do with an outlier
First check for a data-entry or measurement error, and correct it if you find one. If the value is genuine, keep it, and consider a robust method such as the median or a rank-based test. If you do exclude a value, say so and report the results both ways.
Accuracy
Grubbs critical values match published tables (for example 2.290 for n = 10 at α = .05). Fences use the inclusive quartile method, the default in Excel and R; see the quartile calculator to compare methods.
Frequently asked questions
What is the 1.5 IQR rule?
A value is a potential outlier if it lies more than 1.5 times the interquartile range below the first quartile or above the third quartile.
Should I remove outliers?
Only if you can show the value is an error. Genuine extreme values are part of the data. If you exclude any, report it and show the results with and without them.
Why does the z-score miss some outliers?
The outlier itself increases the mean and standard deviation, which shrinks its own z-score. This is called masking, and it is worst in small samples.
When should I use Grubbs' test?
When the data apart from the suspect value are roughly normal and you want a formal test of one value. For several outliers, the IQR or modified z-score rule is safer.