The chi-square distribution
The chi-square (χ²) distribution is the distribution of a sum of squared standard normal variables. It appears in tests of goodness of fit, tests of independence in contingency tables, likelihood ratio tests and confidence intervals for a variance. Its shape depends on the degrees of freedom k: skewed to the right for small k, closer to normal for large k.
What the calculator gives
- the p-value of a χ² statistic, P(χ² ≥ x), which is the right tail used in almost every χ² test;
- the critical value for a significance level, as in a printed χ² table;
- the cumulative probability, the density, the mean (k) and the standard deviation (√2k).
Example
A goodness-of-fit test gives χ² = 12.5 with 6 degrees of freedom:
- p ≈ 0.052: just above 0.05;
- the critical value at α = 0.05 is 12.592, so χ² falls just short of it.
Degrees of freedom
- Goodness of fit: number of categories − 1 − number of parameters estimated from the data.
- Contingency table: (rows − 1) × (columns − 1). A 2 × 2 table has 1 degree of freedom; a 3 × 4 table has 6.
- Variance of a normal sample: n − 1.
Common critical values (α = 0.05)
| df | χ² critical |
|---|---|
| 1 | 3.841 |
| 2 | 5.991 |
| 3 | 7.815 |
| 4 | 9.488 |
| 5 | 11.070 |
| 10 | 18.307 |
| 20 | 31.410 |
Conditions for χ² tests
- Observations are independent and counted, not measured.
- Expected counts should usually be at least 5 in most cells; otherwise, merge categories or use an exact test (Fisher’s exact test for 2 × 2 tables).
- Use the raw counts, not percentages.
Confidence interval for a variance
For a normal sample of size n with variance s², the confidence interval of the population variance is
(n − 1)s² ÷ χ²(1 − α/2) to (n − 1)s² ÷ χ²(α/2)
using critical values with n − 1 degrees of freedom. Use the calculator with α set to twice the tail you need.
For a 2 × 2 table, the chi-square test calculator computes χ² from the counts directly.