Outlier Calculator

Figran

Paste one group or a whole table to run Grubbs, Dixon Q, Tukey IQR and z-score side by side.

  • Six tests on one dataset
  • Several groups at once
  • Figure, exact p and methods text

Data

One value per line, or a table with one group per column.

1 group · 24 values

Orientation
Tests
Grubbs
Options

28.95 is an outlier

Grubbs G = 4.657 · Critical value 2.802 · p < 0.001 · n = 24 · two-sided

Flagged by test: Grubbs 1 · ESD 2 · Dixon n/a · IQR 2 · Modified z 2 · z 1

51015202530Copper (ppm)Copper (ppm)n = 24 · 2 flagged5.28 · 3 of 5 tests28.95 · 5 of 5 testsGrubbs bound

Results

Flagged values

ValuezModified zFlagged by
5.280.18873.601Generalized ESD, Tukey IQR, Modified z-score (MAD)
28.954.65748.57Grubbs test, Generalized ESD, Tukey IQR, Modified z-score (MAD), z-score

Copper (ppm) · n = 24

Shapiro–Wilk normality reference: W = 0.3115 · p < 0.001. Outliers themselves can reduce W.

Grubbs test

G = 4.657 · Critical value 2.802 · p = 7.6 × 10⁻²⁰ · two-sided · α = 0.05

Flagged values: 28.95

The normality assumption may be questionable; an outlier itself can lower W.

Generalized ESD

Flagged values: 28.95, 5.28

No exact p value; compare Rᵢ with λᵢ.

Generalized ESD critical values are approximate, especially for samples smaller than 25.

Show steps
iRemovedRiλiExceeds critical value
128.954.6572.802Yes
25.283.0162.780Yes
32.21.7242.758No
42.21.9102.734No
52.41.7412.708No
62.41.9562.681No
72.52.0232.652No
82.71.8352.620No
92.81.8282.586No
102.91.8102.548No

Dixon Q test

Dixon’s Q test is tabulated for n = 3 to 10; use Grubbs’ test or the generalized ESD instead

Tukey IQR

Q1 = 2.750 · Q3 = 3.700 · Lower fence = 1.325 · Upper fence = 5.125 · k = 1.5

Flagged values: 5.28, 28.95

Modified z-score (MAD)

MAD = 0.3550 · Modified z threshold = 3.5

Flagged values: 5.28, 28.95

z-score

Largest possible |z| = 4.695 · z threshold = 3

Flagged values: 28.95

Assumes approximately normal observations apart from outliers. Rule of thumb, not a hypothesis test.

Report

Methods Selected screening methods: Grubbs test (two-sided; α = 0.05); Generalized ESD (α = 0.05; r = Auto); Dixon Q test (r10; α = 0.05); Tukey IQR (Exclusive; k = 1.5); Modified z-score (MAD) (Modified z threshold = 3.5); z-score (z threshold = 3). No values were removed. Compare conclusions with all observations and with flagged observations excluded; investigate exclusions and report both analyses. Dixon Q test was not applied to Copper (ppm): n = 24 is outside its tabulated range (3–10).

Results Copper (ppm), n = 24: Grubbs test (G = 4.657, p < 0.001) and z-score flagged 28.95; Generalized ESD, Tukey IQR (Lower fence = 1.325, Upper fence = 5.125), and Modified z-score (MAD) flagged 5.28 and 28.95; Dixon Q test could not be applied. Compare results with all observations retained and with flagged values excluded; no data were removed automatically.

Outlier calculator examples

Explore different kinds of measurements and compare methods.

51015202530Copper (ppm)Copper (ppm)n = 24 · 2 flagged5.28 · 3 of 5 tests28.95 · 5 of 5 testsGrubbs bound

Copper in flour: one determination far from the rest

Compare six methods on 24 copper determinations.

Source: Analytical Methods Committee 1989 (MASS chem) · 24 determinations · ppm

200210220230240MeasurementMeasurementsn = 8 · 1 flagged245.57 · 5 of 6 testsGrubbs bound

Mass spectrometer readings: the textbook Grubbs example

A small sample shows why a z-score threshold of 3 can miss an outlier.

