M5.7.7 Chapter 7

Testing a mean

A baker says that the mean mass of a loaf is 500 g. A sample of 16 loaves has a mean of 496 g. Is that too low to believe the claim?

Your guess

Pick one before you read on. It is fine to be wrong.

Your guess
  • You picked A. Read on. At the end, the chapter comes back to your guess.

  • You picked B. Read on. At the end, the chapter comes back to your guess.

  • You picked C. Read on. At the end, the chapter comes back to your guess.

By the end you can

  • Test a claim about a mean using a normal model
  • Explain the two ways a test can give the wrong answer
  • Find the critical value of the sample mean

Chapter 6 tested a claim about a probability, with X counting successes. Now the claim is about a mean, μ. The test has the same shape: assume H₀ is true, and ask how unlikely the sample would be. The difference is the distribution we use. It is the normal distribution of the sample mean from chapter 5.

Suppose the population is normal with a known standard deviation σ, and H₀: μ = μ₀. For a sample of n values, the sample mean is X̄ ~ N(μ₀, σ² ÷ n) if H₀ is true. Standardise it, and we have the test statistic z = (x̄ − μ₀) ÷ (σ ÷ √n), which is N(0, 1) if H₀ is true. If σ is not known, but n is large, the standard deviation of the sample is used in its place.

The baker claims μ = 500 g. We know σ = 8 g from earlier records. The sample has n = 16 loaves, so the standard error is 8 ÷ √16 = 2 g. If H₀ is true, X̄ ~ N(500, 2²). The baker's claim is wrong if loaves are lighter, so H₁: μ < 500. Draw the curve of X̄ and shade the lower tail.

Draw it first

Draw the distribution of the sample mean and mark the critical value

  1. A bell curve of the sample mean of 16 loaves, centred at 500, on an axis named sample mean in g with the numbers 492 to 508 in steps of 2. Step 2 adds a dashed line named 496.7 g and shades the area to the left of it, which is written 0.050.492496500504508sample mean in g

    1 Draw the curve for X̄ if H₀ is true. It is centred at 500 and has standard deviation 2.

  2. A bell curve of the sample mean of 16 loaves, centred at 500, on an axis named sample mean in g with the numbers 492 to 508 in steps of 2. Step 2 adds a dashed line named 496.7 g and shades the area to the left of it, which is written 0.050.492496500504508sample mean in g496.7 g0.050

    2 Mark the point with 5% of the area to its left. It is 1.645 standard errors below 500, which is 500 − 1.645 × 2 = 496.7. A sample mean below it is in the critical region.

The critical values. For a one tailed test at the 5% level the cut off for z is 1.645. A lower tail test rejects H₀ when z is below −1.645. An upper tail test rejects when z is above 1.645. For a two tailed test at the 5% level there is 2.5% in each tail, and the cut offs are z = −1.96 and z = 1.96. Both numbers come from the table of z values in chapter 4: they have 0.95 and 0.975 of the area to the left.

A bell curve for z on an axis named z with the numbers −3 to 3. A dashed line named −1.645 marks the point on the left. The area to the left of it is shaded and written 0.050.−3−2−10123z−1.6450.050
One tail: the lowest 5% of z. If z falls to the left of −1.645, reject H₀.

Worked example

The baker claims μ = 500 g. Take σ = 8 g. A sample of 16 loaves has mean 496 g. Test at the 5% level whether the mean mass is lower than the baker says.

  1. H₀: μ = 500 and H₁: μ < 500. This is a one tailed test.
  2. If H₀ is true, X̄ ~ N(500, 2²), because 8 ÷ √16 = 2.
  3. The test statistic is z = (496 − 500) ÷ 2 = −2.
  4. The critical value for a lower tail at 5% is −1.645. Since −2 is below −1.645, the result is in the critical region.
  5. As a check, P(Z < −2) = 0.0228, which is less than 0.05.
  6. Reject H₀. There is evidence at the 5% level that the mean mass of a loaf is less than 500 g.

Answer: The test statistic is z = −2, so reject H₀.

