Vertex Learn

Formal confidence intervals

What this lesson covers

  • For a mean: x̄ ± 1.96 × s ÷ √n.
  • Bootstrap intervals use the middle 95%.
  • Larger samples give narrower intervals.
Worked example

A mean

  • Mean 170 cm, s = 10, n = 100.
  1. 1.96 × 10 ÷ √100 = 1.96
  2. 170 − 1.96 = 168.04
  3. 170 + 1.96 = 171.96
  4. 168.04 to 171.96 cm
Key idea

Try it: a bootstrap interval

Key idea

How to say it

  • We are fairly sure the population mean is between 168.04 and 171.96 cm.
  • The interval is about the mean, not individual people.
Key idea

What 95% really means

  • Each line is an interval from a different sample of the same population. About 19 in 20 catch the true value. Here one misses.
  • Your one interval either caught it or did not. The 95% describes the method.
Twenty horizontal intervals around a vertical line for the true value. Nineteen cross the line and one misses.
Key idea

Try it: what 95% really means

Worked example

What sample size does

  • With s = 10, compare n = 100 with n = 400.
  1. n = 100: 1.96 × 10 ÷ 10 = 1.96
  2. n = 400: 1.96 × 10 ÷ 20 = 0.98
  3. Four times the sample halves the margin
Key idea

Statistics explorer

Key idea

Try it: build the interval

Common mistakes

  • Saying 95% of people lie in the interval.
    It estimates the population mean.
  • Forgetting the square root.
    Divide s by √n.

Your turn

1

Mean 40, s = 8, n = 64. Find the margin.

2

What is the interval?

3

To halve the margin, how must n change?

4

About how many of 20 such intervals catch the true value?

5

A 95% interval for a mean is 52.4 to 57.6. Find the sample mean and the margin.

6

A 95% interval for the mean commute of Wellington workers is 24.1 to 27.9 minutes. Which statement is correct?

7

For s = 12 and n = 36, a student writes the margin as 1.96 × 12 ÷ 36 = 0.65. What is the correct margin?

8

With s = 15, what sample size gives a 95% margin of 1.47?

Show answer

1. 1.96 × 8 ÷ 8 = 1.96 2. 38.04 to 41.96 3. Multiply it by 4 4. About 19 5. Mean 55, margin 2.6. The mean is the middle, (52.4 + 57.6) ÷ 2 = 55, and the margin is half the width, 5.2 ÷ 2 = 2.6. 6. The population mean commute is likely 24.1 to 27.9 minutes. The interval estimates the mean of all Wellington workers, not single commutes. 7. 3.92. Divide s by √36 = 6, not by 36: 1.96 × 12 ÷ 6 = 3.92. 8. n = 400. 1.96 × 15 ÷ √n = 1.47 gives √n = 29.4 ÷ 1.47 = 20, so n = 20² = 400.

Your turn

Sample question: Achieved

A random sample of 64 kiwifruit from a Te Puke orchard has a mean weight of 102 g and a standard deviation of 12 g. Find the 95% confidence interval for the mean weight of all kiwifruit in the orchard.

Hint

Use x̄ ± 1.96 × s ÷ √n.

Answer

99.06 g to 104.94 g

Step by step
  1. The rule for a 95% interval for a mean is x̄ ± 1.96 × s ÷ √n.
  2. Here x̄ = 102, s = 12 and n = 64.
  3. Square root first: √64 = 8. Forgetting the square root is the classic mistake.
  4. Margin: 1.96 × 12 ÷ 8 = 1.96 × 1.5 = 2.94 g.
  5. Lower limit: 102 − 2.94 = 99.06 g. Upper limit: 102 + 2.94 = 104.94 g.
  6. Check: the sample mean 102 is exactly in the middle of the interval.
Full working
  1. margin = 1.96 × 12 ÷ √64x̄ ± 1.96 × s ÷ √n
  2. = 1.96 × 12 ÷ 8 = 2.94
  3. 102 − 2.94 = 99.06, 102 + 2.94 = 104.94
  4. 99.06 g to 104.94 g
Your turn

Sample questions: Merit

1

A random sample of 49 Year 13 students at a Nelson school gives a mean of 7.3 hours sleep on school nights, with standard deviation 1.4 hours. The principal says students at the school average at least 8 hours. Construct a 95% confidence interval, interpret it, and say whether it supports the principal.

Hint

Build the interval, then see where 8 sits compared with the whole interval.

Answer

6.91 to 7.69 hours. I am fairly sure the mean sleep on school nights of all Year 13 students at the school is between 6.91 and 7.69 hours. The whole interval is below 8, so the data do not support the principal's claim; it suggests the mean is less than 8 hours.

