Section 2.5

Outliers: Detect, Investigate, Decide

An outlier is a value far from the rest. What it is not is automatically a mistake to delete. The single most damaging habit in data analysis is covertly dropping the points that spoil the pattern. The standard approach is a three-step loop: detect the extreme value, investigate why it's there, and only then decide, with the reason on record.

Detect: look before you calculate

Your eyes are the best first detector. A histogram, a boxplot, or a scatterplot shows an extreme point instantly, in context (the chart chooser will tell you which of the three suits the variable you're looking at). Two rules of thumb then put numbers on it:

  • z-score: how many SDs from the mean. |z| > 3 is a common flag — but the mean and SD are themselves dragged by the outlier, so a lone giant can hide by inflating the SD.
  • 1.5 × IQR: anything below Q1 − 1.5·IQR or above Q3 + 1.5·IQR, the rule that draws a boxplot's whiskers. It uses quartiles, so it resists the very extremes it's hunting.

Both only flag points for investigation. Neither tells you what to do with them. (The descriptives calculator reports both for pasted data.)

When the z-score rule cannot see the outlier

The problem with the mean and SD is worse than it sounds. They are computed from the contaminated sample, so a large value pulls the mean toward itself and inflates the SD. This is called masking. In small samples it makes the rule mathematically unable to flag anything: in a sample of size n, the largest standardized score any observation can possibly reach is (n − 1)/√n. At n = 10 that ceiling is 2.85, so no value, however absurd, can ever score |z| > 3.

With more data the ceiling lifts, but a second outlier can pull the SD up far enough to hide the first. Take twenty ages from a class, two of which were typed with a stuck key:

18 19 19 20 20 21 21 22 22 23 23 24 25 26 27 28 31 34 498 511

Mean 71.6, SD 148.12. The z-score of 511 is 2.97 and of 498 is 2.88, so at the conventional |z| > 3 cutoff neither typo is flagged. Each typo inflates the SD enough to hide the other.

The repair is to build the detector out of statistics the outlier cannot move. The median doesn't shift, and neither does the median absolute deviation (MAD): take the median, measure how far every point is from it, and take the median of those distances. Here the median age is 23 and the MAD is 3. Multiplying by 1.4826 rescales it so that on normal data it estimates the same thing the SD does, giving 4.45. A robust z-score then replaces both ingredients:

robust z = (x − median) ÷ (1.4826 × MAD)

On those twenty ages the robust score of 511 is 110 and of 498 is 107, while 34, the oldest correctly typed age, scores 2.47, well inside Iglewicz and Hoaglin's usual cutoff of 3.5. The typos are now obvious and no other value is flagged, because the median and the MAD hardly change when the typos are added. (The 1.5 × IQR fence catches them too, at 37, because quartiles are robust for the same reason.)

Investigate: the three explanations

Every flagged point has one of three explanations, and each calls for a different action:

  1. An error. A typo, a unit mix-up, an equipment glitch. If the source is recoverable, correct it (age 511 → 51). If not, mark it missing.
  2. A different population, or an invalid observation. The participant fell asleep, the assay batch failed, the trial doesn't measure what you meant. Exclude and report it, with the pre-decided reason.
  3. A real extreme. A rare but valid member of a heavy-tailed distribution (a millionaire in an income survey). Keep it, and lean on robust methods (medians, trimmed means, rank tests) so one true point doesn't dominate.

Time to be the methodologist. Here are six flagged cases, each with the context you'd actually have. Pick the action you'd defend, then see the verdict.

🩺 Outlier Triage Clinic

Six realistic cases. Read the context (the story matters more than the number) and choose an action. The verdict explains the reasoning and the general rule behind it.

Diagnosed0 / 6
Matched the methodologist0

Decide, and notice the leverage

The decision matters because a single extreme point can change a whole result. Below is a small invented two-group reaction-time study. The treatment works, but one participant's timer kept running after they left the room and logged 24,000 ms. Watch what that one value does to the t-test, and what three defensible responses do to it.

⚖️ One Point, Enormous Leverage

Same study, three handling choices for the 24,000 ms value. Keep it and the real effect disappears into the noise. Winsorize it, or exclude it with a documented reason, and the effect reappears. Reporting the result both ways is a sensitivity analysis.

Control—
Treatment—
t-test—
Verdict—

Flagging a point starts an investigation. It does not end one. Decide the rule you'll use before you see how it changes your p-value, and apply it to every point equally. Report what you did, ideally with and without the point, so the reader can judge for themselves.

Why it matters: by silently deleting inconvenient points, honest researchers drift into p-hacking without noticing. Each deletion feels justified, and the false-positive rate climbs. The disciplined alternative is cheap: flag with z or IQR, investigate the cause, act on the cause, and log it. In models, an extreme point can also be a high-leverage case that bends the whole fit (see regression diagnostics). And when a variable is heavy-tailed, a transformation often pulls in the extremes without throwing any data away.

Problem 98 of the practice problems includes a cleaning log that kept three ages typed as 999 rather than lose the cases. It asks you to judge that call against the rest of the log.

Common questions

Should I remove outliers before or after checking assumptions?

Neither in isolation. Investigate the cause first, because the two questions are connected. Never delete points simply to make an assumption check pass, because that leads straight to p-hacking. Often one fix resolves both: correcting a data-entry error also removes the assumption violation it caused, and a log transform can reduce skew without discarding any data. If an extreme point is real and you're unsure, run the analysis with and without it (a sensitivity analysis) and report both.

Is it ever okay to just delete an outlier?

Only when you have a documented reason the observation is invalid, such as an equipment failure, a participant who didn't follow instructions, or an impossible value with no recoverable source. You must also report that you removed it and why. What's never acceptable is silently dropping points because they weaken your result. A real but rare value from a heavy-tailed distribution is information, not contamination: keep it and lean on robust methods such as medians, trimmed means, or rank tests so it doesn't dominate.

How many outliers is too many?

Both common rules flag points on perfectly clean data, so a small number of flags means nothing at all. The 1.5 × IQR fences are at roughly z = ±2.70 on a normal distribution, so they flag about 0.7% of it. The |z| > 3 rule flags 0.27%. In simulation, a perfectly normal sample of 200 gets 1.7 IQR flags on average, and 75% of such samples flag at least one point. Two flagged values in 200 people is therefore the expected result, not a finding. Start worrying when the flagged fraction is several times higher. Seven of 200 is 3.5%, five times what normal data produces, and that pattern says the variable is heavy-tailed, not that seven participants misbehaved. The repair for a shape is a transformation or a rank-based test, not seven deletions.