Chi-Square — Goodness of Fit & Independence
χ² = Σ(O-E)²/E. Test if observed matches expected. Goodness-of-fit: one variable. Independence: two-way table. Cramér's V for effect size.
Why This Statistical Analysis Matters
Why: Chi-square tests categorical associations. Dice fairness, genetics, surveys, A/B tests. When expected < 5, consider Fisher's exact.
How: Goodness-of-fit: enter observed and expected (or equal). Independence: enter contingency table. Get χ², p-value, df, Cramér's V.
- ●χ² = Σ(O-E)²/E
- ●Cramér's V effect size
- ●df = (r-1)(c-1) for independence
Chi-Square Tests — Categorical Data Analysis
Goodness-of-fit and test of independence. χ² statistic, p-value, Cramér's V, residuals. Dice fairness, genetics, surveys, quality control.
Real-World Scenarios — Click to Load
Goodness-of-Fit Data
Chi-Square Distribution (df=5) — Rejection Region & p-value
Observed vs Expected
Calculation Breakdown
For educational and informational purposes only. Verify with a qualified professional.
📈 Statistical Insights
χ² = Σ(O-E)²/E
— Pearson 1900
Cramér's V: effect size
— Independence
df = (r-1)(c-1)
— Independence
Key Takeaways
- • χ² = Σ(O − E)²/E — measures discrepancy between observed and expected frequencies
- • Goodness of fit: df = k − 1. Independence: df = (r−1)(c−1)
- • Assumption: each expected frequency ≥ 5. If not, combine categories or use Fisher's exact for 2×2
- • Yates correction: for 2×2 tables with small counts, use |O−E|−0.5 before squaring
- • Cramér's V: effect size for independence. V < 0.1 negligible, 0.1–0.3 small–medium, > 0.3 large
Did You Know?
How Chi-Square Tests Work
1. Goodness of Fit
H₀: data follow a specified distribution. χ² = Σ(Oᵢ − Eᵢ)²/Eᵢ. df = k − 1.
2. Test of Independence
H₀: two categorical variables are independent. Eᵢⱼ = (row total × col total) / grand total. df = (r−1)(c−1).
3. P-value
p = 1 − CDF(χ², df) from the chi-square distribution. Reject H₀ if p < α.
4. Cramér's V
V = √(χ²/(n×min(r−1,c−1))). Effect size: 0.1 small, 0.3 medium, 0.5 large.
5. Yates correction
For 2×2 tables with small expected counts, use (|O−E|−0.5)²/E to reduce Type I error.
Expert Tips
Expected ≥ 5
If any E < 5, combine categories or use Fisher's exact test for 2×2.
Yates for 2×2
Use Yates correction when expected counts are small (e.g., 5–10).
Report effect size
Always report Cramér's V with the chi-square test of independence.
Fisher's exact
For 2×2 with small n, Fisher's exact test is more appropriate than chi-square.
Why Use This Calculator vs Other Tools?
| Feature | This Calculator | Excel | R chisq.test | SPSS |
|---|---|---|---|---|
| Goodness of fit + Independence | ✅ | ⚠️ Manual | ✅ | ✅ |
| Cramér's V | ✅ | ❌ | ⚠️ Package | ✅ |
| Expected table + residuals | ✅ | ❌ | ⚠️ Manual | ✅ |
| Yates correction | ✅ | ❌ | ✅ | ✅ |
| Observed vs Expected chart | ✅ | ❌ | ❌ | ❌ |
| Chi-square distribution viz | ✅ | ❌ | ❌ | ❌ |
| No installation | ✅ | ❌ | ❌ | ❌ |
Frequently Asked Questions
When should I use Yates correction?
For 2×2 contingency tables when expected frequencies are between 5 and 10. For expected < 5, use Fisher's exact test instead.
What if my expected frequencies are less than 5?
Combine categories to increase expected counts, or use Fisher's exact test for 2×2 tables. The chi-square approximation breaks down when E < 5.
What is Cramér's V and how do I interpret it?
Cramér's V is an effect size for the chi-square test of independence. V < 0.1 = negligible, 0.1–0.3 = small to medium, 0.3–0.5 = medium to large, > 0.5 = large.
What is the difference between goodness of fit and test of independence?
Goodness of fit: one variable, test if it follows a specified distribution. Independence: two variables, test if they are associated.
When should I use Fisher's exact test?
For 2×2 tables when expected cell counts are small (< 5). Fisher's exact computes the exact probability rather than relying on the chi-square approximation.
Chi-Square by the Numbers
Official Sources
Disclaimer: This calculator uses the regularized incomplete gamma function for the chi-square CDF. Results are accurate for typical use. When expected frequencies are < 5, consider Fisher's exact test for 2×2 tables. Verify critical applications with established statistical software.
Related Calculators
P-Value Calculator
Compute p-values from test statistics for z, t, chi-square, and F distributions. One-tailed and two-tailed tests. Significance stars and decision rule.
StatisticsCritical Value Calculator
Find critical values for z, t, chi-square, and F distributions given significance level and degrees of freedom.
StatisticsFisher's Exact Test Calculator
Performs Fisher's exact test on a 2×2 contingency table. Exact p-value (not approximation like chi-square). Preferred for small samples.
StatisticsF-statistic Calculator
Computes F-statistic and p-value for ANOVA, regression F-test, and variance ratio tests. Includes F-distribution visualization.
StatisticsZ-test Calculator
Performs z-tests: one-sample (σ known), two-sample, one-proportion, two-proportion. CI, effect size, power.
StatisticsMcNemar's Test Calculator
Performs McNemar's test for paired nominal data (before/after, matched pairs). Tests whether row and column marginal frequencies are equal in a 2×2 table.
Statistics