Step by step
  1. Recall the rule: x̄ ± 1.96 × s ÷ √n, with x̄ = 7.3, s = 1.4 and n = 49.
  2. √49 = 7, so the margin is 1.96 × 1.4 ÷ 7 = 1.96 × 0.2 = 0.392 hours.
  3. Lower limit: 7.3 − 0.392 = 6.908. Upper limit: 7.3 + 0.392 = 7.692.
  4. Round sensibly: 6.91 to 7.69 hours.
  5. Interpret it with the population (Year 13 students at this school), the variable (sleep on school nights) and the parameter (the mean).
  6. So: I am fairly sure the mean sleep of all Year 13 students at the school on school nights is between 6.91 and 7.69 hours.
  7. Now the claim. The principal says at least 8. Where is 8? Above the top of the interval.
  8. Every believable value for the mean is under 8, so the data do not support the principal. They suggest the mean is below 8.
  9. Classic mistake: saying no student sleeps 8 hours. The interval is about the mean, not about single students.
  10. Check: 7.69 < 8, so 8 is outside the interval.
Full working
  1. margin = 1.96 × 1.4 ÷ √49 = 0.392
  2. 7.3 − 0.392 = 6.908, 7.3 + 0.392 = 7.692
  3. population: Year 13 students at the schoolparameter: mean sleep
  4. 8 > 7.69whole interval below 8
  5. 6.91 to 7.69 h; the claim of at least 8 h is not supported
2

A researcher wants a 95% confidence interval for the mean height of Year 9 students with a margin of error of at most 0.5 cm. A pilot study suggests s ≈ 6 cm. What is the smallest sample size she can use?

Hint

Set 1.96 × s ÷ √n ≤ 0.5 and solve for n, then round up.

Answer

n = 554

Step by step
  1. The margin of error is 1.96 × s ÷ √n. We want it to be 0.5 or less.
  2. Put in s = 6: 1.96 × 6 ÷ √n ≤ 0.5, so 11.76 ÷ √n ≤ 0.5.
  3. Rearrange: √n ≥ 11.76 ÷ 0.5 = 23.52.
  4. Square both sides: n ≥ 23.52² = 553.19.
  5. n must be a whole number. Rounding down to 553 would make the margin slightly too big, so round up.
  6. Classic mistake: rounding to the nearest whole number. For a sample size you always round up.
  7. Check n = 553: 1.96 × 6 ÷ √553 = 0.5001, just over. Check n = 554: 0.4996, under 0.5.
  8. So the smallest sample is 554 students.
Full working
  1. 1.96 × 6 ÷ √n ≤ 0.5margin at most 0.5
  2. √n ≥ 11.76 ÷ 0.5 = 23.52
  3. n ≥ 23.52² = 553.19
  4. n = 553 gives 0.5001, n = 554 gives 0.4996round up
  5. n = 554
Your turn

Sample questions: Excellence

1

A 95% confidence interval for the mean travel time to school, from a random sample of 100 students at a Hamilton school, is 23.6 to 28.4 minutes. Find the sample mean and the sample standard deviation. Hence predict the interval if a sample of 400 had given the same mean and standard deviation. A newsletter says "95% of our students travel between 23.6 and 28.4 minutes". Evaluate this.

Hint

The mean is the midpoint and the margin is half the width; then solve 1.96 × s ÷ √100 = margin for s.

Answer

Mean 26 minutes, s ≈ 12.2 minutes. With n = 400 the margin halves to 1.2, giving about 24.8 to 27.2 minutes. The newsletter is wrong: the interval estimates the mean travel time of all students at the school, not the times of individual students, which spread far more widely (s is about 12 minutes).

Step by step
  1. The interval is mean ± margin, so the mean is in the middle: (23.6 + 28.4) ÷ 2 = 26 minutes.
  2. The margin is half the width: (28.4 − 23.6) ÷ 2 = 2.4 minutes.
  3. Now use the margin rule backwards: 1.96 × s ÷ √100 = 2.4, so 1.96 × s ÷ 10 = 2.4.
  4. Solve: s = 2.4 × 10 ÷ 1.96 = 12.24, so s ≈ 12.2 minutes.
  5. Hence n = 400. √400 = 20, twice √100, so the margin halves: 2.4 ÷ 2 = 1.2 minutes.
  6. The interval would be 26 ± 1.2, which is 24.8 to 27.2 minutes.
  7. Now the newsletter. It talks about 95% of students, so it treats the interval as a range for individuals.
  8. The interval is about one number: the mean travel time of all students at the school.
  9. Individual times vary a lot. A standard deviation of about 12 minutes means many students take 10 minutes or 45 minutes, far outside 23.6 to 28.4.
  10. Also, 95% describes the method: about 95% of intervals made this way catch the true mean. It is not a percentage of students.
  11. Better wording: I am fairly sure the mean travel time of all students at the school is between 23.6 and 28.4 minutes.
  12. Check: 1.96 × 12.24 ÷ 10 = 2.40, matching the margin.
