Chi-Square Tests and Two-Way Tables
A free Statistics and Data Analysis lesson from the “Inference and Conclusions” unit, with a worked example and practice problems including step-by-step solutions.
For a two-way count table under independence, each expected count is row total × column total / grand total. Add (observed−expected)²/expected over all cells to calculate chi-square, with df=(rows−1)(columns−1). Check the sampling design, independent observations and sufficiently large expected counts; sparse tables need an appropriate alternative. Compare with a chi-square reference distribution or the supplied critical value. A small p-value supports association, not a causal claim by itself. Each person must contribute to the intended table structure consistently.
What you'll learn
- Recognize chi-square test situations
- Compare observed and expected counts
- Interpret evidence of association
Worked example
Problem. For table [[28,22],[22,28]], all four expected counts are 25. Calculate chi-square.
- Each squared discrepancy is 9.
- Sum four contributions: 4×9/25=1.44.
Answer: 1.44
Lesson preview: this page shows 5 practice items. The interactive activity contains 8 practice items and 8 quiz items (typed response and multiple choice). Counts include repeated prompts and variants.
Practice problems
1. A 2×2 table is [[28,22],[22,28]]. All row and column totals are 50, and N=100. Under independence, find the expected upper-left count.
Show solution
- Expected=row total×column total/grand total=50×50/100=25.
Answer: 25
2. An observed count is 28 and the expected count is 25. Find that cell's chi-square contribution.
Show solution
- Contribution=(28−25)²/25=9/25=0.36.
Answer: 0.36
3. For table [[28,22],[22,28]], all four expected counts are 25. Calculate chi-square.
Show solution
- Each squared discrepancy is 9.
- Sum four contributions: 4×9/25=1.44.
Answer: 1.44
4. What are the degrees of freedom for a 2×2 chi-square independence test?
Show solution
- df=(rows−1)(columns−1)=(2−1)(2−1)=1.
Answer: 1
5. At alpha=.05 and df=1, the chi-square critical value is 3.841. For chi-square=1.44, choose the conclusion.
Choices: Prove a causal effect · Prove the variables are independent · Fail to reject independence; the evidence is insufficient · Reject independence; there is evidence of association
Show solution
- Compare 1.44 with 3.841.
- The test addresses association; the study design determines causal scope.
Answer: Fail to reject independence; the evidence is insufficient
Explain and apply
Complete these tasks on paper. Use the rubric to review your reasoning with a teacher or study partner; these tasks are not automatically scored.
Analyze a two-way table from start to conclusion
A simple random sample of 120 adults yields counts [[40,20],[20,40]] for housing category (rows) and pet ownership (columns). Row and column totals are all 60. Test independence at alpha=.05 using df=1 and critical value 3.841. State conditions, calculate all expected counts and contributions, and write a contextual conclusion.
Review rubric and solution
- Identify two categorical variables and H0: independence.
- Check random sampling, independent observations and expected counts.
- Every expected count is 60×60/120=30.
- Each contribution is 100/30; total chi-square=13.333.
- Reject independence and report association, without claiming causation.
- Expected counts are [[30,30],[30,30]].
- Chi-square=4×100/30≈13.333, greater than 3.841.
- There is evidence that housing category and pet ownership are associated in the represented population. This observational table does not identify a causal direction.
Practice this interactively with instant feedback and an AI tutor.
Practice Chi-Square Tests and Two-Way Tables Take the free placement check