Chi-square tests help students analyze categorical data and decide whether observed counts differ from what a model or comparison predicts. This cheat sheet covers the goodness-of-fit test, the test of independence, and the test of homogeneity. These tests are important because many real data sets involve counts in categories rather than measurements like height or time.
A clear reference helps students choose the correct test, compute expected counts, and interpret results correctly.
All three tests use the chi-square statistic , where is an observed count and is an expected count. A larger value means the observed counts are farther from the expected counts. The p-value is found from a chi-square distribution using the correct degrees of freedom.
Students should always check that data are counts, observations are independent, and expected counts are large enough before using the test.
Key Facts
- The chi-square test statistic for all three tests is .
- For a goodness-of-fit test with categories and no estimated parameters, the degrees of freedom are .
- For a test of independence or homogeneity in an table, the degrees of freedom are .
- For a two-way table, the expected count in a cell is .
- A goodness-of-fit test compares one categorical variable to a claimed distribution, such as , , and .
- A test of independence checks whether two categorical variables from one population are associated or independent.
- A test of homogeneity compares the distribution of one categorical variable across two or more populations or treatments.
- A small p-value, usually , gives evidence against the null hypothesis and supports the alternative hypothesis.
Vocabulary
- Observed count
- An observed count is the actual number of data values recorded in a category or table cell.
- Expected count
- An expected count is the count predicted by the null hypothesis for a category or table cell.
- Chi-square statistic
- The chi-square statistic measures the total squared difference between observed and expected counts, scaled by expected counts.
- Degrees of freedom
- Degrees of freedom describe which chi-square distribution to use when finding the p-value.
- Goodness-of-fit test
- A goodness-of-fit test determines whether the distribution of one categorical variable matches a claimed distribution.
- Test of independence
- A test of independence determines whether two categorical variables in one population are associated.
Common Mistakes to Avoid
- Using proportions instead of counts in the formula is wrong because is based on counts, not percentages.
- Confusing independence and homogeneity is wrong because independence uses one random sample from one population, while homogeneity compares separate samples or groups.
- Forgetting to check expected counts is wrong because the chi-square approximation may not be reliable when expected counts are too small.
- Using for a two-way table is wrong because independence and homogeneity tests use .
- Concluding that the null hypothesis is true is wrong because a large p-value means there is not enough evidence to reject the null, not proof that it is true.
Practice Questions
- 1 A six-sided die is rolled times, and the observed counts are , , , , , and . Find the expected count for each side and compute the chi-square contribution for the side rolled times.
- 2 A survey table has rows and columns. Find the degrees of freedom for a chi-square test of independence.
- 3 In a two-way table, one cell has row total , column total , and grand total . Find the expected count for that cell using .
- 4 A researcher compares favorite music genre across students from three different schools. Explain whether this situation calls for a goodness-of-fit test, a test of independence, or a test of homogeneity.
Understanding Chi-Square Tests Goodness-of-Fit, Independence, Homogeneity
The three chi-square tests can use a table that looks similar, but the study design decides which test is appropriate. A goodness-of-fit test starts with one group of people or objects and one categorical variable. For example, a teacher may record students' preferred lunch option and compare the results with a district claim.
An independence test starts with one random sample from one population, then records two categorical variables for every individual. A survey might record both grade level and preferred study location. A homogeneity test begins with separate samples from different populations or separate treatment groups.
Researchers might compare preferred study locations among students from several schools. Independence concerns a relationship within one population. Homogeneity concerns whether groups share the same distribution.
Expected counts describe what the data would look like if the null hypothesis were true. In a two-way table, the null model says that knowing a person's row category gives no information about that person's column category. The row total shows how many people belong to that row group.
The column total shows the overall share in a column category. Multiplying these amounts and dividing by the grand total combines those two pieces of information. For instance, if forty percent of all students choose the library, the null model expects about forty percent of each row group to choose the library.
Expected counts often contain decimals. This is normal because they are model predictions, not actual people.
Each cell contributes to the final test statistic. A cell with an observed count far from its expected count contributes more than a cell with a small difference. The division by the expected count matters.
A difference of five is more surprising when only ten cases were expected than when two hundred cases were expected. After a significant result, students should inspect the observed and expected counts to see the pattern behind the result. Large positive differences show categories that occurred more often than the model predicted.
Large negative differences show categories that occurred less often. The chi-square result alone does not identify the cause of an association or difference.
Good inference depends on careful data collection. Counts must come from categories that do not overlap, so each individual belongs in one cell only. Observations need to be independent.
One student's response should not change another student's response, and the same person should not be counted twice. Random sampling supports conclusions about a wider population. Random assignment supports claims that a treatment caused a difference.
Expected counts must be sufficiently large for the chi-square distribution to give a reliable p-value. When expected counts are too small, combining sensible categories or using a different method may be necessary.
A non-significant result does not prove that categories are identical or independent. It means the sample did not provide strong enough evidence to reject the null model.