API Reference

ordinalcorr - A Python package for ordinal correlation analysis

ordinalcorr.polychoric_corr(x: Sequence[float] | ndarray, y: Sequence[float] | ndarray) float[source]

Estimate the polychoric correlation coefficient between two ordinal variables.

Parameters:
  • x (array_like) – Ordinal variable X (integer-coded).

  • y (array_like) – Ordinal variable Y (integer-coded).

Returns:

Estimated polychoric correlation coefficient (rho).

Return type:

float

ordinalcorr.polyserial_corr(x: Sequence[float] | ndarray, y: ndarray) float[source]

Estimate the polyserial correlation coefficient between a continuous variable x and an ordinal variable y using maximum likelihood estimation.

Parameters:
  • x (array_like) – Continuous variable (standardized recommended).

  • y (array_like) – Ordinal variable (integer-coded, ordered categories).

Returns:

Estimated polyserial correlation coefficient (rho).

Return type:

float