MathematicsGrade 12–13

One-sided significance test: type I and II errors

A test decides between two hypotheses. Coloured areas show how often it can be wrong.

Loading simulation …

What is it about?

A proven medicine cures 60 %60\,\% of patients. A new one is claimed to be better. It is tested on n=50n = 50 people; XX is the number cured.

  • Null hypothesis H0 ⁣:p≤0.6H_0\colon p \le 0.6, alternative H1 ⁣:p>0.6H_1\colon p > 0.6, significance level α=5 %\alpha = 5\,\%.
  • We calculate in the boundary case p=0.6p = 0.6, i.e. X∼B(50; 0.6)X \sim B(50;\,0.6).

The critical region is {k,…,50}\{k, \dots, 50\} with the smallest kk such that P(X≥k)≤αP(X \ge k) \le \alpha:

P(X≥37)≈0.0280≤0.05,P(X≥36)≈0.0540>0.05.P(X \ge 37) \approx 0.0280 \le 0.05, \qquad P(X \ge 36) \approx 0.0540 > 0.05.

Decision rule: reject H0H_0 if X≥37X \ge 37. Rejecting a true H0H_0 is a type I error (probability at most 2.8 %2.8\,\% here). Keeping H0H_0 although H1H_1 holds is a type II error; for a true p1=0.75p_1 = 0.75: β=P0.75(X≤36)≈0.363\beta = P_{0.75}(X \le 36) \approx 0.363, power 1−β≈0.6371 - \beta \approx 0.637. Not rejecting H0H_0 does not prove H0H_0.

Try it

  1. Tap bars in the upper histogram to set the observed value xx. When is H0H_0 rejected? Load example
  2. Switch α\alpha between 1 %1\,\% and 10 %10\,\% and watch the red and orange areas. α = 1 %
  3. Press “Let p₁ move” and watch β\beta shrink along the power curve.
  4. Set p1=p0p_1 = p_0 and draw 100 samples: how often is H0H_0 wrongly rejected? Boundary case

Tasks

Task 1: Coin

A coin is tossed 2020 times; test H0 ⁣:p≤0.5H_0\colon p \le 0.5 against H1 ⁣:p>0.5H_1\colon p > 0.5 at the 5 %5\,\% level. Find the critical region. Load task

Show solution

P(X≥15)≈0.0207≤0.05P(X \ge 15) \approx 0.0207 \le 0.05 but P(X≥14)≈0.0577>0.05P(X \ge 14) \approx 0.0577 > 0.05, so the critical region is {15,…,20}\{15, \dots, 20\}. Show in the simulation

Task 2: Type II error

In fact the coin is biased with p=0.7p = 0.7. How likely is it that the test misses this? Load task

Show solution

β=P0.7(X≤14)≈0.584\beta = P_{0.7}(X \le 14) \approx 0.584, power ≈0.416\approx 0.416. Show in the simulation

Task 3: Seeds (left-tailed)

At least 90 %90\,\% of seeds are promised to germinate. Of 100100 seeds, 8383 germinate. Test H0 ⁣:p≥0.9H_0\colon p \ge 0.9 at the 5 %5\,\% level. Load task

Show solution

P(X≤84)≈0.0399P(X \le 84) \approx 0.0399, P(X≤85)≈0.0726P(X \le 85) \approx 0.0726, so the critical region is {0,…,84}\{0, \dots, 84\}. Since 8383 lies in it, H0H_0 is rejected. Show in the simulation

Ideas for the classroom

  • Use it to introduce the procedure of a one-sided test and to compare both kinds of error; the power curve can serve as an outlook.
  • Drawing many samples with p1=p0p_1 = p_0 makes the type I error rate tangible.
  • Common stumbling blocks:
    • “H0H_0 was not rejected, so H0H_0 is true.”
    • Using P(X=k)≤αP(X = k) \le \alpha instead of the tail sum P(X≥k)P(X \ge k).
    • Computing β\beta with p0p_0 instead of the true p1p_1.