ordinalcorr.tetrachoric¶
- ordinalcorr.tetrachoric(x: Sequence[int] | ndarray[int], y: Sequence[int] | ndarray[int]) float[source]¶
Estimate the tetrachoric correlation coefficient between two dichotomous variables.
The tetrachoric correlation assumes that the two observed dichotomous variables are thresholded representations of underlying continuous variables that follow a bivariate normal distribution.
This method is appropriate when both variables are dichotomous (e.g., yes/no, success/failure) but believed to originate from an underlying normally distributed process.
- Parameters:
x (array-like) – Dichotomous variable (consisting of 0 and 1).
y (array-like) – Dichotomous variable (consisting of 0 and 1).
- Returns:
Tetrachoric correlation coefficient.
- Return type:
float
Examples
>>> from ordinalcorr import tetrachoric >>> x = [0, 0, 1, 1, 1] >>> y = [0, 1, 0, 1, 1] >>> tetrachoric(x, y)