Skip to content

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.

Advanced ~15 min10 steps

What runs in CodeSplash

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

01

The null: every direction equally likely

Read

All 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.

TestBest 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.

02

Rayleigh, from R̄

Explore

The Rayleigh statistic is Z=nRˉ2Z = n\bar R^2. 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 nn?

BExplorable · Rayleigh test

Are the directions concentrated around some mean direction?

30
60
70

Large spreads approach a uniform circle.

0.050

Your data

Drag a point or use ↑/↓ to change it
Directions (°) · n = 30 · mean direction 57°

If H₀ were true

2Z = 7.52
  1. The reference: how 2Z varies across samples when H₀ is true (χ²₂ limit drawn; p from the Mardia–Jupp expansion).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .022).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

Z=nRˉ2,p≈e−Z[1+2Z−Z24n−24Z−132Z2+76Z3−9Z4288n2]Z = n\bar R^2,\qquad p \approx e^{-Z}\left[1+\dfrac{2Z-Z^2}{4n}-\dfrac{24Z-132Z^2+76Z^3-9Z^4}{288n^2}\right]

With your numbers

Rˉ=0.35,Z=30×0.352=3.76\bar R = 0.35,\quad Z = 30\times0.35^2 = 3.76
Rˉ\bar R
mean resultant length: 0 for spread, 1 for identical directions
Z=nRˉ2Z = n\bar R^2
Rayleigh's statistic; 2Z is approximately χ² with 2 df, the curve drawn
pp
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 H0.

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₀.

03

One column with no preference

Predict

Predict 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?

All five rejectAbout half rejectNone rejects
Reveal

None rejects: Rayleigh p = .995, Kuiper p = .739, Watson p = .815, Rao p = .756.

04

With a stated direction, say so

Read

Simulated 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 VV gives u = 7.71, p < .001 toward 90°.

BExplorable · V test or modified Rayleigh test

Are the directions concentrated around a predicted direction?

30
75
80

Large spreads approach a uniform circle.

60

The direction H₁ predicts.

0.050

Your data

Drag a point or use ↑/↓ to change it
Directions (°) · n = 30 · mean direction 67°

If H₀ were true

z = 2.04
  1. The reference: how z varies across samples when H₀ is true (normal approximation with the Durand–Greenwood correction).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .020).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

V=Rcos⁡(θˉ−μ0),u=V2/n,p=1−Φ(u)+φ(u)[3u−u316n+15u+305u3−125u5+9u74608n2]V = R\cos(\bar\theta-\mu_0),\quad u = V\sqrt{2/n},\quad p = 1-\Phi(u)+\varphi(u)\left[\dfrac{3u-u^3}{16n}+\dfrac{15u+305u^3-125u^5+9u^7}{4608n^2}\right]

With your numbers

V=7.91,u=2.04V = 7.91,\quad u = 2.04
μ0\mu_0
the direction predicted in advance
RR
resultant length
uu
standardized V, compared with the normal
φ(u)[…]\varphi(u)[\ldots]
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 H0.

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.

05

When Rayleigh misses the pattern

Read

Simulated 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.

06

Calibration

Read

Kuiper 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.

07

A plan before you test

Reflect

Suppose 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.

08

Check your understanding

Checkpoint

Check yourself

A sample has n=100n = 100 and Rˉ=0.4\bar R = 0.4. What is the Rayleigh statistic Z=nRˉ2Z = n\bar R^2?

Show the answer

Answer: 16

100×0.42=100×0.16=16100 \times 0.4^2 = 100 \times 0.16 = 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 Rˉ\bar R, 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.

09

Do it in CodeSplash

In the app

Run 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.

Python
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)
R
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)
10

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