How to use this calculator
Test independence in a rectangular count table and inspect expected-cell adequacy, likelihood-ratio G, and Cramér’s V.
- Enter Nonnegative count rows, Columns per row. Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Contingency table chi square independence test explained
Compare observed contingency-table counts with independence expectations and report the asymptotic reference statistics.
How the calculation works
Eij=RiCj/N; χ²=Σ(Oij−Eij)²/Eij; df=(r−1)(c−1); G=2ΣOij ln(Oij/Eij).
Expected counts come from the product of observed row and column margins. Pearson chi-square uses squared deviations; G uses likelihood-ratio contributions with zero observed cells contributing zero. The displayed p-value refers to Pearson chi-square only.
Set up the calculation
x— Nonnegative count rows- Observed integer counts in complete row-major table order. Do not supply expected counts or percentages. Use comma-separated values in the stated order.
c— Columns per row- Number of categorical columns in each row. The count list must form at least two complete rows. Enter a whole number.
Limits of this model
Independent categorical observations and positive row and column totals. The p-value is asymptotic without Yates correction, including 2×2 tables. Small expected counts can make the reference unreliable; consider an appropriate exact procedure.
Check this example
Nonnegative count rows = 12,8,5,6,14,10; Columns per row = 3.
- Pearson independence chi-square: 4.88888889
- Chi-square reference p-value: 0.08677433
- Degrees of freedom: 2
- Likelihood-ratio G statistic: 4.93988307
- Minimum expected count: 6.81818182
- Cramer V: 0.2981424
Six counts form two rows and three columns. The expected allocation within each row follows the shared column proportions rather than equal cell counts.
For the 2×3 table, Pearson χ²=4.88889 with 2 degrees of freedom and asymptotic p≈0.08677; Cramér’s V≈0.29814.
Reading the outputs
The minimum expected count helps assess the approximation but is not a universal pass/fail rule. Cramér’s V describes association strength without a sign.
Frequently asked questions
Can I enter normalized percentages?
Use underlying counts; test calibration depends on sample size.
Is Yates correction used for 2×2 tables?
No. This page consistently reports uncorrected Pearson chi-square.
Is G assigned its own p-value?
Not here. Its statistic is shown for comparison; the labeled p-value belongs to Pearson’s statistic.
How do I use the Contingency table chi square independence test calculator?
Enter Nonnegative count rows, Columns per row. Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Contingency table chi square independence test?
Nonnegative count rows = 12,8,5,6,14,10; Columns per row = 3. Pearson independence chi-square: 4.88888889 Chi-square reference p-value: 0.08677433 Degrees of freedom: 2 Likelihood-ratio G statistic: 4.93988307 Minimum expected count: 6.81818182 Cramer V: 0.2981424 Six counts form two rows and three columns. The expected allocation within each row follows the shared column proportions rather than equal cell counts. For the 2×3 table, Pearson χ²=4.88889 with 2 degrees of freedom and asymptotic p≈0.08677; Cramér’s V≈0.29814.
Method reference: SciPy statistical function reference.
Read our calculation methodology.