Read a two-way table and compare conditional proportions.
Calculate expected counts and the Pearson chi-square statistic.
Interpret evidence of association without confusing it with causation.
Begin with the denominator
A two-way table records two categorical variables for each observation. In an illustrative study, a retailer records a customer's shopping channel and whether the customer returns an item. Each customer appears once. The four cells are online/return, online/no return, store/return, and store/no return.
Raw counts can be misleading when the groups have different sizes. Compare the return count with the total in its own channel. That gives a conditional proportion: the return rate among online customers versus the return rate among store customers. Keep the denominator explicit when describing a percentage.
A table of counts also differs from a table of percentages. The chi-square calculation uses actual frequencies. Entering percentages as though they were counts silently changes the sample size and therefore changes the evidence.
Observed versus expected
Edit the four illustrative customer counts. Compare the rates and inspect how each cell departs from independence.
The pale bars are expected counts under independence, using the current margins. The test is Pearson chi-square without a continuity correction.
Pearson χ² · df = 1
Approximate p-value
Cramér’s V
Smallest expected count
At α = 0.05, reject independence. Online and store return rates are 30.0% and 50.0%. This describes association; it does not establish causation.
Read the chart summary
N = 200. Online return rate 30.0%; store return rate 50.0%. Expected counts, in displayed order: 40.00, 60.00, 40.00, 60.00. Chi-square 8.333 with 1 degree of freedom; p 0.0039.
Try this
What independence predicts
The null hypothesis says shopping channel and return status are independent in the population. Under independence, both channels share a common return probability. Estimate that probability using the overall return proportion, then apply it to each row total.
The expected count in a cell is E = row total × column total / grand total. Expected counts preserve the observed margins, and they need not be whole numbers. The alternative says that the two variables are associated; it does not specify which cells differ or why.
Pearson's statistic adds (O − E)² / E across the cells. Large discrepancies relative to expected counts produce large statistics. With r rows and c columns, the approximate reference distribution has (r − 1)(c − 1) degrees of freedom. A 2 × 2 table therefore has one degree of freedom.
A worked return-rate example
Suppose the illustrative counts are 30 returns and 70 nonreturns online, versus 50 returns and 50 nonreturns in store. The return rates are 30% and 50%, a difference of −20 percentage points for online minus store.
There are 200 customers and 80 returns. Each channel has 100 customers, so the expected return count is 100 × 80 / 200 = 40. The expected nonreturn count is 60 in each channel. Thus χ² = 100/40 + 100/60 + 100/40 + 100/60 = 8.333. With one degree of freedom, p ≈ 0.00389.
At a prespecified 5% significance level, this is evidence against independence if the sampling assumptions hold. Cramér's V is √(χ²/N) = 0.204 for this table. Report the actual rates as well: V summarizes association without showing its direction.
Evidence, magnitude, and study design
A small p-value indicates that the observed discrepancy is unusual under the independence model. It does not give the probability that the null hypothesis is true, nor does it measure the commercial importance of the difference. A very large sample can detect an association too small to matter operationally.
Expected counts matter for the approximation. This lesson flags any expected count below 5. For a sparse 2 × 2 table, an appropriate exact method such as Fisher's exact test may be preferable. That method is outside this calculator. Do not combine categories only to obtain a desired result.
Finally, an observational association between channel and returns does not show that the channel caused the difference. Customer mix, product type, and other variables may explain it. Aggregation can even reverse the apparent direction of a relationship, so examine important subgroups and the data-collection process before making a policy recommendation.
Make the connection.
Try each question before revealing the solution.
01
A row contains 80 observations, a column contains 50, and the whole table contains 200. What count does independence predict for their intersection?
Show the worked solution
E = 80 × 50 / 200 = 20. This uses the marginal totals; it does not require knowing the observed count in the cell.
02
If every count in the worked example doubles, what happens to the return rates, χ², and Cramér’s V?
Show the worked solution
The rates remain 30% and 50%. Each squared discrepancy divided by its expected count doubles, so χ² becomes 16.667. Both χ² and N double, leaving V = √(χ²/N) unchanged. More data strengthen the evidence without changing the observed effect size.
03
A table has a small p-value and an expected count of 1.2. Is the usual chi-square conclusion sufficient?
Show the worked solution
No. A sparse expected count makes the asymptotic approximation questionable. Review the sampling design and use an appropriate exact or simulation-based procedure. The small approximate p-value does not override the method’s conditions.
Assumptions, methods & references
Observations are independent, and each contributes to exactly one cell; repeated purchases from the same customer can violate this condition.
Population inference requires an appropriate random sampling design. A convenience sample can have selection bias.
The chi-square reference distribution is approximate. A warning appears whenever an expected count is below 5; this tool does not implement Fisher’s exact test.
Counts must be nonnegative integers, and all row and column totals must be positive. Default counts are fictional teaching data.