A bell curve for z on an axis named z with the numbers −3 to 3. Two dashed lines named −1.96 and 1.96 mark the points on each side. The area to the left of −1.96 and the area to the right of 1.96 are shaded, each written 0.025.−3−2−10123z−1.961.960.0250.025
Two tails: 2.5% in each. If z falls outside −1.96 to 1.96, reject H₀.

Worked example

The baker claims μ = 500 g, with σ = 8 g. A sample of 64 loaves has mean 502.2 g. Test at the 5% level whether the mean mass is different from 500 g.

  1. H₀: μ = 500 and H₁: μ ≠ 500. The test is two tailed.
  2. If H₀ is true, X̄ ~ N(500, 1²), because 8 ÷ √64 = 1.
  3. The test statistic is z = (502.2 − 500) ÷ 1 = 2.2.
  4. The two tailed critical values are ±1.96. Since 2.2 is above 1.96, the result is in the critical region.
  5. Reject H₀. There is evidence at the 5% level that the mean mass of a loaf is not 500 g. The sample mean is above 500 g, so the loaves seem to be heavier.

Answer: The test statistic is z = 2.2, so reject H₀.

We can also work in grams. A critical region for the sample mean itself comes from x̄ = μ₀ − 1.645 × σ ÷ √n, for a lower tail. A sample mean at or below this value rejects H₀.

Worked example

X̄ ~ N(500, 2²) if H₀ is true. Find the critical value of x̄ for a one tailed test of H₁: μ < 500 at the 5% level.

  1. The cut off for z is −1.645.
  2. Turn it back into grams: x̄ = 500 + (−1.645) × 2 = 500 − 3.29 = 496.71.
  3. To 1 decimal place the critical value is 496.7.
  4. The critical region is x̄ ≤ 496.7. A sample mean of 496 is in it, as we found.

Answer: The critical value is 496.7 g.

A test can give the wrong answer in two ways. A Type I error is rejecting H₀ when it is true. Its probability is the significance level, 5%, because that is how often a true H₀ gives a result in the critical region. A Type II error is not rejecting H₀ when it is false. Its probability depends on how far the true mean is from the claim.

Two bell curves for the sample mean of 16 loaves, on an axis named sample mean in g with the numbers 490 to 506 in steps of 2. The solid curve, centred at 500, is named mean 500 and the dashed curve, centred at 497, is named mean 497. A dashed line named 496.7 g marks the critical value. The tail of the solid curve to the left of it is hatched and written 0.050. The part of the dashed curve to the right of it is dotted and written 0.558.490494498502506sample mean in g496.7 g0.0500.558mean 500mean 497
The solid curve is X̄ if the claim is true. The hatched tail, 0.050, is the chance of a Type I error. The dashed curve is X̄ if the true mean is 497. The dotted part, 0.558, is the chance of a Type II error. It is a sample mean above the critical value, so H₀ is kept, even though it is false.

Worked example

The one tailed test above rejects H₀ when x̄ ≤ 496.71. Suppose the true mean mass is really 497 g, with the same standard error, 2 g. Find the probability of a Type II error.

  1. A Type II error happens when H₀ is not rejected, so x̄ > 496.71.
  2. If the true mean is 497, X̄ ~ N(497, 2²). We need P(X̄ > 496.71).
  3. Then z = (496.71 − 497) ÷ 2 = −0.145.
  4. P(Z > −0.145) = P(Z < 0.145) = 0.5576, using a calculator for z = 0.145.
  5. To 3 decimal places the chance of a Type II error is 0.558.

Answer: The probability is 0.558.

So a mean that is 3 g under the claim goes undetected more than half of the time. The test is poor at finding small differences with only 16 loaves. The chance of catching a true difference is called the power, 1 − 0.558 = 0.442. Power rises when the true mean is further from the claim, when σ is smaller, and when the sample is larger.

See it three ways

With things

A smoke alarm can sound when there is no fire, which is a false alarm, or stay silent when there is a fire, which is a missed fire. A test of H₀ can err in the same two ways.

