The Chi-Squared Test Statistic Formula
You'll learn the mathematical formula that quantifies how far observed categorical data deviates from what we expected.
The Core Idea
The chi-squared test statistic measures the total discrepancy between what you observed in your data and what you expected under your null hypothesis. It does this by looking at each category separately, calculating how "surprised" you are by the difference, and adding up all those surprises into a single number.
The Formula
The chi-squared test statistic is calculated as:
χ² = Σ [(Observed - Expected)² / Expected]
Let's break this down:
- Observed: The actual count you got in each category
- Expected: The count you would expect if the null hypothesis were true (which you calculated in the previous lesson)
- (Observed - Expected)²: The squared difference (squaring ensures positive values and emphasizes larger deviations)
- / Expected: Dividing by the expected count standardizes the difference (a difference of 10 matters more when you expected 20 than when you expected 1000)
- Σ: Sum this value across all categories
Why This Works
Think of it like grading multiple choice answers. If you expected 25 people to choose option A but 30 did, that's less shocking than if you expected 5 but 30 chose it. Dividing by the expected count accounts for this scale difference. Squaring prevents positive and negative differences from canceling out, and gives extra weight to big surprises.
The larger your χ² statistic, the more your observed data disagrees with your null hypothesis.
Key Takeaway: The chi-squared test statistic sums the squared, standardized differences between observed and expected frequencies across all categories, producing a single measure of how well your data fits the hypothesized distribution.