Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Chi-Square Statistic (χ²)
0.7937
degrees of freedom = 1
Degrees of freedom 1
p-value (approx.) 0.372998
Critical value (α = 0.05) 3.841
Total observations 100
Significant at 0.05? No — fail to reject

What is the Chi-Square Test of Independence?

The chi-square (\(\chi^2\)) test of independence checks whether two categorical variables are related. For a 2×2 contingency table, it compares the counts you actually observed against the counts you would expect if the two variables were completely independent. A large discrepancy produces a large \(\chi^2\) value and suggests the variables are associated.

2x2 contingency table with two categorical variables, cells labeled O and row, column, and grand totals
A 2x2 contingency table cross-tabulates two categorical variables with observed counts and marginal totals.

How to Use This Calculator

Enter the four cell counts of your 2×2 table: A and B form the first row, C and D form the second row. The calculator adds up the row totals, column totals and grand total, computes the expected count for each cell, and sums the standardized squared deviations to give \(\chi^2\). It also reports the degrees of freedom (always 1 for a 2×2 table), an approximate p-value, the 0.05 critical value, and whether the result is statistically significant.

The Formula Explained

For each cell the expected frequency is \(E = (\text{row total} \times \text{column total}) / \text{grand total}\). The test statistic is $$\chi^2 = \sum \frac{(O - E)^2}{E}$$ across all four cells. With one degree of freedom, the critical value at the 5% significance level is 3.841. If your \(\chi^2\) exceeds 3.841 you reject the null hypothesis of independence.

Advertisement
Formula breakdown showing expected count E equals row total times column total divided by grand total
Each expected count E is computed from the row and column totals divided by the grand total.

Worked Example

Suppose \(A = 10\), \(B = 20\), \(C = 30\), \(D = 40\). Row totals are 30 and 70; column totals are 40 and 60; total = 100. Expected values are 12, 18, 28, 42. Then $$\chi^2 = \frac{(10-12)^2}{12} + \frac{(20-18)^2}{18} + \frac{(30-28)^2}{28} + \frac{(40-42)^2}{42} \approx 0.3333 + 0.2222 + 0.1429 + 0.0952 \approx 0.7937$$ Since \(0.79 < 3.841\), we fail to reject independence.

FAQ

Why is df always 1 here? Degrees of freedom = \((\text{rows} - 1)(\text{columns} - 1) = (2-1)(2-1) = 1\).

What does a small p-value mean? A p-value below 0.05 indicates the observed association is unlikely under independence, so the variables are likely related.

Is the p-value exact? It uses a standard numerical approximation of the chi-square distribution with 1 degree of freedom, accurate enough for typical decisions but not a substitute for full statistical software in edge cases.

Last updated: