Statistical
Chi-Square Test of Independence: 2x2 contingency table and Phi effect size
Test whether two categorical variables are independent in a 2x2 table using N*(ad - bc)^2 / (R1*R2*C1*C2) and calculate expected counts and Phi.
Expected counts and the Pearson statistic
In a two-way contingency table, the expected count under independence for Row i, Column j is (RowTotal_i * ColTotal_j) / GrandTotal.
For a 2x2 table [[a, b], [cellC, d]] with grand total N = a + b + cellC + d, Pearson's Chi-Square simplifies algebraically to N * (a*d - b*cellC)^2 / ((a+b) * (cellC+d) * (a+cellC) * (b+d)) with 1 degree of freedom (critical value = 3.841 at alpha = 0.05).
| Segment (A) | Converted (B) | Did Not Convert (C) | Row Total |
|---|---|---|---|
| Guided Onboarding | 60 | 40 | 100 |
| Self-Serve Only | 30 | 70 | 100 |
| Column Total | 90 | 110 | N = 200 (Chi^2 = 18.18) |
2x2 Chi-Square statistic and Phi association coefficient
SQRT(Chi-square/N) gives the magnitude of Phi, from 0 to 1. Signed Phi also depends on category coding; size labels are context-dependent.
=LET(a, B2, b, C2, cellC, B3, d, C3, n, a+b+cellC+d, ROUND(n * (a*d - b*cellC)^2 / ((a+b)*(cellC+d)*(a+cellC)*(b+d)), 2))Expected count for top-left cell (Row1 * Col1 / GrandTotal)
Verify all four expected cell counts exceed 5 before relying on asymptotic Chi-Square thresholds.
=(SUM(B2:C2) * SUM(B2:B3)) / SUM(B2:C3)Magnitude of Phi
Use the unrounded statistic in the calculation.
=LET(a, B2, b, C2, cellC, B3, d, C3, chi, (a+b+cellC+d) * (a*d - b*cellC)^2 / ((a+b)*(cellC+d)*(a+cellC)*(b+d)), ROUND(SQRT(chi / (a+b+cellC+d)), 4))Inputs and interpretation
Use independent observations, nonnegative integer counts and positive row/column totals. This is the uncorrected Pearson statistic, not an exact test or a continuity-corrected test. Expected-count checks concern the asymptotic inference; small sparse tables need a suitable alternative. Association does not establish causation.
Try the example
Use the original values or change them to test your understanding.