As a picture

A table with the heads truth, reject and keep. The rows read H₀ true, Type I and correct; H₀ false, correct and Type II.truthrejectkeepH₀ trueType IcorrectH₀ falsecorrectType II

In words

Type I: reject a true H₀, with chance equal to the significance level. Type II: keep a false H₀, with a chance that depends on the true mean.

In symbols

z = (x̄ − μ₀) ÷ (σ ÷ √n). One tail at 5%: z < −1.645 if H₁ is μ < μ₀, or z > 1.645 if H₁ is μ > μ₀. Two tails: |z| > 1.96.

Try it

See a Type I error happen

You need: a die, paper and a pencil.

  1. Throw the die 12 times and add the scores. The mean is the total divided by 12. This is one run.
  2. Make 10 runs. Write the mean of each.
  3. The die is fair, so the mean should be 3.5. Count how many runs have a mean outside the limits in the table.

What you will see: The limits are the two tailed 5% limits for a fair die. Each run has a 1 in 20 chance of falling outside, so in 10 runs you will often see none, and sometimes one. Each such run would make a test reject a true H₀: a Type I error.

If you cannot try it, this is what happens.
A table with the heads what and value. The rows read mean and 3.5; standard error and 0.49; lower limit and 2.53; upper limit and 4.47.whatvaluemean3.5standard error0.49lower limit2.53upper limit4.47

A wrong idea many people have

The probability of a Type II error is also 5%.

Why it feels right: Type I has chance 5%, and the two errors seem to be a matched pair.

The test that breaks it: In the loaf test, if the true mean is 497 g the Type II error has probability 0.558. If the true mean is 494 g, it falls to 0.088. The probability changes with the true mean, but the Type I probability stays 0.05.

What is true: We choose the Type I probability by choosing the level. The Type II probability depends on the true value of μ, which we do not know, so it is not fixed by the test alone.

A wrong idea many people have

A smaller significance level always makes a better test.

Why it feels right: A smaller level means fewer wrong rejections, and fewer errors sounds better.

The test that breaks it: Move the level from 5% to 1%. The one tailed critical value for z moves from −1.645 to −2.326, so the critical value for x̄ becomes 500 − 4.65 = 495.35. Now a true mean of 497 g is even harder to detect.

What is true: Lowering the level lowers the Type I probability but raises the Type II probability. The two cannot both be cut without a bigger sample.

Key words

test statistic
for a mean, z = (x̄ − μ₀) ÷ (σ ÷ √n). It is N(0, 1) if H₀ is true.
critical value
the cut off between rejecting and not rejecting. For z at 5%: 1.645 for one tail, 1.96 for two tails.
Type I error
rejecting H₀ when it is true. Its probability is the significance level.
Type II error
not rejecting H₀ when it is false.
power
the chance of rejecting a false H₀, which is 1 minus the chance of a Type II error.

Back to your guess

The answer is C: It depends on the spread: we ask how many standard errors 496 g lies below 500 g.

The sample mean varies from sample to sample, so being below 500 settles nothing. We measure the gap in standard errors. With σ = 8 g and 16 loaves, the standard error is 2 g, so 496 g is 2 standard errors below the claim. That is unlikely enough to doubt it at the 5% level.

Check yourself

