Menu
Sign up Sign in

AI HL · 13.4

Hypothesis Testing

13.4.15

Testing a proportion: the binomial test

13.4.15

Testing a proportion: the binomial test

Target: I can write hypotheses about a proportion p, using X ~ B(n, p) under H0, from a context. (+3 more)

By the end of this section

Key points

Setting up the test

  • Let X be the number of successes in n independent trials. H0 gives a value for p, the probability of success: H0: p = p0. Under H0, X ~ B(n, p0).
  • H1 has the tail from the wording: p > p0 for 'increased', p < p0 for 'decreased'. In this course a test on a discrete variable is one-tailed.
  • Hypotheses are about p, the population proportion. Never write the sample proportion in H0 or H1.

The p-value method

  • Upper tail: p-value = P(X ≥ x) = 1 − P(X ≤ x − 1). Lower tail: p-value = P(X ≤ x).
  • The calculator's cumulative probability is P(X ≤ k). The observed value x counts, so for an upper tail take the value one below x.
  • Reject H0 if the p-value is less than the significance level. Write the conclusion in context.

The critical region method

  • The critical region is X ≤ c (lower) or X ≥ c (upper) with P(critical region) ≤ the significance level.
  • Lower: the largest c with P(X ≤ c) ≤ α. Upper: the smallest c with P(X ≥ c) ≤ α. Always test the adjacent value to be sure.
  • An inverse binomial on the calculator can be one out. Check P at c and at the next value.
  • Reject H0 if the observed value is in the critical region.

Why it is never exactly 5%

  • The probabilities of a discrete variable jump from value to value, so a critical region cannot always have probability exactly equal to the significance level.
  • The actual significance level is P(X in the critical region) when H0 is true. It is at most the level you asked for.

On the calculator

Binomial cumulative probability

  • Choose the binomial cumulative distribution. Enter n, p and the value k to get P(X ≤ k).
  • For P(X ≥ x), find P(X ≤ x − 1) and take it away from 1.

Screenshot and video to come

Table of cumulative probabilities for a critical region

  • Make a column of k values and a second column with the cumulative probability for each k, filled down.
  • Read down to where the values cross the significance level, then test the adjacent values.

Screenshot and video to come

Worked examples

Problems like the ones in class. Pick one, try it, then open the working.
An upper-tail test with a p-value

A website says that 30% of the people who visit its page sign up for the newsletter. After the page is redesigned, 17 of a random sample of 40 visitors sign up. The owner thinks the proportion who sign up has increased. (a) Write down suitable hypotheses. (b) Find the p-value and test at the 5% significance level.

Working
  1. Define X and p

    Let X be the number of visitors, out of 40, who sign up. Let p be the probability that a visitor signs up. X ~ B(40, p).

    The hypotheses are about p, the probability of success, not about X.

  2. Hypotheses

    H0: p = 0.3, H1: p > 0.3

    The owner thinks the proportion has increased, so H1 is upper-tailed. Discrete tests in this course are one-tailed.

  3. Distribution under H0

    Assume H0 is true: X ~ B(40, 0.3)

    The test works with the distribution you would get if H0 were true.

  4. p-value

    P(X ≥ 17) = 1 − P(X ≤ 16) = 0.0633

    From the calculator, binomial cumulative probability: P(X ≤ 16). Take it from 1 for the upper tail.

  5. Compare

    0.0633 > 0.05, so do not reject H0.

    The p-value is the probability of a result at least this extreme if H0 is true.

  6. In context

    There is insufficient evidence, at the 5% significance level, that the proportion of visitors who sign up has increased.

    Write it in the words of the question.

Video walkthrough coming
A lower-tail test with a p-value

A seed company says that 85% of its seeds germinate. A gardener plants 30 seeds, and 21 germinate. She thinks the true proportion is less than 85%. Test her belief at the 5% significance level.

