Outlier test: Grubbs' test and Dixon's test with an example

Updated

An outlier test checks whether the most extreme value in a sample is further from the rest than chance would allow if all the data came from one normal distribution. Grubbs' test measures the distance of the extreme value from the mean in standard deviations. Dixon's test compares the gap between the suspect value and its nearest neighbor with the range of the data, and is meant for small samples. A significant result says the value is unusual; it does not say the value is wrong.

When to use it

  • One replicate in a set of lab results looks far off, and you need an objective check before deciding what to do with it.
  • You are cleaning a dataset before a capability study or a test, and want to flag values to investigate.
  • A procedure or standard requires a documented outlier test before a replicate can be excluded.
  • For data in time order, an individuals chart is usually more informative: it shows when the unusual value happened.

How it works

Both tests assume that, apart from a possible outlier, the data come from a normal distribution. They test one suspect value at a time.

  • H₀: all values come from the same normal distribution (no outlier).
  • H₁: the most extreme value does not come from that distribution.

Grubbs' test. With x̄ and s computed from all n values:

G = max |xᵢ − x̄| / s

Large G means the extreme value sits unusually far from the mean. The two-sided critical value at level α uses the t distribution with n − 2 degrees of freedom:

G_crit = ((n − 1)/√n) · √( t² / (n − 2 + t²) ), t = t(1 − α/(2n), n − 2)

The p-value used here inverts the same relation: convert G to a t value and multiply its upper tail probability by 2n (by n when only one end is tested), capped at 1. This is very accurate for the small p-values that matter. Grubbs' test is described in the NIST/SEMATECH e-Handbook.

Dixon's test. Sort the data, x₍₁₎ ≤ … ≤ x₍ₙ₎. For a high suspect value, the simplest ratio (r₁₀, often called Q) is the gap to its neighbor divided by the range:

r₁₀ = (x₍ₙ₎ − x₍ₙ₋₁₎) / (x₍ₙ₎ − x₍₁₎)

For 8 to 10 values, Dixon recommended r₁₁ = (x₍ₙ₎ − x₍ₙ₋₁₎)/(x₍ₙ₎ − x₍₂₎), which leaves the opposite extreme out of the range so that a second outlier at the other end cannot mask the first. The ratio is compared with tabulated critical values. Dixon's test needs only sorting, which made it popular for small lab data sets; Grubbs' test is generally preferred when n is above about 10.

Example

A chemical plant checks each batch of sodium hypochlorite solution by titration. For a method validation, an analyst titrates one well-mixed batch 10 times. Available chlorine, in percent:

Replicate12345678910
Cl (%)12.4712.5212.4412.5012.4812.4612.7112.4912.4512.51
Ten replicate titrations of one batch12.512.612.7Available chlorine (%)Batch 1147
Ten replicate titrations of one batch

Replicate 7 (12.71%) stands out.

Grubbs' test, two-sided, α = 0.05:

  • x̄ = 12.503, s = 0.0772.
  • G = (12.71 − 12.503)/0.0772 = 2.68.
  • With n = 10, t(1 − 0.05/20, 8) = 3.833, so G_crit = (9/√10) × √(3.833²/(8 + 3.833²)) = 2.29.
  • G = 2.68 > 2.29. The p-value is 0.0004 (a simulation of 400,000 normal samples of 10 gives the same value).

Dixon's r₁₁: sorted, the two lowest values are 12.44 and 12.45 and the two highest 12.52 and 12.71, so r₁₁ = (12.71 − 12.52)/(12.71 − 12.45) = 0.73. The 5% critical value for n = 10, testing whichever end is more extreme, is about 0.53 (from the same simulation), so Dixon's test agrees.

Without replicate 7, the other nine give x̄ = 12.480 and s = 0.0274, and Grubbs' test finds no further outlier (G = 1.46, p = 1).

How to read the results

  • Replicate 7 is a statistical outlier. If all 10 titrations came from one normal distribution, a value this far out would occur well under 1 time in 1,000.
  • The test does not tell you why. Look at the lab notebook. Here the analyst had noted that replicate 7 overshot the endpoint, a known assignable cause. With that record, excluding it is justified, and the report should say so.
  • The effect on the numbers is large. Including replicate 7 almost triples the standard deviation (0.077 against 0.027). For a method validation, that is the difference between an acceptable and an unacceptable repeatability.
  • If there is no assignable cause, keep the value, report it, and consider whether the method has occasional large errors that need fixing. An unexplained outlier is information about the process.

Common mistakes

  • Deleting outliers just because a test flags them. A real extreme value from the process is not an error. Remove a value only with a documented cause.
  • Testing repeatedly until nothing is left. Each round removes the most extreme value and makes the next one look worse. Repeated Grubbs' tests lose their stated error rate; a test designed for several outliers (such as the generalized ESD test) handles this properly.
  • Testing non-normal data. In a skewed distribution, the long tail always produces "outliers". Check the shape first, for example with a normality test on the data without the suspect value.
  • Using an outlier test instead of a control chart. For production data in time order, the chart shows when and how often unusual values appear, which points to the cause.

Frequently asked questions

When should I use Dixon's test instead of Grubbs' test?

Dixon's test was designed for small samples, roughly 3 to 10 values, and needs only the sorted data. Grubbs' test uses all the values through the mean and standard deviation, and is the usual choice from about 7 values upward. On most small data sets the two agree.

Can Grubbs' test find two outliers?

It tests one value at a time. Two outliers on the same side can mask each other, because both inflate the standard deviation. Use a test designed for multiple outliers, or look at the data with a boxplot or a dotplot first.

Is a value beyond the boxplot whiskers an outlier?

The boxplot marks values more than 1.5 interquartile ranges beyond the quartiles. That is a rule of thumb for spotting values to look at, not a test with a known error rate. In normal data of moderate size, it flags a value now and then by chance.

Should I report results with or without the outlier?

Report both when the cause is unknown, and say which one your conclusions rely on. When a documented cause exists, report the value, the cause and the analysis without it.

Try it with your own data

StatLab SPC is free, open-source statistics for engineers. It runs in your browser, works offline, and never uploads your data.

Open StatLab