Full working
  1. x̄ = (23.6 + 28.4) ÷ 2 = 26midpoint
  2. margin = (28.4 − 23.6) ÷ 2 = 2.4half the width
  3. 1.96 × s ÷ 10 = 2.4, so s = 24 ÷ 1.96 ≈ 12.2
  4. n = 400: margin = 1.96 × 12.24 ÷ 20 = 1.2four times n halves the margin
  5. 26 ± 1.2 = 24.8 to 27.2
  6. interval is for the mean, not individualsnewsletter is wrong
  7. x̄ = 26, s ≈ 12.2; about 24.8 to 27.2 min; the claim misreads the interval
2

The Ministry says the mean nightly sleep of NZ teenagers is 7.5 hours. A blogger takes 20 separate random samples and makes a 95% confidence interval from each. Nineteen intervals contain 7.5; one, 7.6 to 8.1 hours, does not. The blogger publishes only that one and says "this proves the Ministry is wrong". How many of the 20 intervals would you expect to miss if the Ministry is right? Evaluate the blogger's claim.

Hint

95% describes the method: think about how many of 20 intervals you expect to miss the true value even when it is exactly right.

Answer

About 1 of 20 is expected to miss (20 × 0.05 = 1). One miss in twenty is exactly what the method predicts if the Ministry is right, so it is not evidence against 7.5. Reporting only the interval that missed and hiding the other 19 is cherry-picking. Taken together, the 20 samples are consistent with a mean of 7.5 hours.

Step by step
  1. Recall what 95% means. If you made intervals from many random samples, about 95% of them would catch the true mean and about 5% would miss.
  2. So even when the true mean really is 7.5, some intervals miss it, just by chance.
  3. Expected misses out of 20: 20 × 0.05 = 1.
  4. The blogger got exactly 1 miss. That is what we expect if the Ministry is right.
  5. Any single interval either caught the true value or did not. You cannot tell which, so one interval does not prove anything.
  6. The blogger chose the one interval that missed and ignored the other 19. That is cherry-picking: picking the result that suits the story.
  7. Look at all 20 together. Nineteen contain 7.5, so the evidence as a whole fits a mean of 7.5 hours.
  8. Also, data support or fail to support a claim; they never prove it. Proves is the wrong word.
  9. A fair report would give all 20 results, or combine the samples into one large sample with a narrower interval.
  10. Conclusion: the claim is not justified.
Full working
  1. P(an interval misses) ≈ 0.0595% describes the method
  2. expected misses = 20 × 0.05 = 1
  3. observed: 1 miss of 20as expected if 7.5 is right
  4. publishing only the miss is cherry-picking
  5. 19 of 20 contain 7.5consistent with the Ministry
  6. expect about 1 miss; the claim is not justified
Summary

What to take away

  • The interval estimates a population value.
  • Quadruple n to halve the width.

Challenge

1

A random sample of Year 10 students at a Napier school is asked how many books they read this year. The sample median is 8. A computer takes 1000 bootstrap resamples and records each median: 6 (7 times), 6.5 (11), 7 (34), 7.5 (98), 8 (260), 8.5 (242), 9 (203), 9.5 (102), 10 (30), 10.5 (13). (a) Find the 95% bootstrap confidence interval for the population median. (b) Explain why the interval is not centred on 8. (c) Mere says "6 to 10.5 is safer, because it catches every bootstrap median." Rawiri says "95% of the students read between your two limits." Evaluate both.

Hint

The middle 95% of 1000 values leaves out the lowest 25 and the highest 25. Build up running totals from each end to see which values the 26th smallest and the 975th smallest are.

Answer

(a) 7 to 10 books. (b) The bootstrap medians are spread more above 8 than below it, so the interval runs 1 below and 2 above. (c) Mere's interval is about a 100% interval: wider and less useful, and still not certain. Rawiri is wrong: the interval estimates the median of all Year 10 students at the school, not the spread of individual students.

Step by step
  1. Drop the lowest 25 and the highest 25 bootstrap medians; the interval runs from the 26th smallest to the 975th smallest.
  2. Running totals from the bottom: 7, 18, 52. The 19th to 52nd values are 7, so the 26th is 7.
  3. From the top: 13 values are 10.5 and 30 are 10, so the top 43 values are 10 or more. The 25 highest are all in there, and the 26th highest (the 975th smallest) is 10.
  4. So the interval is 7 to 10 books: 1 below the sample median and 2 above, because the bootstrap distribution has a longer upper side.
  5. Catching every bootstrap median just gives a wider, almost 100% interval. And the interval is about the population median, not where 95% of students lie.
