Skip to content

Rank tests of spread

Six tests score how far each rank lies from the middle. Most assume the groups share a center, and getting that wrong makes them test location by accident.

Advanced ~9 min8 steps

What runs in CodeSplash

You will be able to

  • Explain how scale scores turn ranks into a test of spread
  • Say why two-group rank scale tests need a common center
  • Choose Fligner–Killeen for several groups

Read first

01

Spread as a rank score

Read

If one group is more spread out, its values pile up at both ends of the joint ranking and the other's sit in the middle. Give each rank a score for how far it lies from the center, then add them up for one group.

The score decides the test:

TestScore for rank RR out of NN
Ansari–BradleyAnsari–Bradley testTwo-group rank test of spread that scores values by how close they sit to the middle of the pooled data.Distance from the nearer end
MoodMood scale testTwo-group rank test of spread based on squared distances of ranks from the middle rank.(R−(N+1)/2)2(R - (N+1)/2)^2
Siegel–TukeySiegel–Tukey testRanks values alternately from both ends inward, then runs a Wilcoxon rank-sum test on those ranks.Ranks that alternate from the ends inward
KlotzKlotz testTwo-group scale test using squared normal scores of the ranks.Squared normal quantile of R/(N+1)R/(N+1)
ConoverConover squared-ranks testRanks the distances from group means, squares the ranks and compares their averages across groups.Squared ranks of distances from the group mean
Fligner–KilleenFligner–Killeen testRank-based test of equal spread using normal scores of each value's distance from its group median.Normal scores of distances from the group median
02

The hidden assumption

Predict

Predict first

Two groups of 10 values each. Group A is far more spread out than group B, but B sits far above A with no overlap. What does a Mood test report?

A large difference in spreadNo difference in spread
Reveal

No difference. A takes ranks 1 to 10 and B takes 11 to 20 however spread out each one is, so their Mood scores mirror each other and sum to the same total. A smaller shift can do the opposite and mimic a difference. Ansari–Bradley, Mood, Siegel–Tukey and Klotz need the groups to share a center: align them first, or use a test that centers within groups.

03

Center first

Read

Fligner–Killeen and Conover's squared ranks handle this for you: they rank each value's distance from its own group's center, so a location shift has little effect. Fligner–Killeen also works with any number of groups and has a strong record in simulation studies.

04

Read several at once

Read

In these examples the true spreads are similar, so large p-values are expected:

  • Fligner–Killeen with three groups: χ2\chi^2 = 0.060, p = .971
  • Conover: z = −0.27, p = .785
  • Klotz: z = −0.10, p = .921

On a pair of groups with an SD ratio of about 1.6, Ansari–Bradley gives p = .541, Mood p = .444 and the exact Siegel–Tukey p = .529. With only 10 values per group, none of them has much power.

05

Power is the price

Reflect

Compare those p-values with the F test on similar data, p = .168. Rank tests give up power under normality in exchange for not depending on it.

Before you collect data, ask how large a spread difference you must detect. Rank tests of spread often need many more observations per group than you'd need to detect a similar shift in location. How many could you get?

06

Check your understanding

Checkpoint

Check yourself

You want a rank-based spread test across five groups whose medians differ. Which fits?

Show the answer

Answer: a

Ansari–Bradley and Siegel–Tukey handle two groups and assume a common center. Fligner–Killeen works from distances to each group's median.

Check yourself

With N = 9 values in total, what is the Mood score for the largest value, rank 9? Use (R − (N+1)/2)².

Show the answer

Answer: 16

(N + 1) / 2 = 5, and (9 − 5)² = 16. The middle rank scores 0.

Check yourself

Which test is designed to do best under normality while staying rank-based?

Show the answer

Answer: b

Klotz uses squared normal scores, so it does well when the data are near-normal.

07

Do it in CodeSplash

In the app

Choose from the rank group in Equal spread tests' Test list. Two-group tests are disabled, with a reason, when you have more than two groups. Set p-value to exact or permutation for small samples.

Python
import pandas as pd
from scipy import stats

df = pd.read_csv("plantgrowth.csv")
groups = [g["weight"] for _, g in df.groupby("group")]
print(stats.fligner(*groups))

a, b = groups[0], groups[1]
print(stats.ansari(a - a.median(), b - b.median()))  # center first
print(stats.mood(a - a.median(), b - b.median()))
R
fligner.test(weight ~ group, data = PlantGrowth)

a <- PlantGrowth$weight[PlantGrowth$group == "ctrl"]
b <- PlantGrowth$weight[PlantGrowth$group == "trt1"]
ansari.test(a - median(a), b - median(b))  # center first
mood.test(a - median(a), b - median(b))

R's mood.test handles ties approximately; CodeSplash computes the exact tie variance, so results can differ with ties.

08

Recap

Recap
  • Rank scale tests score how far each rank lies from the middle.
  • Ansari–Bradley, Mood, Siegel–Tukey and Klotz assume a shared center. Align first.
  • Fligner–Killeen is a robust default for several groups, at some cost in power.

Concepts in this lesson