Formula for chi square test statistic