Carrying Out a Goodness-of-Fit Test
مُقدَّم| English | المعنى |
|---|---|
| chi-square statistic/kaɪ skweə stəˈtɪstɪk/ | إحصاء كاي-تربيع |
The chi-square statistic
- The chi-square statistic 卡方统计量 adds up the standardized gaps across all categories:
-
$$\chi^2 = \sum \frac{(\text{observed} - \text{expected})^2}{\text{expected}}$$
- Each term compares one category's observed and expected counts.
- Squaring makes every gap positive; dividing by expected scales it.
Bigger gaps, bigger chi-square
- If observed $\approx$ expected everywhere, each term is tiny → $\chi^2$ is small.
- Large mismatches make terms large → a big $\chi^2$.
- So a large $\chi^2$ is evidence against the claimed distribution.
- $\chi^2$ is always $\ge 0$ (a sum of squares over positives).

The chi-square distribution: shape depends on df and the p-value is the right tail
Find the p-value
- The p-value is the area to the right of $\chi^2$ under the chi-square curve at the right $df$.
- Chi-square is a right-tailed test — only large values are "extreme."
- A big $\chi^2$ sits far right → small p-value → strong evidence against $H_0$.
- Use technology or a table with $df = \text{categories} - 1$.
Decide and conclude
- Compare the p-value to $\alpha$: p $\le \alpha$ → reject $H_0$; else fail to reject.
- Reject: convincing evidence the true distribution differs from the claim.
- Fail to reject: not convincing evidence against the claimed fit.
- State it in context — about the model's fit to the data.
Chi-square is always a right-tailed test — never double the tail. Only large $\chi^2$ values are surprising, so the p-value is the right-tail area only (unlike a two-sided $z$ or $t$). Also, plug counts into the formula, not proportions, and use expected (not observed) in each denominator.
Die test: observed $8, 12, 9, 11, 10, 10$; expected $10$ each; $df = 5$.
- $\chi^2 = \tfrac{(8-10)^2}{10} + \tfrac{(12-10)^2}{10} + \cdots = \tfrac{4+4+1+1+0+0}{10} = 1.0$.
- p-value: right-tail area beyond $1.0$ at $df=5$ is large ($\approx 0.96$).
- Decide: $0.96 > 0.05$ → fail to reject; no evidence the die is unfair.
The chi-square statistic $\chi^2 = \sum \frac{(\text{observed} - \text{expected})^2}{\text{expected}}$ measures total mismatch. Its p-value is the right-tail area at $df = \text{categories} - 1$. Compare to $\alpha$: reject $H_0$ if p $\le \alpha$ (the model fits poorly), else fail to reject — stated in context.
Write from a contribution of 1.6
- One cell has observed count 14 and expected count 10.
- The lesson contribution 0.4 is another cell.
What is this cell's contribution to chi-square?
Each cell contributes the squared gap divided by the expected count.
What does this cell contribute?
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإكمال الأول اليوم
16 divided by 10 is 1.6. Other options — 0.4 (the other cell); 4 (the raw gap).
A right-skewed test distribution
Chi-square is right-tailed — only large values are extreme.
One category has observed 8, expected 10. Compute (observed − expected)²/expected.
الصعوبة 2/5 · 140 عملة + مكافأة صغيرة عند الإكمال الأول اليوم
(8−10)²/10 = 4/10 = 0.4.
A chi-square test is...
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإكمال الأول اليوم
Only large χ² is extreme → right tail only.
A large chi-square statistic is evidence against the claimed distribution.
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإكمال الأول اليوم
Big gaps → big χ² → evidence against H0.
In the chi-square formula, each denominator is the ___ count.
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإكمال الأول اليوم
Divide the squared gap by the expected count.
The chi-square statistic can be negative.
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإكمال الأول اليوم
It's a sum of squares over positive expecteds — always ≥ 0.