A generalization of the polychoric correlation coefficient