*130*

**Chi-Square Tests** and **t-Tests **are two of the most common types of statistical tests. Thus, it’s important to understand the difference between these two tests and how to know when to use each one based on the problem you want to answer.

This tutorial provides a simple explanation of the difference between the two tests, along with when to use each one.

**Chi-Square Test**

There are actually a few different versions of the chi-square test, but the most common one is the Chi-Square Test of Independence.

**Definition**

We use a** chi-square test for independence** when we want to formally test whether or not there is a statistically significant association between two categorical variables.

The hypotheses of the test are as follows:

**Null hypothesis** (H_{0}): There is no significant association between the two variables.

**Alternative hypothesis:** (Ha): There *is* a significant association between the two variables.

**Examples**

Here are some examples of when we might use a chi-square test for independence:

**Example 1: **We want to know if there is a statistically significant association between gender (male, female) and political party preference (republican, democrat, independent). To test this, we might survey 100 random people and record their gender and political party preference. Then, we can conduct a chi-square test for independence to determine if there is a statistically significant association between gender and political party preference.

**Example 2: **We want to know if there is a statistically significant association between class level (freshman, sophomore, junior, senior) and favorite movie genre (thriller, drama, western). To test this, we might survey 100 random students from each grade level at a certain school and record their favorite movie genre. Then, we can conduct a chi-square test for independence to determine if there is a statistically significant association between class level and favorite movie genre.

**Example 3: **We want to know if there is a statistically significant association between a person’s favorite sport (basketball, baseball, football) and where they grew up (urban, rural). To test this, we might survey 100 random people and ask them what type of place they grew up in and what their favorite sport is. Then, we can conduct a chi-square test for independence to determine if there is a statistically significant association between a person’s favorite sport and where they grew up.

**Assumptions**

Before we can conduct a chi-square test for independence, we first need to make sure the following assumptions are met to ensure that our test will be valid:

**Random:**A random sample or random experiment should be used to collect the data for both samples.**Categorical:**The variables we are studying should be categorical.**Size:**The expected number of observations at each level of the variable should be at least 5.

If these assumptions are met, then we can then conduct the test.

**t-Test**

There are also a few different versions of the t-test, but the most common one is the t-test for a difference in means.

**Definition**

We use a **t-test for a difference in means **when we want to formally test whether or not there is a statistically significant difference between two population means.

The hypotheses of the test are as follows:

**Null hypothesis** (H_{0}): The two population means are equal.

**Alternative hypothesis:** (Ha): The two population means are not equal.

*Note: It’s possible to test whether one population mean is greater or less than the other, but the most common null hypothesis is that both means are equal.*

**Examples**

Here are some examples of when we might use a t-test for a difference in means:

**Example 1: **We want to know if diet *A *or diet *B *leads to greater weight loss. We randomly assign 100 people to follow diet *A *for two months and another 100 people to follow diet *B *for two months. We can conduct a t-test for a difference in means to determine if there is a statistically significant difference in average weight loss between the two groups.

**Example 2: **We want to know if two different study plans lead to different exam scores for students. We randomly assign 50 students to use one study plan and 50 students to use another study plan for one month leading up to an exam. We can conduct a t-test for a difference in means to determine if there is a statistically significant difference in average exam scores between the two study plans.

**Example 3: **We want to know if students from two different schools have the same average height. We measure the height of 100 random students from one school and 100 random students from another school. We can conduct a t-test for a difference in means to determine if there is a statistically significant difference in average height of students between the two schools.

**Assumptions**

Before we can conduct a hypothesis test for a difference between two population means, we first need to make sure the following conditions are met to ensure that our hypothesis test will be valid:

**Random:**A random sample or random experiment should be used to collect data for both samples.**Normal:**The sampling distribution is normal or approximately normal.**Independence:**The two samples are independent.

If these assumptions are met, then we can then conduct the hypothesis test.

**How to Know When to Use Each Test**

Here is a brief summary of each test:

**Chi-Square Test for independence: **Allows you to test whether or not not there is a statistically significant association between two *categorical* variables. When you reject the null hypothesis of a chi-square test for independence, it means there is a significant association between the two variables.

**t-Test for a difference in means: **Allows you to test whether or not there is a statistically significant difference between two population means. When you reject the null hypothesis of a t-test for a difference in means, it means the two population means are not equal.

The easiest way to know whether or not to use a chi-square test vs. a t-test is to simply look at the types of variables you are working with.

If you have two variables that are both categorical, i.e. they can be placed in categories like *male*, *female* and *republican*, *democrat*, *independent*, then you should use a chi-square test.

But if one variable is categorical (e.g. type of study plan – either plan 1 or plan 2) and the other is continuous (e.g. exam score – measured from 0 to 100), then you should use a t-test.