vivainsights.xicor¶
Calculate the Chatterjee (xi) correlation coefficient for a given metric.
- vivainsights.xicor.xicor(x, y, ties=True)[source]¶
Calculate Chatterjee’s rank correlation coefficient.
A measure of association between two variables, useful for identifying monotonic relationships.
- Parameters:
x (array-like) – Numeric array representing the independent variable.
y (array-like) – Numeric array representing the dependent variable.
ties (bool, optional) – Whether to handle ties in the data. Defaults to
True.
- Returns:
Chatterjee’s rank correlation coefficient.
- Return type:
float
- Raises:
ValueError – If
xandyhave different lengths.
Examples
Compute the correlation with tied values handled (default):
>>> from vivainsights import xicor >>> X = [1, 2, 3, 4, 5] >>> Y = [2, 1, 4, 3, 5] >>> xicor(X, Y)
Disable tie correction:
>>> xicor(X, Y, ties=False)