### Chi-Squared

The Chi-Squared statistic is a means of testing for independence with categorical data. The test quantifies the likely effect of chance.

**Example:** To test whether eye colour and gender illustrate a significant difference from independence, or in other words, whether or not there is a relationship between the two variables.

The symbol ‘x’ is the Greek letter chi, pronounced ‘ki’. ‘x2’ is therefore chi-squared and sometimes these tests are referred to as the x2 test for contingency tables. There are a number of Excel functions that can be used for chi-squared tests.

### Contingency tables

Contingency tables are tables of counts, with categorical data in the rows and columns. Both variables must be mutually exclusive so every individual count value contributes to one cell only. This tables can be used to perform the chi-squared test for contingency tables.

### Chi-Squared test for association

The Chi-Squared test for association (Chi-Squared test or for independence) uses contingency tables and follows these steps:

- Set up a null and alternative hypotheses
- Calculate the Expected, Residual and x2 contribution tables (all Expected values should be >=5 for the Chi-Squared test to be appropriate)
- Calculate the test statistic (sum of all x2 contributions)
- Find the degrees of freedom: (rows-1) x (columns-1)
- Compare results against the critical values for the set p-value and degrees of freedom in order to conclude whether or not to reject the null hypothesis