Chi-square test

The chi-square test looks at the variables on the side and top axes of a table and tests whether they are independent. For example, it can be used to show whether or not variations in political opinions depend on the respondent's age.

The test compares the actual counts in each cell with the counts that would be expected in each cell if there were no relationship between the variables. The chi-square statistic provides a summary of the discrepancy between the actual and expected counts. The greater the dependence between the two variables, the larger the discrepancy will be, so a large chi-square statistic indicates dependence between the two variables.

The p value associated with the chi-square test can be distorted if any cells in the table have very low expected counts (below 5).

Fisherâ€™s exact test

The chi-square test can be used for any number of rows and columns, but gives only an estimated probability value. For a table (or section of a table) that contains two rows and two columns of data, a more accurate test is Fisher's exact test, which finds the exact probability value for the table.

Fisher's exact test is appropriate only for tables, or parts of tables, with two rows and two columns that contain values (for example, a nested section of a larger table might be valid for this test). Rows and columns with no respondent data are ignored by the test, so a table with two rows and two columns might not be valid if, for example, one of the rows has no data. Conversely, a table with three rows and two columns might be suitable for the test if one of the rows has no data.

You can use this test on its own or in addition to the chi-square test. If you request the chi-square test and Fisher's exact test on the same table, a single chi-square column is used to display the results for both tests. If you request Fisher's exact test on a table that does not meet the requirements, it is not carried out.

The value returned by Fisher's exact test is the two-tailed p value, which does not distinguish between significantly high and significantly low results.

See also