Calculates the negative log-likelihood for estimating polychoric correlation from a contingency table of two ordinal variables.
polychoric_likelihood(rho, mat)
The negative log-likelihood value for the given correlation coefficient
Numeric value between -1 and 1, the correlation coefficient
A contingency table matrix for two ordinal variables
The function estimates thresholds from the marginal distributions and calculates the expected probabilities based on a bivariate normal distribution. It then computes the log-likelihood by comparing observed and expected frequencies.