Understanding the Chi-Square Test
The chi-square (χ²) test is a statistical test used to determine whether there is a significant difference between observed frequencies and expected frequencies in categorical data. Named after the Greek letter χ (chi), it's one of the most widely used tests for categorical data analysis.
Types of Chi-Square Tests
Goodness-of-Fit Test
Tests whether observed frequencies match an expected distribution. For example, testing if a die is fair (each outcome has equal probability) or if survey responses match expected proportions.
χ² = Σ (Oᵢ - Eᵢ)² / Eᵢ, df = k - 1Test of Independence
Tests whether two categorical variables are independent (unrelated) using a contingency table. For example, testing if there's an association between gender and voting preference.
Eᵢⱼ = (Row Total × Col Total) / Grand Total, df = (R-1)(C-1)Key Statistics
- χ² Statistic: Measures the total squared deviation between observed and expected frequencies, weighted by expected values.
- Degrees of Freedom: For GOF: k-1 (categories). For independence: (rows-1)×(cols-1).
- p-Value: Probability of observing a χ² value as extreme or more, under H₀.
- Residuals: (O-E)/√E shows which cells contribute most to χ².
Interpreting Residuals
Standardized residuals show the direction and magnitude of deviations:
- r > 0: Observed > Expected
- r < 0: Observed < Expected
- |r| > 2: Notable deviation
- |r| > 3: Strong deviation
Assumptions & Requirements
- Expected Frequency Rule: Each expected frequency should be at least 5. If not, consider combining categories or using Fisher's exact test.
- Independence: Observations must be independent of each other. Each subject/case can only appear in one cell.
- Categorical Data: Data must be counts or frequencies, not percentages, means, or continuous measurements.
- Random Sampling: Data should come from a random sample representative of the population.
Practical Tips
- • The chi-square test is always right-tailed (larger χ² = stronger evidence against H₀)
- • Report χ²(df) = value, p = value format (e.g., χ²(2) = 5.99, p = 0.050)
- • Use residuals to identify which cells drive the overall result
- • For 2×2 tables with small samples, consider Yates' continuity correction
- • Statistical significance doesn't imply practical importance—consider effect size
- • For post-hoc comparisons, consider Bonferroni correction for multiple tests
Frequently Asked Questions
Related Math & Statistics Tools
T-Test Calculator
Compare means with one-sample, two-sample, and paired t-tests
Probability Toolkit
Compute various probability calculations
Normal Distribution
Calculate probabilities under the normal curve
Descriptive Stats
Calculate mean, median, standard deviation, and more
Confidence Interval
Build confidence intervals for means and proportions
Z-Score / P-Value
Convert between z-scores and probabilities
Poisson Distribution
Calculate probabilities for count-based rare events
Sample Size for Proportions
Calculate required sample size for proportion-based statistical tests