# pingouin.circ_corrcc

pingouin.circ_corrcc(x, y, tail='two-sided', correction_uniform=False)[source]

Correlation coefficient between two circular variables.

Parameters
xnp.array

First circular variable (expressed in radians)

ynp.array

Second circular variable (expressed in radians)

tailstring

Specify whether to return ‘one-sided’ or ‘two-sided’ p-value.

correction_uniformbool

Use correction for uniform marginals

Returns
rfloat

Correlation coefficient

pvalfloat

Uncorrected p-value

Notes

Adapted from the CircStats MATLAB toolbox (Berens 2009).

Use the numpy.deg2rad() function to convert angles from degrees to radians.

Please note that NaN are automatically removed.

If the correction_uniform is True, an alternative equation from Jammalamadaka & Sengupta (2001, p. 177) is used. If the marginal distribution of x or y is uniform, the mean is not well defined, which leads to wrong estimates of the circular correlation. The alternative equation corrects for this by choosing the means in a way that maximizes the postitive or negative correlation.

References

1

Berens, P. (2009). CircStat: A MATLAB Toolbox for Circular Statistics. Journal of Statistical Software, Articles, 31(10), 1–21. https://doi.org/10.18637/jss.v031.i10

2

Jammalamadaka, S. R., & Sengupta, A. (2001). Topics in circular statistics (Vol. 5). world scientific.

Examples

Compute the r and p-value of two circular variables

>>> from pingouin import circ_corrcc
>>> x = [0.785, 1.570, 3.141, 3.839, 5.934]
>>> y = [0.593, 1.291, 2.879, 3.892, 6.108]
>>> r, pval = circ_corrcc(x, y)
>>> print(r, pval)
0.942 0.06579836070349088


With the correction for uniform marginals

>>> r, pval = circ_corrcc(x, y, correction_uniform=True)
>>> print(r, pval)
0.547 0.28585306869206784