• Submit
  • Submit
  • Submit
  • Submit
Chi-squared DistributionWorked Example

📊 Understanding the Chi‑Squared Test: A Complete Worked Example
The Chi‑Squared (χ²) test is a simple but powerful method for analysing categorical data. It helps determine whether differences in your data are meaningful or simply due to chance.

🔍 What Does the Chi‑Squared Test Do?
The Chi‑Squared test compares:

  • what you observed, and
  • what you would expect if there were no relationship
    The test statistic is:

 \chi ^2=\sum \frac{(O-E)^2}{E}
Where O = observed frequency and E = expected frequency.

📁 Scenario
You want to test whether DNA (Did Not Attend) rates are related to age group in an outpatient clinic.

📋 Observed Data

Age GroupAttendedDNATotal
Under 40402060
40 and over301040
Total7030100

1️⃣ Hypotheses

  • Null hypothesis H_0: DNA is independent of age group
  • Alternative hypothesis H_1: DNA is not independent of age group

2️⃣ Observed Matrix
 O=\left( \begin{matrix}40&20\\ 30&10\end{matrix}\right)

3️⃣ Expected Frequencies
Expected values use:
 E_{ij}=\frac{(\mathrm{Row\  Total})_i\cdot (\mathrm{Column\  Total})_j}{\mathrm{Grand\  Total}}

Calculations
 E_{11}=\frac{60\times 70}{100}=42
 E_{12}=\frac{60\times 30}{100}=18
 E_{21}=\frac{40\times 70}{100}=28
 E_{22}=\frac{40\times 30}{100}=12

📋 Expected Frequencies Table

Age GroupAttended (E)DNA (E)Total
Under 40421860
40 and over281240
Total7030100

4️⃣ Chi‑Squared Calculation
Formula:

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

Cell contributions
 \frac{(40-42)^2}{42}=0.0952

 \frac{(20-18)^2}{18}=0.2222
 \frac{(30-28)^2}{28}=0.1429
 \frac{(10-12)^2}{12}=0.3333

Total Chi‑Squared
 \chi ^2=0.7936

5️⃣ Degrees of Freedom

For an (r\times c) table:
 df=(r-1)(c-1)
Here:
r=2
c=2
So:

6️⃣ Decision
Critical value at df=1, \alpha =0.05:
 \chi _{\mathrm{critical}}^2=3.84

 \chi _{\mathrm{calc}}^2=0.79
Since 0.79<3.84, we fail to reject the null hypothesis.

7️⃣ Interpretation
There is no statistically significant association between age group and DNA status**.
Any differences could reasonably be due to chance.

🎯 Final Thoughts
This example shows the full workflow of a Chi‑Squared Test of Independence:

  • Clean data table
  • Observed vs expected values
  • Chi‑Squared calculation
  • Degrees of freedom
  • Statistical decision

© Vincent Chido King - Master Black Belt L6S

2026