ordinalcorr.polychoric

ordinalcorr.polychoric(x: ArrayLike, y: ArrayLike) float[source]

Estimate the polychoric correlation coefficient between two ordinal variables.

The polychoric correlation assumes that the two observed ordinal variables are thresholded representations of underlying continuous variables that follow a bivariate normal distribution.

Parameters:
  • x (array_like (int)) – Ordinal variable.

  • y (array_like (int)) – Ordinal variable.

Returns:

Estimated polychoric correlation coefficient.

Return type:

float

Examples

>>> from ordinalcorr import polychoric
>>> x = [1, 1, 2, 2, 3, 3]
>>> y = [0, 0, 0, 1, 1, 1]
>>> round(float(polychoric(x, y)), 4)
0.9986

References