Add chi-square pre-calculation