# When to use a Chi-Square Test (With Examples)?

The Chi-Square Test is used to determine if there is a statistically significant association between two categorical variables. It is a type of hypothesis test, which is used to compare observed data with expected data and is used to determine how likely it is that any observed difference between the two sets of data occurred by chance. Examples of when to use a Chi-Square Test include determining if there is a relationship between gender and voting preference, or between different age groups and their preference for a particular product.

In statistics, there are two different types of Chi-Square tests:

1. – Used to determine whether or not a categorical variable follows a hypothesized distribution.

2. – Used to determine whether or not there is a significant association between two categorical variables.

Note that both of these tests are only appropriate to use when you’re working with categorical variables. These are variables that take on names or labels and can fit into categories. Examples include:

• Eye color (e.g. “blue”, “green”, “brown”)
• Gender (e.g. “male”, “female”)
• Marital status (e.g. “married”, “single”, “divorced”)

This tutorial explains when to use each test along with several examples of each.

### The Chi-Square Goodness of Fit Test

You should use the Chi-Square Goodness of Fit Test whenever you would like to know if some categorical variable follows some hypothesized distribution.

Here are some examples of when you might use this test:

Example 1: Counting Customers

A shop owner wants to know if an equal number of people come into a shop each day of the week, so he counts the number of people who come in each day during a random week.

He can use a Chi-Square Goodness of Fit Test to determine if the distribution of customers follows the theoretical distribution that an equal number of customers enters the shop each weekday.

Example 2: Testing if a Die is Fair

Suppose a researcher would like to know if a die is fair. She decides to roll it 50 times and record the number of times it lands on each number.

She can use a Chi-Square Goodness of Fit Test to determine if the distribution of values follows the theoretical distribution that each value occurs the same number of times.

Example 3: Counting M&M’s

We can use a Chi-Square Goodness of Fit Test to determine if the distribution of colors is equal to the distribution we specified.

For a step-by-step example of a Chi-Square Goodness of Fit Test, check out in Excel.

### The Chi-Square Test of Independence

You should use the Chi-Square Test of Independence when you want to determine whether or not there is a significant association between two categorical variables.

Here are some examples of when you might use this test:

Example 1: Voting Preference & Gender

Researchers want to know if gender is associated with political party preference in a certain town so they survey 500 voters and record their gender and political party preference.

They can perform a Chi-Square Test of Independence to determine if there is a statistically significant association between voting preference and gender.

Example 2: Favorite Color & Favorite Sport

Researchers want to know if a person’s favorite color is associated with their favorite sport so they survey 100 people and ask them about their preferences for both.

They can perform a Chi-Square Test of Independence to determine if there is a statistically significant association between favorite color and favorite sport.

Example 3: Education Level & Marital Status

Researchers want to know if education level and marital status are associated so they collect data about these two variables on a simple random sample of 2,000 people.

They can perform a Chi-Square Test of Independence to determine if there is a statistically significant association between education level and marital status.

For a step-by-step example of a Chi-Square Test of Independence, check out in Excel.

The following calculators allow you to perform both types of Chi-Square tests for free online:

x