Try each one before you look. A wrong answer tells you where to go next.

  1. Which formula gives the test statistic for a sample mean x̄ of n values, when H₀ is μ = μ₀ and the standard deviation is σ?

    Tap your answer.
    1. Yes, that is right. If H₀ is true, X̄ ~ N(μ₀, σ² ÷ n), so its standard deviation is σ ÷ √n. Subtract the mean and divide by that standard deviation.

    2. Not this one. That divides by the spread of one value. The sample mean has the smaller spread σ ÷ √n. Go to M5.7.5. Try another.

    3. Not this one. The standard error divides σ by the square root of n, not by n. Go to M5.7.5. Try another.

    See the answer

    z = (x̄ − μ₀) ÷ (σ ÷ √n)

    If H₀ is true, X̄ ~ N(μ₀, σ² ÷ n), so its standard deviation is σ ÷ √n. Subtract the mean and divide by that standard deviation.

    • If you chose B: That divides by the spread of one value. The sample mean has the smaller spread σ ÷ √n. Go to M5.7.5.
    • If you chose C: The standard error divides σ by the square root of n, not by n. Go to M5.7.5.
  2. A two tailed test is done at the 5% level with a known standard deviation. For which values of z is H₀ rejected?

    Tap your answer.
    1. Not this one. Those are the one tailed cut offs, with 5% in one tail. With two tails each has 2.5%, and the cut offs are further out. Read this page again. Try another.

    2. Yes, that is right. Each tail holds 2.5%, so the cut offs are the z values with 0.975 of the area to their left, which is 1.96, and its mirror image −1.96.

    3. Not this one. The number 0.05 is the level, a probability. The cut offs are values of z. Read this page again. Try another.

    See the answer

    When z is above 1.96 or below −1.96.

    Each tail holds 2.5%, so the cut offs are the z values with 0.975 of the area to their left, which is 1.96, and its mirror image −1.96.

    • If you chose A: Those are the one tailed cut offs, with 5% in one tail. With two tails each has 2.5%, and the cut offs are further out. Read this page again.
    • If you chose C: The number 0.05 is the level, a probability. The cut offs are values of z. Read this page again.
  3. What is a Type I error?

    Tap your answer.
    1. Yes, that is right. A Type I error is a wrong rejection: H₀ is true, but the sample lands in the critical region by chance.

    2. Not this one. That is a Type II error. Type I is the other way round: a wrong rejection. Read this page again. Try another.

    3. Not this one. The size of the sample does not define the error. A Type I error is any rejection of a true H₀. Read this page again. Try another.

    See the answer

    Rejecting H₀ when H₀ is true.

    A Type I error is a wrong rejection: H₀ is true, but the sample lands in the critical region by chance.

    • If you chose B: That is a Type II error. Type I is the other way round: a wrong rejection. Read this page again.
    • If you chose C: The size of the sample does not define the error. A Type I error is any rejection of a true H₀. Read this page again.
  4. A test is done at the 5% level. What is the probability of a Type I error?

    Tap your answer.
    1. Not this one. That is the chance of not rejecting a true H₀. A Type I error is rejecting it. Read this page again. Try another.

    2. Not this one. That describes a Type II error. A Type I error needs H₀ to be true, and then its chance is the level. Read this page again. Try another.

    3. Yes, that is right. If H₀ is true, the sample lands in the critical region with probability equal to the significance level, 5%, which is 0.05.

    See the answer

    0.05

    If H₀ is true, the sample lands in the critical region with probability equal to the significance level, 5%, which is 0.05.

    • If you chose A: That is the chance of not rejecting a true H₀. A Type I error is rejecting it. Read this page again.
    • If you chose B: That describes a Type II error. A Type I error needs H₀ to be true, and then its chance is the level. Read this page again.
  5. The true mean moves further away from the value in H₀. What happens to the probability of a Type II error?

    Tap your answer.
    1. Not this one. A bigger difference is easier to detect, so a miss is less likely, not more. Read this page again. Try another.

    2. Not this one. It does change. The further the true mean, the less its curve overlaps the region where H₀ is kept. Read this page again. Try another.

    3. Yes, that is right. The curve for the true mean moves away from the region where H₀ is not rejected, so less of it lies there. The power rises.

    See the answer

    It gets smaller.

    The curve for the true mean moves away from the region where H₀ is not rejected, so less of it lies there. The power rises.

    • If you chose A: A bigger difference is easier to detect, so a miss is less likely, not more. Read this page again.
    • If you chose B: It does change. The further the true mean, the less its curve overlaps the region where H₀ is kept. Read this page again.
  6. A two tailed test at the 5% level gives z = 1.8. What is the conclusion?

    Tap your answer.
    1. Not this one. The value 1.645 belongs to a one tailed test. This test is two tailed, so the cut off is 1.96. Read this page again. Try another.

    2. Yes, that is right. The two tailed cut offs are ±1.96. Since 1.8 lies between −1.96 and 1.96, it is not in the critical region.

    3. Not this one. A result that is not significant does not prove H₀. It only fails to give enough evidence against it. Go to M5.7.6. Try another.

    See the answer

    Do not reject H₀, because 1.8 is below 1.96.

    The two tailed cut offs are ±1.96. Since 1.8 lies between −1.96 and 1.96, it is not in the critical region.

    • If you chose A: The value 1.645 belongs to a one tailed test. This test is two tailed, so the cut off is 1.96. Read this page again.
    • If you chose C: A result that is not significant does not prove H₀. It only fails to give enough evidence against it. Go to M5.7.6.
  7. From an earlier chapter

    X ~ B(25, 0.4) if H₀ is true. For a one tailed test of H₁: p < 0.4 at the 5% level, P(X ≤ 5) = 0.0294 and P(X ≤ 6) = 0.0736. What is the critical region?

    Tap your answer.
    1. Not this one. P(X ≤ 6) = 0.0736 is more than 0.05. The region must keep its probability at most 0.05. Go to M5.7.6. Try another.

    2. Yes, that is right. We want the largest c with P(X ≤ c) at most 0.05. P(X ≤ 5) = 0.0294 is allowed and P(X ≤ 6) = 0.0736 is not, so the critical region is X ≤ 5.

    3. Not this one. That is a smaller region than allowed. Take c as large as possible with P(X ≤ c) at most 0.05, which is 5 here. Go to M5.7.6. Try another.

    See the answer

    X ≤ 5

    We want the largest c with P(X ≤ c) at most 0.05. P(X ≤ 5) = 0.0294 is allowed and P(X ≤ 6) = 0.0736 is not, so the critical region is X ≤ 5.

    • If you chose A: P(X ≤ 6) = 0.0736 is more than 0.05. The region must keep its probability at most 0.05. Go to M5.7.6.
    • If you chose C: That is a smaller region than allowed. Take c as large as possible with P(X ≤ c) at most 0.05, which is 5 here. Go to M5.7.6.
  8. H₀: μ = 60. The standard deviation is 12 and the sample has 36 values with mean 63.4. Find the test statistic z.

    See the answer

    1.7

    The standard error is 12 ÷ √36 = 2. Then z = (63.4 − 60) ÷ 2 = 3.4 ÷ 2 = 1.7.

  9. H₀: μ = 120, with standard deviation 15 and a sample of 25. For a one tailed test of H₁: μ < 120 at the 5% level, find the critical value of x̄, to 1 decimal place.

    See the answer

    115.1

    The standard error is 15 ÷ √25 = 3. The critical value is 120 − 1.645 × 3 = 120 − 4.935 = 115.065, which is 115.1 to 1 decimal place.

  10. H₀: μ = 500, with standard deviation 8 and a sample of 64. For a two tailed test at the 5% level, the upper critical value of x̄ is 500 + 1.96 × the standard error. Find it, to 1 decimal place.

    See the answer

    502.0 g

    The standard error is 8 ÷ √64 = 1. The upper critical value is 500 + 1.96 × 1 = 501.96, which is 502.0 g to 1 decimal place.

  11. Z ~ N(0, 1). Find P(Z < −2.25), to 4 decimal places.

    See the answer

    0.0122

    By symmetry P(Z < −2.25) = 1 − P(Z < 2.25) = 1 − 0.9878 = 0.0122.

Keep it

Copy this into your exercise book.

z = (x̄ − μ₀) ÷ (σ ÷ √n). 5% one tail: 1.645. Two tails: ±1.96. Type I: reject a true H₀, chance = level. Type II: keep a false H₀.

Draw: A bell curve with a dashed line at the critical value and the tail shaded.

Reading with a child? A short page for the adult: what this chapter teaches and three questions to ask.

No internet tomorrow? Save the whole book as one file (1.1 MB). It opens on any phone.