Statistics & probability
Chi-square goodness of fit
Compare observed category counts with expected relative weights.
A clear answer. Here’s how.
Normalises positive expected weights to the observed count total, then sums (observed−expected)²/expected. Degrees of freedom = categories−1−fitted parameters. Requires at least two categories, whole non-negative observed counts and positive total count. Uses the asymptotic chi-square tail, with a warning for expected counts below 5; no automatic category pooling is performed.
See a worked example
Worked example
A fixed demonstration, separate from the values you enter above.
- CSV: Category,Observed,Expected weight
Category,Observed,Expected weight A,20,1 B,30,1 C,50,1
- Parameters estimated from these counts
- 0
Example result
| Category | Observed | Expected | Chi-square contribution |
|---|---|---|---|
| A | 20 | 33.3333333333 | 5.33333333333 |
| B | 30 | 33.3333333333 | 0.333333333333 |
| C | 50 | 33.3333333333 | 8.33333333333 |
df 2; asymptotic p-value 0.000911881965555. Expected counts are all at least 5.