pingouin.circ_rayleigh

pingouin.circ_rayleigh(angles, w=None, d=None)[source]

Rayleigh test for non-uniformity of circular data.

Parameters
angles1-D array_like

Samples of angles in radians. The range of angles must be either $$[0, 2\pi]$$ or $$[-\pi, \pi]$$. If angles is not expressed in radians (e.g. degrees or 24-hours), please use the pingouin.convert_angles() function prior to using the present function.

warray_like

Number of incidences per bins (i.e. “weights”), in case of binned angle data.

dfloat

Spacing (in radians) of bin centers for binned data. If supplied, a correction factor is used to correct for bias in the estimation of r.

Returns
zfloat

Z-statistic

pvalfloat

P-value

Notes

The Rayleigh test asks how large the resultant vector length R must be to indicate a non-uniform distribution (Fisher 1995).

H0: the population is uniformly distributed around the circle HA: the populatoin is not distributed uniformly around the circle

The assumptions for the Rayleigh test are that (1) the distribution has only one mode and (2) the data is sampled from a von Mises distribution.

Examples

1. Simple Rayleigh test for non-uniformity of circular data.

>>> from pingouin import circ_rayleigh
>>> x = [0.785, 1.570, 3.141, 0.839, 5.934]
>>> z, pval = circ_rayleigh(x)
>>> print(round(z, 3), round(pval, 6))
1.236 0.304844

1. Specifying w and d

>>> z, pval = circ_rayleigh(x, w=[.1, .2, .3, .4, .5], d=0.2)
>>> print(round(z, 3), round(pval, 6))
0.278 0.806997