AI Glossary / Statistics and probability / Intermediate

Ansari-Bradley test

Definition

The Ansari-Bradley test is a rank-based test for a difference in scale between two independent samples. Its usual interpretation assumes distributions with a common location and otherwise comparable shape, differing through a scale factor. The null hypothesis is that the ratio of their scale parameters equals one.

What it means

Scale describes how widely values are spread around a location. The test looks at where each sample's observations fall in the pooled ordering, emphasizing whether one sample occupies more extreme positions while the other is concentrated near the center.

It does not directly test a difference in means or medians. A location shift or an unrelated shape difference can complicate a scale interpretation. Calling the procedure nonparametric means it avoids specifying a particular distributional family for its rank calculation, not that it works without assumptions about sampling and the question being tested.

How it works

Pool the two samples and order their observations. In a common scoring convention, assign scores that increase from each extreme toward the center. For eight untied observations, the scores are 1, 2, 3, 4, 4, 3, 2 and 1. Sum the scores belonging to one designated sample.

Under the equal-distribution null with independent observations and appropriate exchangeability, the sample labels can be reassigned to obtain the statistic's reference distribution. Small samples without ties can support an exact calculation; other implementations may use an asymptotic approximation or an appropriate permutation method. Ties require attention because implementations can handle scores and reference calculations differently.

With the inward-increasing scores used here, a smaller sum for a sample of fixed size indicates greater concentration at the pooled extremes. Select one-sided or two-sided inference to match the prespecified alternative. If location differs, do not simply reinterpret the result as a pure scale comparison or assume that subtracting estimated medians preserves the original exact test.

Three practical examples

1. A quality analyst compares the spread of two measurement procedures when a common location and a scale-change interpretation are reasonable.

2. A simulation researcher examines whether two independent output distributions differ in dispersion while checking that location differences are not driving the result.

3. A reviewer checks whether software's reported alternative refers to the first sample's scale relative to the second, avoiding a reversed directional interpretation.

Think of it this way

Think of arranging observations along a ruler and giving the largest scores to positions near the middle. A sample containing many observations at both ends receives a smaller total than a sample concentrated centrally. The comparison concerns spread around a shared location, rather than which sample sits farther to the right.

Worked example

Consider an original example with sample X = -4, -3, 3, 4 and sample Y = -1, -0.5, 0.5, 1. Both sample medians are zero. The pooled order is -4, -3, -1, -0.5, 0.5, 1, 3, 4.

Assign inward scores 1, 2, 3, 4, 4, 3, 2, 1. X receives scores 1, 2, 2 and 1, totaling 6; Y receives 3, 4, 4 and 3, totaling 14. X occupies the extremes and therefore has the smaller score sum under this convention.

There are 70 equally likely assignments of four pooled observations to X under the exchangeable null. Only one gives the minimum sum 6 and one gives the maximum sum 14. An exact two-sided tail calculation for this symmetric example is 2/70, approximately 0.0286. This illustrates the rank test, not an estimate of the scale ratio. The common-location scale model and independent sampling still need substantive justification in a real application.

Illustrative case study

Fictional case study: Spreadwise compares two instruments measuring the same stable quantity under independent runs. Analysts inspect location and distribution shape before using an Ansari-Bradley comparison of scale. They also examine measurement conditions and the practical meaning of any spread difference.

When a later dataset shows a noticeable location shift, the team does not label the rank-test result a clean variance comparison. It investigates calibration and chooses an analysis that addresses both the observed shift and the intended precision question.

This fictional case illustrates matching the test to the problem. It does not establish that the procedure is universally preferable to other scale tests or that a significant result identifies the source of measurement variability.

Common misconceptions and mistakes

The statistic is not a variance estimate or a scale-ratio estimate. A larger statistic does not always mean greater spread, because direction depends on the scoring convention and which sample is summed. Read the implementation's definitions.

Equal sample medians alone do not prove that the populations have a common location or differ only by scale. Nonparametric also does not remove the need for independent sampling or appropriate handling of ties. If variances exist under a scale model, a scale ratio of s corresponds to a variance ratio of s squared, not s.

Business use

The test can support comparisons of consistency when normal-theory variance methods are not a suitable default and a common-location scale model is defensible. It helps focus attention on variability rather than only average performance.

Report sample sizes, distribution plots, the designated sample, alternative and p-value method. Include practical spread measures and uncertainty where appropriate, because a significance result does not quantify the size of the operational difference. For AI system evaluations, repeated outputs from the same prompt or shared experimental units may be dependent; the ordinary independent-sample procedure should not be applied without considering that structure. Also distinguish a desirable reduction in random error from loss of useful diversity.

People also ask

Does the test compare medians?

No. Its intended question is a scale difference under a common-location model.

Is a scale ratio the same as a variance ratio?

No. When the relevant variances exist, the variance ratio is the square of the scale ratio.

Can ties be ignored?

No. Ties affect scoring and the reference calculation, so the method used must handle them appropriately rather than assuming the untied exact distribution applies unchanged.

Check your understanding

Under a common-shape scale model, one population has twice the scale of another. What is its variance ratio if both variances exist?

Answer: Two squared, or four. Scale and variance describe related but different quantities.

Related terms

  • Dispersion
  • Rank test
  • Permutation test
  • scale parameter
  • location-scale family
  • ties
  • Mood test and variance ratio

Learn next

construct inward ranks for two small samples, enumerate label assignments and compare one-sided with two-sided tails. Then shift one sample's location and explain why a pure scale interpretation becomes less straightforward.

More in Statistics and probability

  • Analytic survey - An analytic survey is a sample survey designed primarily to compare sectors or subgroups within the sampled population.
  • Ancestral graph - An ancestral graph is a mixed graph used to represent conditional independence relationships, allowing directed, bidirected and undirected edges under...
  • Anderson-Darling test - The Anderson-Darling test is a goodness-of-fit test that compares an empirical distribution with a specified distribution or fitted distribution family.
  • Antecedent variable - An antecedent variable is a variable that precedes another variable in time or in a proposed explanatory sequence.
  • Antithetic variates - Antithetic variates are a Monte Carlo variance-reduction technique that pairs simulated outputs with deliberately related counterparts.
  • Appearance model - An appearance model is a representation of how an object, region or scene looks in images and how that visual evidence can vary.

Sources

Primary sources: SciPy documentation, scipy.stats.ansari: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.ansari.html

R stats documentation, Ansari-Bradley Test: https://stat.ethz.ch/R-manual/R-devel/library/stats/html/ansari.test.html

NIST Dataplot, Ansari-Bradley Scores: https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/ansarisc.htm

Previous: Anonymization Next: Answer literal

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer