Computing the chi-squared threshold