Find outliers in a dataset with Tukey's 1.5 × IQR fences, z-scores or robust modified z-scores, and see how the choice of rule changes what gets flagged.
Outlier if below Q1 − 1.5 × IQR or above Q3 + 1.5 × IQR
At least 4 values, separated by commas, spaces or new lines.
An outlier is a value that sits unusually far from the rest of the data. There's no single definition. Instead there are rules of thumb, each drawing the line at a different distance and measuring that distance a different way.
Outliers can be mistakes (a typo, a faulty sensor, a units mix-up) or genuine extremes (a record-breaking day, a rare patient). A rule only flags a value for attention. Whether to keep, correct or remove it depends on how it got there.
The rules differ most in how they deal with the outlier's own influence. Rules built on the mean and standard deviation can be fooled, because the outlier inflates the yardstick used to judge it. Rules built on quartiles or medians aren't.
Fences from Tukey (1977); modified z-score from Iglewicz and Hoaglin (1993), as given in the NIST/SEMATECH e-Handbook. See Sources.
MAD is the median absolute deviation. Like the IQR rule, it uses only medians, so a single extreme value can't hide by inflating the spread.
Its z-score is held down because 50 itself more than doubles the standard deviation. With 10 values, no point can reach z = 3 at all, so the strict z rule was never going to catch it.
The largest z-score any single value can have, however extreme. The |z| > 3 rule needs at least 11 values before it can flag anything.
| Values | Largest |z| | Can |z| > 3 flag? |
|---|---|---|
| 5 | 1.789 | No |
| 8 | 2.475 | No |
| 10 | 2.846 | No |
| 11 | 3.015 | Yes |
| 20 | 4.249 | Yes |
| 50 | 6.93 | Yes |
For general use, the IQR rule is simple and robust. The modified z-score is also robust and suits roughly symmetric data. Plain z-scores only make sense for large samples from bell-shaped data.
Only with a reason, such as a recording error. Otherwise report results with and without them, or use methods such as medians or robust regression that aren’t thrown off by them.
Yes. Grubbs’ test and Dixon’s Q test give a p-value for a single suspected outlier, assuming the rest of the data is normal.
For normal data about 0.7% of values fall outside the fences by chance, so 10,000 values will usually include around 70 “outliers”.
Different methods give slightly different Q1 and Q3, which moves the fences. Values close to a fence can switch between flagged and not flagged.
Tukey called values beyond 1.5 × IQR outside the quartiles “outside” and those beyond 3 × IQR “far out”. The fence calculator shows both sets of fences.
Yes. Every rule here checks both directions, with a lower and an upper limit.
0.6745 is the 75th percentile of the standard normal. It scales the MAD so that, for normal data, modified z-scores are on roughly the same scale as ordinary z-scores.
Related Tools