The Chi-Square Test Statistic

The chi-square test statistic
is an overall measure of how close the
observed frequencies are to the expected frequencies. It has the form

The null hypothesis of independence is rejected if is large, because this means that observed frequencies and expected frequencies are far apart. The chi-square curve is used to judge whether the calculated test statistic is large enough. We reject

The P-value is the area greater than under the chi-square curve with (r-1)(c-1) degrees of freedom.