Chi-squared goodness of fit test