Welcome to staticrab’s documentation!

Staticrab is a python package aimed at fast(ish) calculation of correlation coefficients in python.

correlation.py

The module for fast correlation computation.

staticrab.correlation.chatterjee(x: numpy.ndarray, y: numpy.ndarray)float[source]

Computes the Chatterjee’s correlation measure.

The function computes the Chatterjee’s correlation measure. The algorithm is described at arXiv:1909.10140. It computes a deterministic version of the coefficients where the ties are not broken at random. To have the random breakage, randomly shuffle the input arrays before using this function.

Parameters
  • x – array of float64

  • y – array of float64, cannot be constant

Returns

Chatterjee’s correlation coefficient for x, y

Return type

float

Examples

>>> a = np.array(range(5), dtype=np.float64)
>>> chatterjee(a, a)
0.5
>>> a = np.array(range(2000), dtype=np.float64)
>>> chatterjee(a, a)
0.9985007496251874

Notes

There appeared another python implementation at https://github.com/czbiohub/xicor but the computed valus are different.

Indices and tables