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.
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 Draw the curve for X̄ if H₀ is true. It is centred at 500 and has standard deviation 2.
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.
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.
- H₀: μ = 500 and H₁: μ < 500. This is a one tailed test.
- If H₀ is true, X̄ ~ N(500, 2²), because 8 ÷ √16 = 2.
- The test statistic is z = (496 − 500) ÷ 2 = −2.
- 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.
- As a check, P(Z < −2) = 0.0228, which is less than 0.05.
- 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₀.
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.
- H₀: μ = 500 and H₁: μ ≠ 500. The test is two tailed.
- If H₀ is true, X̄ ~ N(500, 1²), because 8 ÷ √64 = 1.
- The test statistic is z = (502.2 − 500) ÷ 1 = 2.2.
- The two tailed critical values are ±1.96. Since 2.2 is above 1.96, the result is in the critical region.
- 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.
- The cut off for z is −1.645.
- Turn it back into grams: x̄ = 500 + (−1.645) × 2 = 500 − 3.29 = 496.71.
- To 1 decimal place the critical value is 496.7.
- 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.
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.
- A Type II error happens when H₀ is not rejected, so x̄ > 496.71.
- If the true mean is 497, X̄ ~ N(497, 2²). We need P(X̄ > 496.71).
- Then z = (496.71 − 497) ÷ 2 = −0.145.
- P(Z > −0.145) = P(Z < 0.145) = 0.5576, using a calculator for z = 0.145.
- 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
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.
- Throw the die 12 times and add the scores. The mean is the total divided by 12. This is one run.
- Make 10 runs. Write the mean of each.
- 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.
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.
Which formula gives the test statistic for a sample mean x̄ of n values, when H₀ is μ = μ₀ and the standard deviation is σ?
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.
A two tailed test is done at the 5% level with a known standard deviation. For which values of z is H₀ rejected?
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.
What is a Type I error?
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.
A test is done at the 5% level. What is the probability of a Type I error?
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.
The true mean moves further away from the value in H₀. What happens to the probability of a Type II error?
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.
A two tailed test at the 5% level gives z = 1.8. What is the conclusion?
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.
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?
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.
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.
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.
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.
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.