Statistics – Chi-Square Goodness-of-Fit Test

🎲 Goodness-of-Fit Test

The goodness-of-fit test answers: "Do my data fit a specific distribution?"

📚 The Idea

We compare what weexpected to see (theory) with what weactually observed (data).

If the difference is too large — we reject the hypothesis that the distribution fits.

📐 Formula

\(\chi^2 = \sum \frac{(O - E)^2}{E}\)

O = Observed | E = Expected

🔢 Example: Is the die fair?

We rolled a die 60 times and obtained:

Outcome123456
Observed (O)81271599
Expected (E)101010101010

Calculation:

χ² = (8-10)²/10 + (12-10)²/10 + (7-10)²/10 + (15-10)²/10 + (9-10)²/10 + (9-10)²/10
χ² = 0.4 + 0.4 + 0.9 + 2.5 + 0.1 + 0.1 = 4.4

Degrees of freedom: df = k - 1 = 6 - 1 = 5

Critical value: χ²₀.₀₅,₅ = 11.07

Conclusion: 4.4 < 11.07 → do not reject H₀ → no evidence the die is unfair

⚠️ Conditions for use

All expected frequencies must be at least 5. If not — merge categories.