BanglayShikhi
← 🔲 Chi-square & Categorical Analysis

Chi-square goodness-of-fit

5 min

The chi-square goodness-of-fit test checks whether observed category counts match a distribution you expected.

Why it matters

It tests claims such as "births are equally likely on every weekday" or "blood groups follow national proportions".

Key ideas

  • One categorical variable
  • Observed counts O vs expected counts E
  • χ² = Σ (O − E)² ÷ E
  • df = categories − 1
  • Expected count should be at least 5 in most cells
  • Large χ² → poor fit

Real-life research example

120 customers choose among 4 pharmacies. If equally popular, each expects 30. Observed: 45, 30, 25, 20.

When to use

  • Compare one sample's proportions with a known pattern

When NOT to use

  • Don't use with percentages instead of counts
  • Don't use with tiny expected counts

Mini example

O = 45, 30, 25, 20; E = 30 each → χ² = 7.5 + 0 + 0.83 + 3.33 = 11.67, df = 3, p ≈ 0.009

Quick takeaway

Counts vs expected counts → a fit test.

Try it yourself

Enter observed counts 45, 30, 25, 20 and equal expected proportions. Then try 31, 29, 30, 30.