How to use this calculator
For independence, type the table of observed counts with one row per line. For goodness of fit, give the observed counts and either the hypothesized proportions (adding to 1) or the expected counts.
Formulas
Statisticχ²0 = Σ(O − E)²/E
IndependenceEij = (row total)(column total)/n, df = (r − 1)(c − 1)
Goodness of fitEi = npi, df = k − 1 − (parameters estimated)
Worked example
Is the column variable independent of the row variable for the table 20 30 50 / 40 30 30? (the default)
- Row totals 100 and 100, column totals 60, 60, 80, n = 200; E = 30, 30, 40 in each row.
- χ²0 = 10/3 + 0 + 2.5 + 10/3 + 0 + 2.5 = 11.67 with df = 2.
- P = 0.0029 < 0.05: reject independence.
Frequently asked questions
What if expected counts are small?
The test needs most expected counts of at least 5. Combine sparse categories, or use Fisher’s exact test for 2 × 2 tables.
Is there a continuity correction?
This calculator doesn’t apply Yates’ correction; most engineering statistics texts don’t for tables larger than 2 × 2.