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

**1.** The Chi-Square Goodness of Fit Test – Used to determine whether or not a categorical variable follows a hypothesized distribution.

**2.** The Chi-Square Test of Independence – 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**

Suppose we want to know if the percentage of M&M’s that come in a bag are as follows: 20% yellow, 30% blue, 30% red, 20% other. To test this, we open a random bag of M&M’s and count how many of each color appear.

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 this example 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 this example in Excel.

**Additional Resources**

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

Chi-Square Goodness of Fit Test Calculator

Chi-Square Test of Independence Calculator