This function computes an estimate of the population homophily and the recruitment homophily based on a categorical variable.