Skills Focus: Selecting an Appropriate Inference Procedure for Categorical Data 🎯
Introduction: Choosing the Right Chi-Square Test
students, in AP Statistics, one of the most important skills in categorical inference is not doing the math first—it is choosing the correct procedure first. That choice matters because a good statistical conclusion depends on matching the question, the data, and the study design to the right method. In the chi-square unit, the three main procedures are the chi-square goodness-of-fit test, the chi-square test of homogeneity, and the chi-square test of independence.
By the end of this lesson, you should be able to:
- identify which chi-square procedure fits a situation,
- explain the vocabulary used in categorical inference,
- connect the structure of the data to the correct test, and
- use evidence from a study description to justify your choice.
A helpful idea to remember is this: when the data are categorical, the answer depends on what you are comparing and how the data were collected. Think of it like choosing the right tool in a toolbox 🧰. A hammer is useful for nails, but not for screws. In the same way, each chi-square procedure has a specific purpose.
The Big Picture: What Makes a Chi-Square Problem?
Chi-square procedures are used with categorical data, meaning the responses fall into categories rather than numerical measurements. Examples include favorite school subject, election choice, type of pet, or whether a light bulb failed early or lasted longer than expected.
All chi-square procedures compare observed counts to expected counts. The test statistic is based on how far the observed values are from what would be expected if the null idea were true. In AP Statistics, the general form is
$$\chi^2 = \sum \frac{(O - E)^2}{E}$$
where $O$ represents observed count and $E$ represents expected count.
The key difference among the three tests is what the expected counts come from:
- For a goodness-of-fit test, the expected counts come from a claimed distribution.
- For a test of homogeneity, the expected counts come from the idea that several populations have the same distribution.
- For a test of independence, the expected counts come from the idea that two categorical variables are unrelated within one population.
If you can identify where the counts come from, you can usually choose the right test.
Step 1: Ask the Most Important Questions
Before naming a test, students should ask these questions:
- How many categorical variables are there?
- How many populations or groups are being compared?
- Is the question about one distribution, several distributions, or a relationship between two variables?
- How were the data collected?
These questions help separate the three procedures.
Goodness-of-Fit
Use a goodness-of-fit test when there is one categorical variable and you want to check whether the observed counts match a claimed distribution.
Example: A candy company says its bag contains $30\%$ red, $20\%$ blue, $20\%$ green, and $30\%$ yellow candies. You sample a bag and want to see whether the proportions match the claim.
Here, there is one variable: candy color. The null hypothesis is that the category proportions match the claimed percentages.
Homogeneity
Use a test of homogeneity when you compare the distribution of one categorical variable across two or more populations or groups.
Example: A researcher surveys students from three different schools and asks which lunch option they prefer. The question is whether the distribution of lunch preferences is the same at all three schools.
Here, the variable is lunch preference, and the groups are the schools.
Independence
Use a test of independence when you examine whether two categorical variables are related within one population.
Example: A teacher wants to know whether students’ study habits and their preferred learning style are associated.
Here, there is one sample from one population, and two variables are measured on each individual.
Step 2: Understand the Data Structure
A very reliable way to select the right procedure is to look at the data table.
One-Way Table
A one-way table shows counts for one categorical variable. This usually points to a goodness-of-fit test.
Example:
- Red: $18$
- Blue: $12$
- Green: $10$
If there is a single set of categories and a claimed distribution, the natural test is goodness-of-fit.
Two-Way Table
A two-way table shows counts for two categorical variables. This could be either homogeneity or independence.
Example:
| | Yes | No |
|------------|-----|----|
| Group A | 20 | 15 |
| Group B | 12 | 18 |
| Group C | 25 | 10 |
If the rows are different groups or populations, this is often a homogeneity setting.
If the rows and columns represent two variables measured on one sample, this is often an independence setting.
This is why reading the context matters. The same table shape can lead to different conclusions depending on the story behind it.
Step 3: Match the Question to the Null Hypothesis
The null hypothesis tells you what the test is checking.
Goodness-of-Fit Null Hypothesis
The null says the distribution of one categorical variable matches a claimed distribution.
For example, if the claim is that a spinner lands on four colors equally often, then
$$H_0: p_1 = p_2 = p_3 = p_4 = 0.25$$
The alternative says the distribution is different in at least one category.
Homogeneity Null Hypothesis
The null says several populations have the same distribution for a categorical variable.
For example,
$$H_0: \text{The distribution of favorite fruit is the same across all grade levels}$$
The alternative says at least one population has a different distribution.
Independence Null Hypothesis
The null says two categorical variables are independent.
For example,
$$H_0: \text{Study method and test result are independent}$$
The alternative says the variables are associated.
Notice the pattern: goodness-of-fit compares data to a fixed claim, homogeneity compares groups, and independence compares variables.
Step 4: Identify the Expected Counts Logic
Expected counts are the counts you would expect if $H_0$ were true.
For a chi-square test, AP Statistics requires expected counts to be large enough for the approximation to be valid. A common rule is that all expected counts should be at least $5$.
Goodness-of-Fit Expected Counts
For each category,
$$E = np$$
where $n$ is the sample size and $p$ is the claimed proportion.
Homogeneity and Independence Expected Counts
For a cell in a two-way table,
$$E = \frac{(\text{row total})(\text{column total})}{\text{grand total}}$$
This formula is used for both homogeneity and independence.
If you see a two-way table and a claim about no association or no difference in distributions, this expected-count formula is a strong clue that the correct procedure is homogeneity or independence.
Step 5: Look at How the Data Were Collected
The design of the study helps determine the procedure.
Random Sample
A random sample from one population is often used in an independence test if two categorical variables are measured on each individual.
Random Assignment
Random assignment is used in experiments. If different treatments are applied and the outcome is categorical, chi-square methods may still be used, but AP Statistics often frames these as comparisons of distributions across treatment groups. In many textbook settings, that leads to a homogeneity-style setup.
Separate Samples from Different Groups
If samples come from different populations, such as different schools, states, or age groups, then homogeneity is usually the right choice.
This is an important distinction: if the groups are separate populations, think homogeneity. If the data come from one population and you measure two variables, think independence.
Worked Examples: Choosing the Procedure
Example 1: Candy Colors 🍬
A company claims its bag of candies has the color distribution $25\%$, $25\%$, $25\%$, and $25\%$. A student samples one bag and counts the colors.
This is a goodness-of-fit test because there is one categorical variable and one claimed distribution.
Example 2: Voting Preferences Across Cities 🗳️
A pollster compares voting preferences in three cities to see whether the distribution of choices is the same in all three locations.
This is a test of homogeneity because one categorical variable is being compared across several populations.
Example 3: Screen Time and Sleep 😴
A researcher surveys one group of students and records both daily screen time category and sleep quality category.
This is a test of independence because two categorical variables are measured on one sample.
Common Mistakes to Avoid
students, many students lose points by focusing too much on the formula and not enough on the setup. Here are common errors to avoid:
- Choosing a goodness-of-fit test when the problem is actually comparing several groups.
- Using independence when the study compares different populations.
- Forgetting that chi-square procedures are for categorical data, not numerical data.
- Ignoring the expected count condition.
- Not reading carefully to see whether there is one variable or two variables.
A good habit is to write a short sentence before any calculations: “This is a chi-square goodness-of-fit test because…” or “This is a chi-square test of independence because…” That sentence can help organize your thinking and support your reasoning.
Conclusion
Choosing the correct chi-square procedure is one of the most important skills in categorical inference. students, the main question is not “Which formula do I use?” but “What does the study ask, and how are the data structured?” If there is one categorical variable and a claimed distribution, use goodness-of-fit. If one categorical variable is compared across multiple groups, use homogeneity. If two categorical variables are measured on one sample to study association, use independence.
This skill connects directly to the broader chi-square topic because every chi-square test begins with the same core ideas: categorical data, observed counts, expected counts, and a null hypothesis about how the data should behave if there is no difference or no association. Once you can identify the correct procedure, the rest of the chi-square process becomes much more manageable ✅
Study Notes
- Chi-square methods are used for categorical data.
- The three main procedures are goodness-of-fit, homogeneity, and independence.
- Use a goodness-of-fit test for one categorical variable compared to a claimed distribution.
- Use a test of homogeneity to compare the distribution of one categorical variable across multiple populations or groups.
- Use a test of independence to determine whether two categorical variables are associated within one population.
- The chi-square test statistic is $\chi^2 = \sum \frac{(O - E)^2}{E}$.
- For goodness-of-fit, expected counts are $E = np$.
- For homogeneity and independence, expected counts are $E = \frac{(\text{row total})(\text{column total})}{\text{grand total}}$.
- A common condition for chi-square procedures is that all expected counts are at least $5$.
- Ask: How many variables? How many groups? What is being compared?
- One-way table → usually goodness-of-fit.
- Two-way table → usually homogeneity or independence.
- Separate populations → usually homogeneity.
- One sample with two categorical variables → usually independence.
- A correct test choice should always be justified with evidence from the context.
