Chi-squared tests are used to test for differences between observed frequencies and frequencies that were expected under the null hypothesis. The general form of the test statistic is:
where O= the number of observed events, and E=the number of expected events under the null hypothesis. The probability of observing these differences under the null hypothesis can then be estimated using the chi-squared distribution. In a sense, the chi-squared distribution can be thought of as a series of distributions, which vary based on the degrees of freedom (df). Two examples are shown below for four degrees of freedom and ten degrees of freedom.
Critical values of chi-squared for different levels of significance (α levels) can be obtained from tables of the chi-square distribution, such as the one shown below. Note that the first column on the left indicates the degrees of freedom, and the next five columns list the corresponding critical values of χ2 for the α-levels listed in the row at the top. Therefore, for a two by two contingency table which has one degred of freedom, the critical value is 3.84 at an alpha level of 0.05. One can also estimate p-values from the table based on χ2 and the degrees of freedom by interpolating. Alternatively, p-values can be obtained by using R or the "CHITEST" function in Excel.