ADescribe · Guide test 148
Dixon Q test
Tests a potential extreme observation using a gap relative to the sample range.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Outliers (univariate) — Which values of a numeric variable are unusually far from the rest?
In Outliers (univariate), choose Dixon ratio = Recommended for n (r10, r11, r21 or r22) or choose Dixon ratio = r10 — gap to the next value over the range.
Do it in CodeSplash Run this test on your own data, in Python or R.
Bench
Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.
Bench · Dixon Q test
How far the planted values sit above the rest.
Your data
Drag a point away from the restIf H₀ were true
- The reference: how Q varies across samples when H₀ is true, Dixon's Q (r₁₀) for n = 10 normal values (Monte Carlo null: 1,999 samples simulated under H₀ (seed 20261107)).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .037).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- smallest and largest values
- the gap at the more extreme end as a share of the range
The verdict
Q = 0.48, p = .037
p ≤ α = .050: reject H₀
Dixon's Q is meant for small samples (3–30). A second outlier at the same end masks the first: the gap shrinks.
- Statistic
- 0.479
- p-value
- 0.0370
Dixon Q test on Sample: n = 10: Q = 0.48, p = .037. The p-value is below α = .050, so the data are hard to reconcile with H₀.
Question and hypotheses
H0: no extreme outlier in a normal sample.
Assumptions
Small independent normal sample; use the correct Dixon variant for sample size and suspected endpoint.
Formula
Parameters and notation
Displayed r10 gap/range version; other Dixon ratios use different gaps/ranges and critical values.
Structure of the method
Sort a small sample and form the selected Dixon ratio from an endpoint gap and a sample range or subrange. Its null distribution incorporates the selected order statistics; different ratio variants require different tabulated or interpolated reference values.
Estimated and nuisance parameters
The statistic is invariant to location and positive scale, so no explicit mean or variance estimate is needed. Ordered gaps are computed features, not fitted tail parameters.
Settings and design choices
Choose ratio variant, sample-size applicability, endpoint selection and one- versus two-sided testing in advance. The package’s automatic sample-size variant is a documented design rule, not a reason to choose whichever ratio is most significant.
Fitting and adaptation
Apply the chosen rule to each new batch and use its matching small-sample reference. If validating by simulation, reproduce endpoint selection and the exact ratio. No neural adaptation is involved. A flagged observation requires investigation; repeated deletion and retesting is a separate sequential procedure with different error behavior.
Sensitivity and robustness
Two nearby outliers can hide one another by making the outermost gap small. Nonnormal tails, quantization and a tiny total range can distort inference or create undefined ratios. The preserved example explicitly uses r10 rather than the package’s automatic n-dependent choice; its matching reference must remain explicit.
How to use and calibrate
Compare the chosen endpoint ratio with its Dixon critical value, accounting for whether one or both ends were considered.
Example application
Investigate one extreme observation in a small calibration batch.
Interpretation and pitfalls
Watch out
Choosing among variants or endpoints after seeing significance invalidates nominal error control. Do not use Q tables for arbitrary nonnormal data.
What changed in edition 2
- New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.
Python and R
Dixon r10 variant on n=10; alternative sample-size ranges and ratios are different variants.
Not run — Executed end to end through Rscript · needs Python standard library + Rscript; R packages: outliers
# Python launcher for the complete R implementation below.
# Requires Rscript on PATH and the listed R packages.
import shutil
import subprocess
rscript = shutil.which("Rscript")
if rscript is None:
raise RuntimeError("Install R and make Rscript available on PATH.")
r_code = r"""
x<-c(1.1,1.2,1.3,1.4,1.6,1.8,2.0,2.2,2.3,5.0)
print(outliers::dixon.test(x,type=10,two.sided=TRUE))
"""
# No shell interpolation. A failed R execution raises an error in Python.
result = subprocess.run([rscript, "--vanilla", "-"], input=r_code,
text=True, capture_output=True)
print(result.stdout)
if result.stderr:
print(result.stderr)
result.check_returncode()
Validated — Executed successfully in the validation environment · needs outliers
x<-c(1.1,1.2,1.3,1.4,1.6,1.8,2.0,2.2,2.3,5.0)
print(outliers::dixon.test(x,type=10,two.sided=TRUE))
Output
Dixon test for outliers data: x Q = 0.69231, p-value < 2.2e-16 alternative hypothesis: highest value 5 is an outlier
Sources
- www.itl.nist.gov/div898/handbook/eda/section3/eda35h.htmitl.nist.gov
- eda35h.htmitl.nist.gov
- dixon.testsearch.r-project.org
- Statistics guide v4 (historical):
- Python: Executed end to end through Rscript · R: Executed successfully in the validation environment
- Reference's record:
- Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Python-to-R bridge; Rscript is unavailable. R code was not executed. Python: Not run in the reference's review: Python-to-R bridge; Rscript is unavailable. R code was not executed. R: Reviewed but not run: R wasn't available to the reference's authors.
From the CodeSplash statistics guide (v4), entry 148, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT148.