Chi-square tests

Lessons and exercises follow the school system and stay in its language.Les leçons et les exercices suivent le système scolaire et restent dans sa langue.Lektionen und Übungen folgen dem Schulsystem und bleiben in seiner Sprache.

About this lesson

Statistics (AP-aligned) › Significance tests

To save a PDF, choose “Save as PDF” in the print dialog.

Sources and credits

Written with this source as a starting point:

sedifier rewrote the text and added its own examples and exercises.

Written with AI assistance; every answer is checked by our math engine. Not yet reviewed by a teacher.

This lesson: CC BY-SA 4.0, © sedifier · All credits

Chi-square tests

Significance tests.

Warm-up

Three quick questions from earlier lessons.

  1. A coin is tossed 100 times and lands heads 63 times. Test H₀: p = 0.5 against Hₐ: p > 0.5.
    1. The standard error under H₀:   ?\;?
    2. The z statistic:   ?\;?
    3. The proportion of heads needed for z=2z = 2:   ?\;?
    4. The value of p stated by the null hypothesis:
    5. At α = 0.05 (one-sided, z* = 1.645), what is the smallest number of heads that leads to rejecting H₀?
  2. At significance level α = 0.05, a test gives P-value 0.04. What do you conclude?
    1. Reject H₀: there is convincing evidence for Hₐ
    2. Accept H₀
    3. Hₐ is proven true
  3. A test of a new drug (sample of 388) has H₀: the drug has no effect. What is a Type I error?
    1. Concluding the drug works when it really has no effect
    2. Concluding there is no effect when the drug really works
    3. Making a mistake in the data

Discover

A die is rolled 60 times. If it is fair, how many times do you expect each face?

  1. 10
  2. 60

Key idea

Compare observed counts with expected counts.

χ2=∑(O−E)2E\chi^2 = \sum \dfrac{(O - E)^2}{E}. Goodness of fit: E=n×piE = n \times p_i, df == (categories −1- 1). Two-way table (independence or homogeneity): E=row total×column totalgrand totalE = \dfrac{\text{row total} \times \text{column total}}{\text{grand total}}, df =(r−1)(c−1)= (r - 1)(c - 1). Large χ2\chi^2 (small P-value) is evidence against H₀. Condition: all expected counts at least 5.

Worked example

Die: observed 14 sixes, expected 10.

Contribution =1.6= 1.6
(14 − 10)²/10.
df =5= 5
Six faces.
χ2\chi^2 is the sum
Add all six contributions.

Your turn, guided

Your turn: a 3 × 4 two-way table. Degrees of freedom.

66
(3 − 1)(4 − 1).

Practice ★

  1. A die is rolled 60 times to test whether it is fair. What is the expected count for each face?
  1. In a chi-square test, one category has observed count 39 and expected count 21. Find its contribution to χ².
  2. In a chi-square test, one category has observed count 16 and expected count 27. Find its contribution to χ².

Watch out!

Practice ★★

  1. In a two-way table with grand total 158, a row total is 55 and a column total is 41. Find the expected count in that cell under independence.
  2. In a two-way table with grand total 134, a row total is 53 and a column total is 40. Find the expected count in that cell under independence.

Exit ticket

Three questions to check you have got it.

  1. In a chi-square test, one category has observed count 39 and expected count 21. Find its contribution to χ².
  2. In a chi-square test, one category has observed count 16 and expected count 27. Find its contribution to χ².
  3. In a chi-square test, one category has observed count 20 and expected count 16. Find its contribution to χ².

Summary card

Chi-square tests

χ2=∑(O−E)2/E\chi^2 = \sum (O - E)^2/E; GOF: E=npE = np; two-way: E=E = row × column / total.

Watch out: divide by EE; use counts, not percentages.

One more step is optional: a challenge. Try it, or finish the lesson now.

Challenge ★★★

  1. A chi-square test of independence uses a table with 5 rows and 5 columns. How many degrees of freedom does it have?
Sources and credits

Written with this source as a starting point:

sedifier rewrote the text and added its own examples and exercises.

Written with AI assistance; every answer is checked by our math engine. Not yet reviewed by a teacher.

This lesson: CC BY-SA 4.0, © sedifier · All credits