Working
  1. Hypotheses

    Let X be the number of seeds, out of 30, that germinate. H0: p = 0.85, H1: p < 0.85

    She thinks the proportion is lower, so the tail is lower.

  2. Under H0

    X ~ B(30, 0.85)

    Use the distribution you get when H0 is true.

  3. p-value

    P(X ≤ 21) = 0.0278

    A lower tail needs no subtraction: the calculator's cumulative probability is the p-value.

  4. Compare

    0.0278 < 0.05, so reject H0.

    Compare p with 0.05.

  5. In context

    There is sufficient evidence, at the 5% significance level, that the proportion of seeds that germinate is less than 85%.

    Say what it means for the seeds.

Video walkthrough coming
A lower critical region

A council says that 64% of households in the county recycle glass. A councillor thinks that fewer households recycle glass in her ward. She will ask a random sample of 60 households. Write down hypotheses and find the critical region at the 5% significance level.

Working
  1. Hypotheses

    Let X be the number of households, out of 60, that recycle glass. H0: p = 0.64, H1: p < 0.64

    Fewer households: lower tail. Under H0, X ~ B(60, 0.64).

  2. Mean as a guide

    Mean = 60 × 0.64 = 38.4. The critical region is below this.

    A lower critical region is made of values well below the mean.

  3. Table of cumulative probabilities

    From the calculator, a table of P(X ≤ k) near the 5% mark: P(X ≤ 30) = 0.0182, P(X ≤ 31) = 0.0334, P(X ≤ 32) = 0.0580

    Build a column of k values and a column of cumulative probabilities. Look for where the values cross 0.05.

  4. Test adjacent values

    P(X ≤ 32) = 0.0580 > 0.05; P(X ≤ 31) = 0.0334 < 0.05

    Check the value either side of the crossing. An inverse binomial can be one out.

  5. Critical region

    Critical region: X ≤ 31

    31 is the largest value whose cumulative probability is at most 0.05. If the sample has 31 or fewer households recycling glass, reject H0.

Video walkthrough coming
An upper critical region

A garden centre says that 20% of its sweet pea seeds give a red flower. A customer thinks the proportion is higher. She grows 80 seeds. Write down hypotheses and find the critical region at the 10% significance level.

Working
  1. Hypotheses

    Let X be the number of seeds, out of 80, that give a red flower. H0: p = 0.2, H1: p > 0.2

    Under H0, X ~ B(80, 0.2). Mean = 16, so the region is above 16.

  2. Upper tail

    P(X ≥ c) = 1 − P(X ≤ c − 1)

    For an upper region, subtract the cumulative probability of the value just below c.

  3. Table

    From the calculator, cumulative table: P(X ≤ 20) = 0.893, P(X ≤ 21) = 0.934

    Read down the table to where 1 − P(X ≤ c − 1) drops below 0.10.

  4. Test adjacent values

    P(X ≥ 21) = 0.107 > 0.1; P(X ≥ 22) = 0.0660 < 0.1

    The smallest c with P(X ≥ c) at most 0.10.

  5. Critical region

    Critical region: X ≥ 22

    22 or more red flowers gives sufficient evidence that the proportion is higher.

Video walkthrough coming
Why the test cannot be exactly 5%

A coin is spun 20 times to test H0: p = 0.5 against H1: p < 0.5, where p is the probability of heads, at the 5% significance level. The graph shows the probabilities for X ~ B(20, 0.5). (a) Find the critical region. (b) Find the actual probability of rejecting H0 when it is true. (c) Explain why this is not 5%.

−11234567891011120.050.10.150.2xP(X = x)
Working
  1. Critical region

    P(X ≤ 6) = 0.0577 > 0.05; P(X ≤ 5) = 0.0207 < 0.05. Critical region: X ≤ 5

    Test adjacent values, as before.

  2. Actual significance level

    P(reject H0 | H0 true) = P(X ≤ 5) = 0.0207

    If H0 is true, the chance of landing in the critical region is 2.07%, not 5%.

  3. Why not 5%

    Adding the next value takes the total to 0.0577, which is over 5%.

    A discrete variable jumps from one probability to the next. Each value you add moves the total by a whole bar of the graph, so it cannot stop exactly at 0.05.

  4. What it means

    The test is stricter than asked: 2.07% instead of 5%.

    The region is chosen so that its probability is at most the significance level. It is never over.

Video walkthrough coming