Source: NIST/SEMATECH e-Handbook 1.3.5.17.1 · 8 measurements

Measurements5.345.426.01Grubbs testG = 3.119, p = 0.059Generalized ESD3 flaggedDixon Q testUnavailableTukey IQR3 flaggedModified z-score (MAD)3 flaggedz-score1 flagged

Three outliers at one end: the generalized ESD

A later ESD step reveals three values even when the first step does not exceed its critical value.

Source: NIST/SEMATECH e-Handbook 1.3.5.17.3 · 54 values

MolarityNo values flaggedGrubbs testG = 1.415, p = 0.227Generalized ESDUnavailableDixon Q testQ = 0.643 / 0.829Tukey IQR0 flaggedModified z-score (MAD)0 flaggedz-score0 flagged

Replicate titration: the classic Q test says keep it

Compare the largest gap with the tabulated Q10 critical value.

4 replicate titrations · mol/L

Determinations4.95.1Grubbs testG = 1.640, p = 0.463Generalized ESD2 flaggedDixon Q testQ = 0.182 / 0.568Tukey IQR0 flaggedModified z-score (MAD)0 flaggedz-score0 flagged

Two high values hide each other (masking)

Compare a single-value test with generalized ESD.

7 determinations

60070080090010001100Speed offset (km/s)Expt 3n = 20 · 5 flaggedExpt 1n = 20 · 1 flaggedExpt 2n = 20 · 0 flaggedExpt 4n = 20 · 0 flaggedExpt 5n = 20 · 0 flaggedSome labels omitted; see table or CSV.Grubbs bound

Five runs of one experiment, screened separately

Analyze five experiments independently from one table.

Source: Michelson 1879 (R morley) · 5 experiments · 20 runs each

Peak areaNo values flaggedGrubbs testG = 1.424, p = 0.739Generalized ESD0 flaggedDixon Q testQ = 0.256 / 0.625Tukey IQR0 flaggedModified z-score (MAD)0 flaggedz-score0 flagged

Six replicate injections: no outlier, and why

A small, consistent set of chromatographic peak areas.

6 injections · peak area

3.544.555.566.5Dry weight (g)ctrln = 10 · 0 flaggedtrt1n = 10 · 1 flaggedtrt2n = 10 · 0 flaggedSome labels omitted; see table or CSV.Tukey fence

Plant growth by treatment: three groups

Screen each treatment group separately.

Source: Dobson 1983 (R PlantGrowth) · 3 groups · 10 plants each

How to test for outliers

Screen your measurements in four steps.

  1. 1Paste your data

    Enter one group or a table of groups.

  2. 2Choose tests

    Choose the tests and significance level.

  3. 3Read the results

    Compare flagged values and applicability.

  4. 4Export your work

    Download the figure or copy the methods.

Grubbs test and Dixon Q test

TestHow manySample sizeAssumptionp valueTypical use
Grubbs testOne≥ 3Approximate normalityYesOne suspected value
Generalized ESDSeveral≥ 5Approximate normalityNoMultiple suspected values
Dixon Q testOne3–10Approximate normalityTable onlyOne suspected value
Tukey IQRAny number≥ 4Descriptive ruleNoDistribution screening
Modified z-score (MAD)Any number≥ 3Descriptive ruleNoDistribution screening
z-scoreAny number≥ 3Descriptive ruleNoDistribution screening

In analytical chemistry, Dixon’s Q test compares an extreme gap with the range. Grubbs uses the mean and sample standard deviation; generalized ESD can screen for several outliers.

Why the z-score fails on small samples

For n observations the largest possible absolute sample z-score is (n−1)/√n. At n = 8 it is 2.475, below the common threshold of 3.

200210220230240MeasurementMeasurementsn = 8 · 1 flagged245.57 · 5 of 6 testsGrubbs bound

Masking: two outliers hide each other

Two nearby extreme values can mask one another. Generalized ESD accounts for the possibility of multiple outliers.

Determinations4.95.1Grubbs testG = 1.640, p = 0.463Generalized ESD2 flaggedDixon Q testQ = 0.182 / 0.568Tukey IQR0 flaggedModified z-score (MAD)0 flaggedz-score0 flagged

