Outliers: how to find them and what to do
Outliers are values that sit unusually far from the rest of your data. Some are mistakes. Some are the most interesting cases in the dataset. Handling them badly, by ignoring real errors or deleting inconvenient genuine values, is one of the most common ways an analysis goes quietly wrong.
How to find outliers
1. Look at the data
A box plot, histogram or scatterplot shows extreme values immediately, and shows whether they’re isolated points or part of a long tail. Always start here.
2. The 1.5 × IQR rule
Flag values below Q1 − 1.5 × IQR or above Q3 + 1.5 × IQR. This is the rule box plots use. It works for skewed data too, because quartiles aren’t pulled around by the extremes.
Example: horsepower for the 32 cars in R’s mtcars data has Q1 = 96.5 and Q3 = 180, so IQR = 83.5. The fences are −28.75 and 305.25. One car exceeds the upper fence: the Maserati Bora, at 335 hp.
3. Z-scores
A z-score says how many standard deviations a value is from the mean. Values beyond ±3 are often flagged. The Maserati’s z-score is (335 − 146.69) / 68.56 ≈ 2.75, so it isn’t flagged by the ±3 rule even though the IQR rule flags it. The z-score method has a weakness: an outlier inflates the mean and SD it’s judged against, which can hide it. It also assumes roughly normal data.
4. Influential points in models
In correlation and regression, what matters is whether a point changes the result. Cook’s distance measures each case’s influence on the fitted line. Analytika flags cases with Cook’s D above 4/n and reruns the correlation without them. For car weight and fuel economy, five cars are flagged, and r moves only from −.87 to −.88, so the finding doesn’t depend on them.
What to do with an outlier
| Cause | Example | What to do |
|---|---|---|
| Data-entry error | Age recorded as 233 instead of 23 | Correct it from the source if you can, otherwise set it to missing |
| Missing-value code | 999 meaning “no answer” | Recode to missing before any analysis |
| Measurement problem | Equipment failure, a participant misreading instructions | Exclude, with a documented reason |
| Outside your population | A 45-year-old in a study of undergraduates | Exclude, using criteria you’d apply to anyone |
| Genuine, unusual value | The Maserati’s 335 hp | Keep it. Use robust methods or report a sensitivity analysis. |
Options for genuine outliers
- Robust summaries: the median and IQR instead of the mean and SD.
- Rank-based tests, which aren’t driven by how extreme a value is (see parametric vs non-parametric tests).
- Transformation: a log scale pulls in long right tails.
- Sensitivity analysis: run the analysis with and without the outliers and report both. If the conclusion holds either way, readers can trust it more.
- Winsorising: replace extreme values with a less extreme cut-off. This is common in some fields, but it needs to be justified and reported.
What not to do
- Delete values because they hurt your result. Removing outliers until p drops below .05 is a form of p-hacking.
- Decide the rule after seeing the results. Set exclusion criteria in advance, ideally preregistered.
- Remove outliers silently. Report how many were excluded, the rule used, and whether the results change.
- Apply the 1.5 × IQR rule mechanically to skewed data. In a long tail, many genuine values will be flagged.
See also common data cleaning mistakes. Our free CSV cleaner helps find impossible values and missing-value codes before you analyse.
More in Descriptive statistics
Try it with the free tools
Run this on your own data
Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.