2x2 Contingency Table Calculator
Enter observed counts for a 2x2 table to calculate Pearson's chi-square test (with optional Yates continuity correction), p-value, expected frequencies, and effect size.
| Outcome: Yes | Outcome: No | |
|---|---|---|
| Group: Exposed | ||
| Group: Not Exposed |
What this chi square calculator 2x2 does
A 2x2 chi-square test checks whether two categorical variables are associated. In plain language: it helps you test whether the pattern you observe in a two-by-two table is likely due to chance or whether there is evidence of a real relationship.
This calculator is designed for quick analysis of binary data, such as:
- Treatment vs no treatment and improved vs not improved
- Smoker vs non-smoker and disease vs no disease
- Clicked ad vs did not click and purchased vs did not purchase
How to use the calculator
Step 1: Enter observed counts
Fill the four cells (a, b, c, d) with your observed frequencies. These should be non-negative whole numbers.
Step 2: Choose correction (optional)
Enable Yates continuity correction if your sample is small or expected cell counts are low. It gives a more conservative estimate in 2x2 settings.
Step 3: Click Calculate
The tool returns chi-square statistic, p-value (df = 1), expected counts, and effect-size measures like Phi coefficient and odds ratio.
The formula behind the result
The Pearson chi-square statistic is:
χ2 = ∑ (O - E)2 / E
Where:
- O = observed cell count
- E = expected cell count if no association exists
For a 2x2 table, expected counts are computed from row and column totals. Example:
Ea = (row 1 total × column 1 total) / N
Degrees of freedom are (2-1)(2-1) = 1.
How to interpret output
- Chi-square statistic: Larger values indicate stronger departure from independence.
- p-value: If p < 0.05, you typically reject the null hypothesis of independence.
- Expected counts: Check assumptions. Very small expected cells may weaken chi-square reliability.
- Phi coefficient: Effect size for 2x2 tables (roughly 0.1 small, 0.3 medium, 0.5 large).
- Odds ratio: Practical strength of association between row and column outcomes.
When to use Fisher's exact test instead
Chi-square is an approximation. If your expected counts are very small (especially less than 5 in multiple cells), Fisher's exact test is often a better choice because it does not rely on large-sample approximation.
- Use chi-square for moderate/large sample sizes
- Use Fisher's exact for sparse tables or very small N
Worked example
Suppose you compare an intervention group with a control group:
- Intervention improved: 25
- Intervention not improved: 15
- Control improved: 10
- Control not improved: 50
These are the default values in the calculator. Click Calculate to see the test output and expected frequencies instantly.
Common mistakes to avoid
- Entering percentages instead of raw counts
- Using negative or fractional frequencies
- Ignoring expected-count warnings
- Interpreting statistical significance as practical importance (always inspect effect size too)
Quick FAQ
Is this the same as a chi-square test of independence?
Yes. For a 2x2 contingency table, this is exactly the chi-square test of independence with 1 degree of freedom.
Can I use this for paired data?
No. Paired binary data is better handled by McNemar's test, not this independent-samples setup.
Does this calculator provide causality?
No. It identifies association, not causation. Study design and confounding control are needed for causal claims.