gastropy.rayleigh_test#
- gastropy.rayleigh_test(phases)[source]#
Rayleigh test for non-uniformity of circular data.
Tests the null hypothesis that the population is uniformly distributed around the circle against the alternative that there is a preferred direction (unimodal clustering).
- Parameters:
phases (array_like) – Phase values in radians.
- Returns:
z_stat (float) – Rayleigh’s z statistic (z = n * R^2).
p_value (float) – Approximate p-value.
References
Wilkie, D. (1983). Rayleigh test for randomness of circular data. Applied Statistics, 32, 311-312.
Examples
>>> import numpy as np >>> rng = np.random.default_rng(42) >>> uniform_phases = rng.uniform(-np.pi, np.pi, 200) >>> z, p = rayleigh_test(uniform_phases) >>> p > 0.05 # fail to reject uniformity True