Is there a preferred direction?
Rayleigh, V, Kuiper, Watson U² and Rao spacing all test uniformity on the circle, but each sees a different kind of departure.
What runs in CodeSplash
- STAT258Rayleigh test Runs in CodeSplash
- STAT259V test or modified Rayleigh test Runs in CodeSplash
- STAT260Kuiper test Runs in CodeSplash
- STAT261Watson U squared one sample test Runs in CodeSplash
- STAT262Rao spacing test Runs in CodeSplash
- Tests of circular uniformity (Rayleigh, V, Kuiper, Watson, Rao) Verified in Python and R
You will be able to
- State the null hypothesis of a circular uniformity test
- Match Rayleigh, V, Kuiper, Watson and Rao to the patterns they detect
- Explain why failing to reject does not show uniformity
Read first
The null: every direction equally likely
ReadAll five tests share one null: the angles come from a uniform distribution on the circle. They differ in the alternative each one is built to catch.
| Test | Best at detecting |
|---|---|
| RayleighRayleigh testTests whether angles cluster around one direction rather than spreading evenly; Z = nR̄². | One preferred direction |
| V testV testRayleigh's test against a direction stated in advance (home, noon); more powerful when that direction is right. | Clustering around a direction you stated in advance |
| KuiperKuiper's testThe circular Kolmogorov–Smirnov test (largest gaps above and below the uniform), sensitive to any departure. | Any departure, including several peaks |
| Watson U²Watson's U²The circular Cramér–von Mises statistic; detects any departure from uniformity (one sample) or any difference between two samples. | Any departure, using the whole distribution |
| Rao spacingRao's spacing testCompares the gaps between neighboring angles with equal spacing (360°/n); good at detecting several clusters. | Uneven gaps between neighboring angles |
All five are on every card; the one you choose is the headline.
Rayleigh, from R̄
ExploreThe Rayleigh statistic is . A large resultant length is surprising when directions are uniform.
Change the concentration and sample size. How small a preference can you detect with a large ?
BExplorable · Rayleigh test
Are the directions concentrated around some mean direction?
Large spreads approach a uniform circle.
Your data
Drag a point or use ↑/↓ to change itIf H₀ were true
- The reference: how 2Z varies across samples when H₀ is true (χ²₂ limit drawn; p from the Mardia–Jupp expansion).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .022).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- mean resultant length: 0 for spread, 1 for identical directions
- Rayleigh's statistic; 2Z is approximately χ² with 2 df, the curve drawn
- Mardia–Jupp small-sample expansion, as CodeSplash computes it
The verdict
2Z(2) = 7.52, p = .022, R̄ = 0.35
p ≤ α = .050: reject H₀
Effect size: mean resultant length R̄ = 0.354
Detects one preferred direction. It misses bimodal (axial) data whose resultant cancels; double the angles first for axial data.
- Statistic
- 7.519
- p-value
- 0.0220
Rayleigh test on Directions (°): n = 30: 2Z(2) = 7.52, p = .022, R̄ = 0.35. The p-value is below α = .050, so the data are hard to reconcile with H₀.
One column with no preference
PredictPredict first
A column of 76 headings was simulated with no preferred direction.
Across all five tests, what do you expect at the usual 0.05 level?
Reveal
None rejects: Rayleigh p = .995, Kuiper p = .739, Watson p = .815, Rao p = .756.
With a stated direction, say so
ReadSimulated pigeons released to fly home at 90° test more sharply with the V test, which only counts clustering toward the stated direction. It's a one-sided alternative, and it must be chosen before seeing the data.
Here gives u = 7.71, p < .001 toward 90°.
BExplorable · V test or modified Rayleigh test
Are the directions concentrated around a predicted direction?
Large spreads approach a uniform circle.
The direction H₁ predicts.
Your data
Drag a point or use ↑/↓ to change itIf H₀ were true
- The reference: how z varies across samples when H₀ is true (normal approximation with the Durand–Greenwood correction).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .020).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- the direction predicted in advance
- resultant length
- standardized V, compared with the normal
- Durand & Greenwood's small-sample correction
The verdict
V = 7.91, z = 2.04, p = .020
p ≤ α = .050: reject H₀
More powerful than Rayleigh when the direction is known beforehand — and blind to concentration elsewhere.
- Statistic
- 2.043
- p-value
- 0.0203
V test or modified Rayleigh test on Directions (°): n = 30: V = 7.91, z = 2.04, p = .020. The p-value is below α = .050, so the data are hard to reconcile with H₀.
Choosing the stated direction after looking at the mean direction makes the p-value meaningless.
When Rayleigh misses the pattern
ReadSimulated orders across the week: the mean direction cancels, because every day looks alike.
- Rayleigh: p = .576.
- Kuiper: p = .093.
- Rao spacing: p = .001.
Orders pile up at the same hours each day, which gives seven peaks around a weekly circle. Arrows cancel, so Rayleigh sees nothing, but the gaps between visits are far from even, and Rao's test notices.
Calibration
ReadKuiper and Watson use published approximations by default. Rao's is simulated: p < .001 here from 1,999 samples, on a shared generator so Python and R give the same answer.
Set p-values to Monte Carlo for small samples or when you double angles for axial data.
A plan before you test
ReflectSuppose you have flight bearings and no theory about a direction. Which test would you make the headline, and why?
Now suppose you suspect birds orient along a coastline, in both directions. What changes? Write your two answers, then check them against the table at the start.
Check your understanding
CheckpointCheck yourself
A sample has and . What is the Rayleigh statistic ?
Show the answer
Answer: 16
.
Check yourself
You expect orders to peak at both breakfast and dinner. Which test should you avoid as your only check?
Show the answer
Answer: a
Two opposing peaks cancel in , so Rayleigh has little power against them. The others look at the whole distribution or the gaps.
Check yourself
When is the V test the right choice?
Show the answer
Answer: c
The V test gains power by committing to a direction in advance. Choosing it from the data defeats the point.
Do it in CodeSplash
In the appRun all five on your own angles, and let the rose diagram decide which one you believe. Set Test before you look, then read the others as checks.
import numpy as np
import pandas as pd
theta = np.radians(pd.read_csv("ci_turtles.csv")["heading"])
n = len(theta)
rbar = np.hypot(np.cos(theta).mean(), np.sin(theta).mean())
z = n * rbar ** 2
# Rayleigh p-value with Greenwood's second-order correction
p = np.exp(-z) * (1 + (2 * z - z ** 2) / (4 * n)
- (24 * z - 132 * z ** 2 + 76 * z ** 3 - 9 * z ** 4) / (288 * n ** 2))
print(z, p)theta <- read.csv("ci_turtles.csv")$heading * pi / 180
n <- length(theta)
rbar <- sqrt(mean(cos(theta))^2 + mean(sin(theta))^2)
z <- n * rbar^2
# Rayleigh p-value with Greenwood's second-order correction
p <- exp(-z) * (1 + (2 * z - z^2) / (4 * n) -
(24 * z - 132 * z^2 + 76 * z^3 - 9 * z^4) / (288 * n^2))
c(z, p)Recap
Recap- All five test uniformity, but each is tuned to a different alternative.
- Rayleigh only sees a single preferred direction, so a large p-value doesn't show uniformity.
- Commit to a stated direction before the data, or don't use the V test.
Concepts in this lesson