MATH2209 Chap.9 Chi-Square Tests for Categorical Data
Chi-Square Tests for Categorical Data
Chi-square methods compare observed categorical counts with counts expected under a null model. Goodness of fit uses one categorical variable and specified proportions, while association crosses two categorical variables and tests independence.
This chapter builds expected counts from margins, checks their adequacy, calculates cell contributions and uses row percentages to explain the direction of an association without turning observational evidence into a causal claim.
What this chapter covers
- 01
Goodness-of-fit questions
- 02
Tests of association
- 03
Contingency-table margins
- 04
Expected frequencies
- 05
Cell contributions
- 06
Degrees of freedom and pattern interpretation
Worked example · free
Calculate expected counts for treatment response
- 1Each row totals 50 and the grand total is 100.
- 1Improved totals 60, so each improved expectation is 50 x 60 / 100 = 30.
- 1Not improved totals 40, so each expectation is 50 x 40 / 100 = 20.
- 1All expected counts exceed 5 under the course condition.
Key terms
- Expected Frequency
- The count predicted for a cell by the null model and observed margins.
- Contingency Table
- A table of counts crossing the categories of two variables.
- Cell Contribution
- One cell's squared observed-minus-expected difference divided by its expected count.
Chi-Square Tests for Categorical Data FAQ
When is goodness of fit appropriate?
Use it when one categorical variable's observed counts are compared with specified expected proportions. If the question asks whether two categorical variables are related, construct a contingency table and use a test of association instead.
Why does chi-square use counts rather than percentages?
Counts preserve sample-size information, which controls how surprising a discrepancy is. The same percentage gap from 20 observations and 2,000 observations should not produce equal evidence. Percentages are valuable for describing direction after the count-based test.
Does a significant association prove causation?
No. It shows that the categorical variables depart from independence under the test assumptions. Causal interpretation depends on study design, allocation, confounding and measurement. Report the observed pattern and design limitations alongside the significance result.
How do I check a chi-square table by hand?
Recalculate every row total, column total and the grand total before finding expectations. Each expected count is row total times column total divided by grand total, and the full expected table must reproduce the observed margins. Inspect expected frequencies before using the reference distribution.
Compute each nonnegative contribution from observed minus expected squared over expected and verify that the statistic is their sum. Degrees of freedom depend on the table dimensions, not the sample size. After comparing the p-value with alpha, calculate percentages in a direction that answers the research question and identify which categories create the observed pattern.
Retain counts because replacing them with percentages removes the sample-size information used by the test.
Assessment move
Rebuild contingency tables from word problems and verify every row, column and grand total. Label the variables and categories before entering counts so that a transposed cell does not reverse the comparison. Calculate row and column percentages in the direction that answers the research question, but retain raw counts for the test.
Decide whether the task is goodness of fit for one categorical variable or association between two categorical variables. For association, write the null as population independence and the alternative as an association. Calculate every expected count from row total times column total divided by the grand total.
Check that expected counts reproduce the same row and column margins and inspect the course condition before forming the statistic. For each cell, write observed, expected, difference, squared difference and contribution. Contributions cannot be negative because the discrepancy is squared. Sum them, calculate degrees of freedom as rows minus one times columns minus one, and compare the resulting p-value with alpha.
Use a separate table or coloured annotation to see which cells contribute most. After the decision, describe direction with conditional percentages. A chi-square statistic says that counts depart from independence; it does not say which category is higher until the observed pattern is examined.
Build one practice pair using the same counts: first a formal association test, then a descriptive paragraph comparing row percentages. Keep inference and description connected but distinct. Include sparse-table scenarios and explain why combining categories must be scientifically defensible rather than performed only to pass a condition.
Do not replace counts with percentages in the statistic because that discards sample-size information. Finish every conclusion by naming both categorical variables and the population. Add a design sentence: random sampling supports population generalisation, while random allocation may support a causal treatment interpretation.
An observational cross-tabulation can show association but cannot establish causation on the test result alone.
Working through Chi-Square Tests for Categorical Data in MATH2209? Sia is AskSia’s AI Statistics tutor — ask any MATH2209 Chi-Square Tests for Categorical Data question and get a clear, step-by-step explanation grounded in how MATH2209 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.