Skip to content
Omnikalc

Chi-square test calculator for a 2 × 2 table

Test whether two yes/no variables are related with Pearson's chi-square test, with or without Yates' continuity correction, the p-value and phi.

Updated on
Your inputs

Value out of range

Value out of range

Value out of range

Value out of range

Yates' continuity correction

Results

Chi-square (χ², 1 degree of freedom)

9.091

p-value

0.0026

Significant at the 5% level
Phi coefficient (φ)
0.302
Smallest expected count
22.5
Share of yes in group 1
60.0%
Share of yes in group 2
30.0%

What the test checks

The chi-square test of independence asks whether two categorical variables are related. With a 2 × 2 table, it compares two groups on a yes/no outcome: did a new web page convert better, did a treatment group recover more often, do men and women answer a survey question differently?

The table

Yes No
Group 1 a b
Group 2 c d

The formulas

  • χ² = N(ad − bc)² ÷ [(a + b)(c + d)(a + c)(b + d)], with N = a + b + c + d and 1 degree of freedom.
  • With Yates’ correction: replace (ad − bc)² by (|ad − bc| − N/2)².
  • p-value: for 1 degree of freedom, p = 2 × (1 − Φ(√χ²)), where Φ is the standard normal distribution.
  • Phi coefficient φ = (ad − bc) ÷ √[(a + b)(c + d)(a + c)(b + d)].

Worked example

Yes No Total
Group 1 30 20 50
Group 2 15 35 50
  1. ad − bc = 30 × 35 − 20 × 15 = 1,050 − 300 = 750.
  2. Denominator: 50 × 50 × 45 × 55 = 6,187,500.
  3. χ² = 100 × 750² ÷ 6,187,500 ≈ 9.09.
  4. p ≈ 0.0026: the difference between 60% and 30% yes is statistically significant at the 5% level.
  5. φ ≈ 0.30, a medium association.
  6. With Yates’ correction, χ² ≈ 7.92 and p ≈ 0.005.

Expected counts

The test compares observed counts with those expected if the variables were independent: expected count = row total × column total ÷ N. Here the smallest expected count is 45 × 50 ÷ 100 = 22.5.

The chi-square approximation is reliable only when every expected count is at least 5. Below that, use Fisher’s exact test.

Critical values for 1 degree of freedom

Significance level Critical χ²
10% 2.71
5% 3.84
1% 6.63
0.1% 10.83

Interpreting carefully

  • A significant result shows an association, not a cause.
  • With very large samples, tiny and unimportant differences become significant: report the proportions and phi, not only p.
  • The test needs independent observations: each person counted once. For paired data, such as before and after on the same people, use McNemar’s test.

Frequently asked questions

What does the chi-square test of independence tell you?

Whether two categorical variables are associated. In a 2 × 2 table, it tests whether the proportion of yes answers differs between the two groups more than chance would explain.

How is the chi-square statistic calculated for a 2 × 2 table?

χ² = N(ad − bc)² ÷ [(a + b)(c + d)(a + c)(b + d)], with 1 degree of freedom. In the example, χ² = 9.09 and p ≈ 0.003.

When should I use Yates' correction?

It makes the test more conservative for small samples. Many statisticians no longer recommend it and prefer Fisher's exact test when any expected count is below 5.

What is the phi coefficient?

Phi measures the strength of association in a 2 × 2 table, from −1 to 1. As a rough guide, 0.1 is small, 0.3 medium and 0.5 large.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.