The chi-square test is used to test if two Categorical Variable variables are independent.

It is an example of a Hypothesis Test.

Example

  • Testing if people who wear luminous vests to work are more likely to be injured more often than people who wear suits
  • Testing if an equal number of people come into a shop each day
  • Testing if gender has an impact on political party preference

Usage

To perform a chi-squared test:

  1. Formulate the hypotheses you wish to test
  2. Calculate the value of with the formula
  3. Calculate the degrees of freedom
  4. Use the tables to read a P-value
  5. Use the P-value to determine if the Null Hypothesis should be accepted or rejected.

Formula

Where

  • is the actual frequency of a value
  • is the expected value of the frequency
  • is the number of elements in the sample space you are running the chi-squared test on

Degrees of Freedom

The degrees of freedom for a chi-squared test can be calculated as:

Where

  • is the number of elements in the sample space you are running the chi-squared test on

Tables