ordinalcorr.polyserial¶
- ordinalcorr.polyserial(x: ArrayLike, y: ArrayLike) float[source]¶
Estimate the polyserial correlation coefficient between a continuous variable x and an ordinal variable y using the two-step maximum likelihood estimation.
The polyserial correlation assumes that the ordinal variable y is a thresholded representation of latent continuous variable that follows a normal distribution.
- Parameters:
x (array_like (float | int)) – Continuous variable.
y (array_like (int)) – Ordinal variable.
- Returns:
Estimated polyserial correlation coefficient.
- Return type:
float
Examples
>>> from ordinalcorr import polyserial >>> x = [0.1, 0.1, 0.2, 0.2, 0.3, 0.3] >>> y = [0, 0, 0, 1, 1, 2] >>> round(polyserial(x, y), 4) 0.9017
References