Skip to content

ADescribe · Guide test 263

Watson two sample U squared test

Tests equality of two circular distributions.

Runs in CodeSplashPython (calls R) example not runR example validated

Do it in CodeSplash

In the app, set it up in Analyze with this method:

In Comparing directions between groups (Watson–Williams, U², Wheeler, Wallraff, Rao), choose Test = Watson two-sample U².

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 · Watson two-sample U² test

20
20
20
70
50
0.050

Your data

Drag a point or use ↑/↓ to change it
0°90°180°270°Group 1: n = 20, θ̄ = 42°, R̄ = 0.72Group 2: n = 20, θ̄ = 61°, R̄ = 0.68

Sectors are area-proportional counts; the arrows point to each mean direction, with length R̄ (0: no preferred direction, 1: all identical).

If H₀ were true

U² = 0.11
  1. The reference: how U² varies across samples when H₀ is true, the limiting distribution of the two-sample U² (the limiting U² distribution).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .207).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

U2=mn(m+n)2∑i=1m+nti (di−dˉ)2,di=Fm(θ(i))−Gn(θ(i))U^2=\frac{mn}{(m+n)^2}\sum_{i=1}^{m+n}t_i\,(d_i-\bar d)^2,\qquad d_i=F_m(\theta_{(i)})-G_n(\theta_{(i)})

With your numbers

U2=0.11,m=20, n=20U^2 = 0.11,\quad m = 20,\ n = 20
Fm, GnF_m,\ G_n
the two groups' empirical circular CDFs
di−dˉd_i - \bar d
their difference, centered so the starting direction does not matter
tit_i
multiplicity of tied directions

The verdict

U² = 0.11, p = .207

p > α = .050: compatible with H₀

Compares whole distributions (location, spread and shape); it does not say which feature differs. Read the dial to see where the groups part.

Statistic
0.115
p-value
0.2066
Watson two-sample U² test on Group 1 (°): n = 20; Group 2 (°): n = 20: U² = 0.11, p = .207. The p-value is above α = .050, so the data are compatible with H0.

Watson two-sample U² test on Group 1 (°): n = 20; Group 2 (°): n = 20: U² = 0.11, p = .207. The p-value is above α = .050, so the data are compatible with H₀.

Question and hypotheses

H0: two independent circular samples share one distribution.

Assumptions

Independent angular observations with a clear radians/degrees convention and orientation. The usual null uses a full circular domain; axial data require an appropriate doubling transformation or axial model. Samples must be independent; ties need a documented treatment.

Formula

U2=mn(m+n)2∑i=1m+n(di−dˉ)2di=Fm(θ(i))−Gn(θ(i))\begin{gathered}U^2=\frac{mn}{(m+n)^2}\sum_{i=1}^{m+n}(d_i-\bar d)^2\\[5pt] d_i=F_m(\theta_{(i)})-G_n(\theta_{(i)})\end{gathered}

Parameters and notation

Evaluate both empirical CDFs at pooled ordered angles; centering makes the statistic invariant to the circular origin.

Structure of the method

Pool and order the two circular samples, evaluate both empirical distributions at the pooled positions, center their difference across the circle, and integrate its squared value with the two-sample normalization. The statistic targets full distributional homogeneity, not merely equality of mean direction.

Estimated and nuisance parameters

Estimate the two empirical CDFs and centered discrepancy; no common von Mises concentration or mean direction needs to be fitted. Sample sizes enter the normalization. Tied pooled positions need consistent handling because arbitrary within-tie ordering can otherwise create artificial empirical differences.

Settings and design choices

Choose angular convention, independent versus paired design, tie handling, asymptotic/table versus permutation reference, and any directional interpretation. The package documentation recommends its asymptotic critical-value ranges for combined sample sizes above 17; smaller samples need appropriate small-sample or permutation calibration.

Fitting and adaptation

For independent exchangeable samples, permute group labels of complete angles and recompute the full statistic while retaining group sizes. Paired/repeated measurements require a design-aware alternative rather than unrestricted permutation. Adapting to another instrument also requires matching units and recording precision across groups.

Sensitivity and robustness

Inspect unequal sample sizes, low effective sample size, ties, multimodality, dispersion changes, and repeated-subject dependence. A significant result may reflect concentration or shape rather than different average orientation. If the scientific question is mean direction alone, report that distinction instead of interpreting an omnibus distribution test as a mean test.

How to use and calibrate

Use Watson two sample critical values or group label permutations.

Example application

Compare direction distributions between two conditions.

Interpretation and pitfalls

Watch out

The test can detect dispersion/shape differences as well as mean-direction shifts.

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

Two independent circular samples. Watson–Williams is a common-concentration von Mises mean-direction test; rank/distributional alternatives answer different questions. Synthetic kappa=4 provides a reasonably concentrated example.

Python · invokes R

Not run — Executed end to end through Rscript · needs Python standard library + Rscript; R packages: circular

# 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"""
set.seed(2026)
a<-circular::rvonmises(40,circular::circular(0),kappa=4);b<-circular::rvonmises(40,circular::circular(.3),kappa=4)
print(circular::watson.two.test(a,b))
"""
# 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()
R

Validated — Executed successfully in the validation environment · needs circular

set.seed(2026)
a<-circular::rvonmises(40,circular::circular(0),kappa=4);b<-circular::rvonmises(40,circular::circular(.3),kappa=4)
print(circular::watson.two.test(a,b))
Output
      Watson's Two-Sample Test of Homogeneity 

Test Statistic: 0.156 
0.05 < P-value < 0.10

Sources

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 263, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT263.