One-sided or two-sided

The one-sided Grubbs test uses α/n in its critical value; the two-sided test uses α/(2n). For n = 8 and α = 0.05 these give 2.032 and 2.127.

References: NIST/SEMATECH 1.3.5.17 · Grubbs (1969) · Dixon (1951) · Rosner (1983) · Rorabacher (1991)

Outlier formulas and critical values

Grubbs test

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

Gcrit = (n − 1)/√n · √[t² / (n − 2 + t²)]

p = min(1, 2n · P(T ≥ √[k(n − 2)/(1 − k)])), k = G²n/(n − 1)²

Dixon Q test

Qhigh = (xₙ − xₙ₋₁)/(xₙ − x₁)

Qlow = (x₂ − x₁)/(xₙ − x₁)

Tukey IQR

Q1 − k · IQR, Q3 + k · IQR

Modified z-score (MAD) / z-score

zᵢ = (xᵢ − x̄)/s

Mᵢ = 0.6745 · (xᵢ − median)/MAD

For a two-sided test, t uses the upper α/(2n) tail with n − 2 degrees of freedom. A one-sided test uses α/n and replaces 2n by n in the p formula.

For the copper example, G = 4.657 exceeds the two-sided critical value 2.802 at α = 0.05.

Critical value tables

nTwo-sided α = 0.05Highest value α = 0.05
31.15431.1531
51.71501.6714
102.29002.1761
202.70822.5566
302.90852.7451
503.12822.9570
1003.38413.2095
n / α0.100.050.040.020.01
30.9410.9700.9760.9880.994
40.7650.8290.8460.8890.926
50.6420.7100.7290.7800.821
60.5600.6250.6440.6980.740
70.5070.5680.5860.6370.680
80.4680.5260.5430.5900.634
90.4370.4930.5100.5550.598
100.4120.4660.4830.5270.568

No p value is calculated from the Dixon table.

References: Harvey, Dixon Q10 · Tukey (1977) · Iglewicz & Hoaglin (1993)

What to do with a flagged outlier

Investigate an assignable cause

Review records, instrumentation and the sample; repeat the measurement if appropriate.

Do not silently delete values

Report results with and without the observation when relevant.

Document the decision

Record the test, side, α, value and reason for any exclusion.

Do not remove a point merely to make a test significant. Recalculate precision after any exclusion. t-test calculator · RSD calculator

References: NIST/SEMATECH · ASTM E178-21

Outlier calculator FAQ

Which outlier test should I use?

Use Grubbs for one suspected outlier and generalized ESD for several; Dixon Q is tabulated here for 3–10 observations. Tukey IQR and modified z-scores are descriptive rules.

Is the z-score useful for a small sample?

A threshold of 3 cannot flag any observation when n ≤ 10: the largest possible absolute sample z-score is (n−1)/√n.

What is the difference between Grubbs and Dixon Q?

Grubbs uses the sample mean and standard deviation and provides a p value. Dixon Q10 uses an extreme gap and a tabulated critical value for a single suspected outlier.

Why do critical values differ?

One-sided and two-sided Grubbs tests use different tail probabilities. For n = 8 at α = 0.05 they are approximately 2.032 and 2.127, respectively.

Can I test for more than one outlier?

Yes. Generalized ESD evaluates up to a chosen maximum and uses the last significant step to determine how many observations to flag.

Should I delete an outlier?

Do not delete a value solely because a test flags it. Investigate an assignable cause and report the effect of retaining or excluding it. To compare relative precision, use the RSD calculator.

How does this relate to a box plot?

The Tukey rule flags observations outside the selected IQR fences. The box plot maker uses the same quartile methods. box plot maker.

How do I run these tests in Excel or R?

In R, outliers::grubbs.test and EnvStats::rosnerTest provide related tests. In Excel, calculate the statistic and compare it with an appropriate critical value.

Does my data have to be normally distributed?

Grubbs, generalized ESD and Dixon Q assume the non-outlying observations are approximately normal. An outlier itself can affect a normality test.

Check your replicates before you report them

Compare the evidence and document your decisions.

Test for outliers