ADescribe · Guide test 263
Watson two sample U squared test
Tests equality of two circular distributions.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Comparing directions between groups (Watson–Williams, U², Wheeler, Wallraff, Rao) — Do two or more groups differ in their typical direction, their spread, or the whole distribution of directions?
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
Your data
Drag a point or use ↑/↓ to change itSectors 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
- The reference: how U² varies across samples when H₀ is true, the limiting distribution of the two-sample U² (the limiting U² distribution).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .207).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- the two groups' empirical circular CDFs
- their difference, centered so the starting direction does not matter
- 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 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
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.
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()
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
- circular — circular · watson.two.testAuthor documentation/source reviewed: circular 0.5-2.search.r-project.org
- watson.two.testsearch.r-project.org
- circularsearch.r-project.org
- rvonmisessearch.r-project.org
- 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.