Wiki Page, Math 13 - Perez Sandbox : Module 27 - Chi-Square Test of Independence (2a of 3)

Wiki Page
2026-01-17T21:15:47-08:00

Here we continue our discussion of the chi-square test of independence for the variables gender and body image in the population of U.S. college students.

EXAMPLE Gender and body image continued

Step 1: State the hypotheses

Here are our hypotheses from the previous page:

: There is no relationship between gender and body image for U.S. college students. (The variables are independent.)

: There is a relationship between gender and body image for U.S. college students. (The variables are dependent.)

Step 2: Collect and analyze the data

If the variables are independent, the percentage of males and females with a given response will be the same or at least close. Previously, we determined that in our sample, there are differences in the percentage of males and females who answer “about right,” “overweight,” or “underweight.”

Conditional Percentages

| About right | Overweight | Underweight | Row Totals

Female

560/760
73.68%

163/760
21.45%

37/760
4.87%

760/760
100%

Male

295/440
67.00%

72/440
16.36%

73/440
16.59%

440/440
100%

Column Totals

855/1200
71.25%

235/1200
19.58%

110/1200
9.17%

1200/1200
100%

If gender and body image are independent, then percents
in a response variable category (columns in the this table) are the same.

We need to determine if these differences are typical in random samples from a population where gender and body image are independent. Perhaps the differences we see in this sample are just fluctuations expected in random sampling. Or perhaps these differences are too large to be explained by chance when the variables are independent. We will not know until we complete the hypothesis test.

Step 3: Assess the evidence

In this part of the hypothesis test, we find the test statistic and use it to find the P-value. (Of course, we will also need to learn the conditions that allow for use of the probability model.)

The chi-square test statistic compares the observed counts with expected counts, where the expected counts are what we expect to see when the null hypothesis is true (the variables are independent). Before we introduce the formula for the chi-square test statistic, we will examine what we mean by "expected counts" in more detail.

Calculating Expected Values for a Test of Independence

Expected counts always describe what we expect to see in a sample if the null hypothesis is true. In this situation, if gender and body image are independent, then we expect the percentage of students who answer “about right” in the sample to be the same percentage of male (or female) students who answer “about right” (similarly for “overweight” or “underweight” responses). Therefore, to find the expected number in a group with a given response, we multiply the group total by the baseline percentage for that response.

Here are the calculations of expected counts for the response “about right”:

In the sample a student will answer “about right” 71.25% of the time: (855/1,200) = 0.7125
So if gender does not impact a student's perception of personal body weight (i.e. the null hypothesis is true), then we expect 71.25% of females and 71.25% of males will answer "about right."

Expected count of females in the sample who will answer “about right” is 71.25% of the females in the sample: 0.7125(760) = 541.5

Expected count of males in the sample who will answer “about right” is 71.25% of the males in the sample: 0.7125(440) = 313.5

Expected Counts

| About right | Overweight | Underweight | Row Totals
Female | 541.5 | 148.8 | | 760
Male | 313.5 | 86.2 | | 440
Column Totals | 855 | 235 | 110 | 1200

Here are the calculations of expected counts for the response “overweight”:

In the sample a student will answer “overweight” 19.58% of the time: (235/1,200) = 0.1958
If the null hypothesis is true (gender does not affect perception of personal weight), then we expect 19.58% of females and 19.58% of males who will answer "overweight."

Expected count of females in the sample who will answer “overweight”: 0.1958(760) = 148.8
There are 760 females in the sample. We expect 19.58% of them to answer "overweight" if the null hypothesis is true, so 148.8 females are expected to give this response.

Expected count of males in the sample who will answer “overweight”: 0.1958(440) = 86.2
There are 440 males in the sample. We expect 19.58% of them to answer "overweight" if the null hypothesis is true, so 86.2 males are expected to give this response.

We will pause to practice finding expected counts before we continue with the formula for the chi-square test statistic.