Chi-Square Test Calculator
Analyze a contingency table for independence or compare observed category counts with fully specified expected counts using the Pearson chi-square statistic.
Expected counts are part of the chi-square result, not a hidden detail
Independence mode builds each expected cell from its row total, column total and the grand total, then sums the Pearson χ² contributions across the table. Goodness-of-fit mode compares entered observed counts with fully specified expected counts that must sum to the same total.
The page reports the minimum expected count and how many expected cells fall below 5 because sparse tables can weaken the chi-square approximation. It does not silently switch to Yates correction or Fisher’s exact test.
Privacy: calculator inputs are processed in your browser; Lynara does not need to upload these values to calculate the result.
Formula
χ² = Σ(O − E)²/E; independence Eᵢⱼ = row total × column total ÷ grand total; p = P(Χ²df ≥ χ²)
Example
For a 2×2 table [[86,14],[80,20]], χ² ≈ 1.276 with 1 degree of freedom; expected counts are 83, 17, 83 and 17.
References for this method
Useful for
- Contingency-table independence tests
- Categorical-data homework
- Goodness-of-fit checks
- Inspecting expected counts
Questions
What expected-count rule does Lynara show?
The page flags expected counts below 5 because the chi-square approximation can become unreliable with sparse cells.
Does a small p-value prove two variables are related?
No. It indicates the observed table would be unusual under the entered independence model; study design, assumptions and subject-matter interpretation remain separate.