Full working
  1. 5% of 1000 = 50; 25 off each endmiddle 95%
  2. cumulative from bottom: 7, 18, 5226th smallest is 7
  3. cumulative from top: 13, 4326th largest is 10
  4. 975th smallest = 26th largest = 101000 − 975 + 1 = 26
  5. 8 − 7 = 1, 10 − 8 = 2not centred
  6. 95% bootstrap interval: 7 to 10 books
2

A pilot study of 25 randomly chosen Year 12 students gives a 95% confidence interval for mean resting heart rate of 61.08 to 68.92 beats per minute. The researcher wants her final interval to have a margin of error of at most 1.5 beats per minute, and she will keep the 25 pilot students in the final sample. (a) Estimate the population standard deviation from the pilot. (b) How many more students must she sample? (c) Explain why her final margin might still turn out a little more than 1.5.

Hint

The pilot margin is half the width, and it equals 1.96 × s ÷ √25. Then solve 1.96 × s ÷ √n ≤ 1.5 for n, and round the right way.

Answer

(a) s ≈ 10 beats per minute. (b) She needs n ≥ 170.7, so 171 students in total, which is 146 more. (c) The 10 is only an estimate from 25 students; if the full sample's s comes out larger than 10, the margin will be over 1.5.

Step by step
  1. The pilot margin is (68.92 − 61.08) ÷ 2 = 3.92.
  2. 3.92 = 1.96 × s ÷ √25 = 1.96 × s ÷ 5, so s = 3.92 × 5 ÷ 1.96 = 10.
  3. For a margin of at most 1.5: 1.96 × 10 ÷ √n ≤ 1.5, so √n ≥ 19.6 ÷ 1.5 ≈ 13.07 and n ≥ 170.7.
  4. n must be a whole number of students and at least 170.7, so round up to 171. She already has 25, so she needs 146 more.
  5. The margin uses the final sample's s, not the pilot's. With only 25 students the pilot s could easily be a bit low.
Full working
  1. (68.92 − 61.08) ÷ 2 = 3.92pilot margin
  2. s = 3.92 × 5 ÷ 1.96 = 10from 1.96 × s ÷ √25
  3. 1.96 × 10 ÷ √n ≤ 1.5target margin
  4. √n ≥ 13.07, n ≥ 170.7square both sides
  5. n = 171; 171 − 25 = 146round up, subtract the pilot
  6. s ≈ 10; 146 more students
3

A district council has 9,000 households in a town. A random sample of 64 households gives mean weekly water use of 1250 litres, with standard deviation 400 litres. The water supply can provide 11.5 million litres a week. A councillor says: "Our sample proves the supply is enough for the town." (a) Build a 95% confidence interval for the mean weekly use per household. (b) Turn it into an interval for the town's total weekly use. (c) Find the largest mean use per household the supply can handle, and evaluate the councillor's claim.

Hint

Find the interval for the mean first. The town total is 9,000 times the mean, so multiply both ends. Then compare the supply with that interval.

Answer

(a) 1152 to 1348 litres. (b) 10.368 to 12.132 million litres a week. (c) 11.5 million ÷ 9,000 ≈ 1278 litres per household, which is inside the interval. So the sample does not prove the supply is enough: plausible values of the town's use run up to about 12.1 million litres, above the 11.5 million supply. It does not prove a shortage either.

Step by step
  1. Margin = 1.96 × 400 ÷ √64 = 1.96 × 50 = 98 litres, so the interval is 1250 ± 98, 1152 to 1348 litres.
  2. The town total is 9,000 times the population mean, so multiply both ends by 9,000: 10,368,000 to 12,132,000 litres.
  3. The supply covers a mean of up to 11,500,000 ÷ 9,000 ≈ 1278 litres per household.
  4. 1278 lies inside 1152 to 1348, so the true mean could be above or below what the supply can handle.
  5. So the claim is not supported: the sample is consistent with enough water and with a shortage. A larger sample, or planning for the top of the interval, would be safer.
Full working
  1. 1.96 × 400 ÷ √64 = 98margin
  2. 1250 − 98 = 1152, 1250 + 98 = 1348interval for the mean
  3. 9,000 × 1152 = 10,368,000; 9,000 × 1348 = 12,132,000interval for the total
  4. 11,500,000 ÷ 9,000 ≈ 1278largest mean the supply covers
  5. 1152 < 1278 < 1348inside the interval
  6. Total use 10.4 to 12.1 million litres a week; 11.5 million is inside, so the claim is not proved

More challenge problems

Worksheet with answersWithout answersDownload PDF
Report a mistake

More in AS 91582

Is your child on track?

Take the free placement test