Confidence Intervals for a Mean

A2 · S2 · 12 min

A sample mean of 50.350.3 cm is a single best guess for the population mean, but on its own it says nothing about how far off it might be. A confidence interval replaces the single number with a range, such as (49.99,50.61)(49.99, 50.61), built so that intervals made this way capture the true mean a stated percentage of the time. Paper 6 asks you to calculate these intervals, to find a sample size or a confidence level from one, and, just as often, to interpret one correctly in words. The calculation is short; the interpretation is where most marks are lost.

From a probability statement to an interval

Suppose the population is normal with known standard deviation σ\sigma, so that the sample mean satisfies Xˉ∼N(μ,σ2n)\bar{X} \sim N\left(\mu, \dfrac{\sigma^2}{n}\right). Standardising, Z=Xˉ−μσ/nZ = \dfrac{\bar{X} - \mu}{\sigma/\sqrt{n}} is standard normal, and 95%95\% of its probability lies between −1.96-1.96 and 1.961.96:

y = exp(-x^2 / 2) / sqrt(2 pi) fill -1.96 1.96 y = exp(-x^2 / 2) / sqrt(2 pi)

So

P(−1.96<Xˉ−μσ/n<1.96)=0.95.P\left(-1.96 < \frac{\bar{X} - \mu}{\sigma/\sqrt{n}} < 1.96\right) = 0.95.

Rearrange the inequalities to put μ\mu in the middle:

P(Xˉ−1.96σn<μ<Xˉ+1.96σn)=0.95.P\left(\bar{X} - 1.96\frac{\sigma}{\sqrt{n}} < \mu < \bar{X} + 1.96\frac{\sigma}{\sqrt{n}}\right) = 0.95.

Read this carefully. The random quantity is Xˉ\bar{X}, so the interval is random and μ\mu is fixed. Before the sample is taken, there is a 0.950.95 probability that the interval you are about to calculate will contain μ\mu. Once you substitute the observed xˉ\bar{x}, you have one particular interval, called a 95%95\% confidence interval for μ\mu.

Confidence interval for a population mean
xˉ−zσn<μ<xˉ+zσn,often written xˉ±zσn\bar{x} - z\frac{\sigma}{\sqrt{n}} < \mu < \bar{x} + z\frac{\sigma}{\sqrt{n}}, \qquad \text{often written } \bar{x} \pm z\frac{\sigma}{\sqrt{n}}
Confidence level90%90\%95%95\%98%98\%99%99\%
zz1.6451.6451.961.962.3262.3262.5762.576

For a level of c%c\%, zz satisfies Φ(z)=1+c/1002\Phi(z) = \dfrac{1 + c/100}{2}; for example 94%94\% needs Φ(z)=0.97\Phi(z) = 0.97, so z=1.881z = 1.881.

The quantity zσnz\dfrac{\sigma}{\sqrt{n}} is the margin of error, half the width of the interval. The interval is symmetrical about xˉ\bar{x}.

When the formula can be used

The syllabus covers two situations.

SituationWhat to use for σ\sigmaWhy Xˉ\bar{X} is normal
Population normal, variance knownσ\sigmaExactly normal for any nn
Large sample, any populationσ\sigma if known, otherwise ss from the sampleApproximately normal by the Central Limit Theorem

In the second case the unbiased estimate s2s^2 (see unbiased estimates) replaces the unknown σ2\sigma^2, and the interval is approximate. With a large sample, ss is close enough to σ\sigma for this to make little difference.

A small sample from a normal population with unknown variance needs a different distribution (the tt-distribution), which is not on the 9709 syllabus. Paper 6 will not ask for it.

Interpreting a confidence interval

Imagine taking many random samples of the same size and calculating a 95%95\% confidence interval from each. The intervals jump about because each sample has a different mean. About 95%95\% of them contain μ\mu; about 5%5\% miss it. The graph below shows ten such intervals for a population with μ=50\mu = 50 (the vertical line). Nine of them cross the line; the seventh one up misses it.

(50, 0) -- (50, 11) (48.6, 1) -- (50.9, 1) (49.2, 2) -- (51.5, 2) (48.1, 3) -- (50.4, 3) (49.6, 4) -- (51.9, 4) (48.9, 5) -- (51.2, 5) (47.9, 6) -- (50.2, 6) (50.3, 7) -- (52.6, 7) (49.0, 8) -- (51.3, 8) (48.4, 9) -- (50.7, 9) (49.4, 10) -- (51.7, 10)
Definition

A 95%95\% confidence interval for μ\mu is an interval calculated from a sample by a method which, if repeated for many random samples, would produce intervals containing μ\mu in 95%95\% of cases.

Once a particular interval has been calculated, it either contains μ\mu or it does not; μ\mu is not a random variable. Saying "there is a 95%95\% probability that μ\mu lies in (49.99,50.61)(49.99, 50.61)" is the classic misstatement. Examiners accept wording such as "95%95\% of intervals constructed in this way would contain the population mean".

Because each interval contains μ\mu with probability 0.950.95 before it is calculated, the number of intervals that contain μ\mu, out of kk independent ones, has the distribution B(k,0.95)B(k, 0.95). This is a popular final part to a question.

A confidence interval also gives a quick check on a claim. If a claimed value of μ\mu lies outside a 95%95\% confidence interval, the sample is evidence against the claim; if it lies inside, the sample is consistent with it. This is closely related to a two-tailed hypothesis test at the 5%5\% level.

What controls the width

The width of the interval is 2zσn2z\dfrac{\sigma}{\sqrt{n}}, so:

  • A higher confidence level means a larger zz and a wider interval. To be more sure of catching μ\mu you need a bigger net.
  • A larger sample means a narrower interval, in proportion to 1n\dfrac{1}{\sqrt{n}}. Quadrupling nn halves the width.
  • A more variable population means a wider interval.
Calculating a confidence interval for a mean
  1. Find xˉ\bar{x}. Find σ\sigma, or if it is unknown and nn is large, find ss from s2=1n−1(∑x2−(∑x)2n)s^2 = \dfrac{1}{n - 1}\left(\sum x^2 - \dfrac{(\sum x)^2}{n}\right).
  2. Find zz for the confidence level from the critical value table.
  3. Calculate the margin of error zσnz\dfrac{\sigma}{\sqrt{n}}.
  4. Write the interval as (xˉ−margin, xˉ+margin)(\bar{x} - \text{margin},\ \bar{x} + \text{margin}) to 3 or 4 significant figures.
  5. State the justification: "the population is normal" or "nn is large, so by the Central Limit Theorem Xˉ\bar{X} is approximately normal".
Routine: known variance

The lengths of rods made by a machine are normally distributed with standard deviation 0.80.8 cm. A random sample of 2525 rods has mean length 50.350.3 cm. Find a 95%95\% confidence interval for the population mean length.

Solution

The population is normal with known σ\sigma, so

50.3±1.96×0.825=50.3±0.3136.50.3 \pm 1.96 \times \frac{0.8}{\sqrt{25}} = 50.3 \pm 0.3136.

The 95%95\% confidence interval is (49.99,50.61)(49.99, 50.61) cm, to 4 significant figures.

Large sample, unknown variance

The lifetimes, xx hours, of a random sample of 6060 batteries are summarised by ∑x=2520\sum x = 2520 and ∑x2=106 400\sum x^2 = 106\,400.

(a) Find a 99%99\% confidence interval for the population mean lifetime.

(b) Explain whether it was necessary to use the Central Limit Theorem.

Solution

(a)

xˉ=252060=42,s2=159(106 400−2520260)=159(106 400−105 840)=9.4915\bar{x} = \frac{2520}{60} = 42, \qquad s^2 = \frac{1}{59}\left(106\,400 - \frac{2520^2}{60}\right) = \frac{1}{59}(106\,400 - 105\,840) = 9.4915

s=3.0808s = 3.0808, so the interval is

42±2.576×3.080860=42±1.0246,42 \pm 2.576 \times \frac{3.0808}{\sqrt{60}} = 42 \pm 1.0246,

which gives (40.98,43.02)(40.98, 43.02) hours.

(b) Yes. The distribution of battery lifetimes is not known to be normal, so the Central Limit Theorem is needed to say that the sample mean is approximately normally distributed, which is valid because n=60n = 60 is large.

Working backwards from an interval

A random sample of 4040 observations is taken from a population with standard deviation 66. A confidence interval for the population mean, calculated from the sample, is (28.44,31.56)(28.44, 31.56). Find the sample mean and the confidence level.

Solution

The interval is symmetrical about xˉ\bar{x}, so

xˉ=28.44+31.562=30.\bar{x} = \frac{28.44 + 31.56}{2} = 30.

The margin of error is 31.56−30=1.5631.56 - 30 = 1.56, so

z×640=1.56  ⇒  z=1.560.94868=1.644≈1.645.z \times \frac{6}{\sqrt{40}} = 1.56 \;\Rightarrow\; z = \frac{1.56}{0.94868} = 1.644 \approx 1.645.

Φ(1.645)=0.95\Phi(1.645) = 0.95, so 5%5\% lies in each tail and the confidence level is 90%90\%.

Choosing the sample size

The masses of a population of animals have standard deviation 1515 kg. Find the smallest sample size for which a 95%95\% confidence interval for the population mean has total width at most 44 kg.

Solution

The total width is 2×1.96×15n2 \times 1.96 \times \dfrac{15}{\sqrt{n}}, so we need

2×1.96×15n≤4  ⇒  n≥2×1.96×154=14.7  ⇒  n≥216.09.2 \times 1.96 \times \frac{15}{\sqrt{n}} \le 4 \;\Rightarrow\; \sqrt{n} \ge \frac{2 \times 1.96 \times 15}{4} = 14.7 \;\Rightarrow\; n \ge 216.09.

The smallest sample size is 217217.

Careful: the question gives the total width, so the margin of error is 22, not 44.

Exam-hard: a non-standard level and repeated intervals

The journey times, xx minutes, of a random sample of 150150 commuters are summarised by ∑x=4545\sum x = 4545 and ∑x2=148 000\sum x^2 = 148\,000.

(a) Find a 94%94\% confidence interval for the population mean journey time.

(b) Five independent random samples of 150150 commuters are taken, and a 94%94\% confidence interval for the population mean is calculated from each. Find the probability that at least 44 of these intervals contain the population mean.

Solution

(a)

xˉ=4545150=30.3,s2=1149(148 000−45452150)=10 286.5149=69.037\bar{x} = \frac{4545}{150} = 30.3, \qquad s^2 = \frac{1}{149}\left(148\,000 - \frac{4545^2}{150}\right) = \frac{10\,286.5}{149} = 69.037

s=8.3088s = 8.3088, and s150=0.67841\dfrac{s}{\sqrt{150}} = 0.67841.

For 94%94\%, there is 3%3\% in each tail, so Φ(z)=0.97\Phi(z) = 0.97 and, from the table, z=1.881z = 1.881.

30.3±1.881×0.67841=30.3±1.276130.3 \pm 1.881 \times 0.67841 = 30.3 \pm 1.2761

The interval is (29.02,31.58)(29.02, 31.58) minutes.

n=150n = 150 is large, so the Central Limit Theorem justifies treating Xˉ\bar{X} as normal even though journey times need not be normal.

(b) Each interval contains μ\mu with probability 0.940.94, independently. Let YY be the number that do; Y∼B(5,0.94)Y \sim B(5, 0.94).

P(Y≥4)=0.945+5(0.06)(0.94)4=0.7339+0.2342=0.968P(Y \ge 4) = 0.94^5 + 5(0.06)(0.94)^4 = 0.7339 + 0.2342 = 0.968
Common mistakes
  • Using σ\sigma instead of σn\dfrac{\sigma}{\sqrt{n}}. The interval is for the mean, so it uses the standard deviation of Xˉ\bar{X}.
  • Using the one-tailed zz. A 95%95\% interval leaves 2.5%2.5\% in each tail, so z=1.96z = 1.96, not 1.6451.645. 1.6451.645 is for 90%90\%.
  • Dividing by nn in s2s^2. Use the unbiased estimate, dividing by n−1n - 1.
  • "There is a 95%95\% probability that μ\mu is in this interval." μ\mu is fixed. The 95%95\% describes the method: 95%95\% of such intervals contain μ\mu.
  • Confusing total width with margin of error. The total width is twice the margin.
  • Rounding nn down. A sample size must satisfy the inequality, so always round up.
  • Saying the interval contains 95%95\% of the data. It is about the mean, not individual values. Most individual values lie well outside a confidence interval for μ\mu when nn is large.
Exam tip
  • Show the expression xˉ±zσn\bar{x} \pm z\dfrac{\sigma}{\sqrt{n}} with numbers in before giving the interval. A correct expression earns the method mark even if the arithmetic slips.
  • Give the interval as two numbers, lower first, to at least 3 significant figures. Interval notation (a,b)(a, b) or the inequality a<μ<ba < \mu < b are both acceptable.
  • Take zz from the critical value table under the normal table (1.6451.645, 1.961.96, 2.3262.326, 2.5762.576). For other levels read the main table carefully; examiners usually accept zz to 2 decimal places but expect 3.
  • When asked to interpret, mention repeated sampling: "if many samples were taken, about 95%95\% of the intervals calculated would contain the population mean".
  • "State an assumption" or "explain whether the CLT is needed" is common: either the population is normal (no CLT needed), or the sample is large (CLT needed because the population distribution is unknown or not normal).
  • "Smallest nn" and "find the confidence level" questions are the reverse problems; set up the margin-of-error equation and solve.
Summary
  • A confidence interval for μ\mu: xˉ±zσn\bar{x} \pm z\dfrac{\sigma}{\sqrt{n}}.
  • z=1.645,1.96,2.326,2.576z = 1.645, 1.96, 2.326, 2.576 for 90%,95%,98%,99%90\%, 95\%, 98\%, 99\%; in general Φ(z)=12(1+level)\Phi(z) = \tfrac{1}{2}(1 + \text{level}).
  • Valid for a normal population with known σ\sigma, or for a large sample (Central Limit Theorem), using ss if σ\sigma is unknown.
  • The interval is random, μ\mu is fixed: 95%95\% of intervals made this way contain μ\mu.
  • The number of intervals containing μ\mu, out of kk independent ones, is B(k,level)B(k, \text{level}).
  • Width =2zσn= 2z\dfrac{\sigma}{\sqrt{n}}: wider for higher confidence, narrower for larger samples.
  • A claimed μ\mu outside the interval is evidence against the claim.

Practice questions

Question
  1. A population is normally distributed with standard deviation 44. A random sample of 3636 observations has mean 20.520.5. Find a 98%98\% confidence interval for the population mean.
  2. For a random sample of 100100 values, ∑x=5230\sum x = 5230 and ∑x2=274 900\sum x^2 = 274\,900. Find a 95%95\% confidence interval for the population mean.
  3. A 95%95\% confidence interval for a population mean, calculated from a random sample of 5050 observations from a normal population with known standard deviation σ\sigma, has width 2.82.8. Find σ\sigma.
  4. A population has standard deviation 1010. Find the smallest sample size for which a 99%99\% confidence interval for the population mean has a margin of error of at most 1.51.5.
  5. A random sample of 6464 observations from a population with standard deviation 2.82.8 gives the confidence interval (12.36,13.64)(12.36, 13.64) for the population mean. Find the confidence level, to the nearest 0.1%0.1\%.
  6. A 95%95\% confidence interval for a population mean is (4.2,5.8)(4.2, 5.8). (a) A student says, "There is a probability of 0.950.95 that the population mean lies between 4.24.2 and 5.85.8." Explain why this is not correct. (b) Three independent 95%95\% confidence intervals for the same population mean are calculated. Find the probability that exactly two of them contain the population mean.
  7. The lengths of a type of screw are normally distributed with standard deviation 0.50.5 mm. A random sample of 2020 screws has mean length 10.2210.22 mm. (a) Find a 99%99\% confidence interval for the population mean length. (b) The manufacturer claims that the mean length is 9.99.9 mm. Comment on this claim.
  8. A 90%90\% confidence interval for a population mean, calculated from a random sample, is (40.4,45.6)(40.4, 45.6). (a) Find the 99%99\% confidence interval calculated from the same sample. (b) The population standard deviation is known to be 1010. Find the sample size.
Answers
  1. 20.5±2.326×436=20.5±1.550720.5 \pm 2.326 \times \dfrac{4}{\sqrt{36}} = 20.5 \pm 1.5507, giving (18.95,22.05)(18.95, 22.05).

  2. xˉ=52.3\bar{x} = 52.3; s2=199(274 900−52302100)=199(274 900−273 529)=13.848s^2 = \tfrac{1}{99}\left(274\,900 - \tfrac{5230^2}{100}\right) = \tfrac{1}{99}(274\,900 - 273\,529) = 13.848; s=3.7214s = 3.7214. 52.3±1.96×3.721410=52.3±0.729452.3 \pm 1.96 \times \dfrac{3.7214}{10} = 52.3 \pm 0.7294, giving (51.57,53.03)(51.57, 53.03). The sample is large, so the Central Limit Theorem applies.

  3. Margin of error =1.4= 1.4, so 1.96×σ50=1.41.96 \times \dfrac{\sigma}{\sqrt{50}} = 1.4 and σ=1.4501.96=5.05\sigma = \dfrac{1.4\sqrt{50}}{1.96} = 5.05.

  4. 2.576×10n≤1.5⇒n≥17.173⇒n≥294.92.576 \times \dfrac{10}{\sqrt{n}} \le 1.5 \Rightarrow \sqrt{n} \ge 17.173 \Rightarrow n \ge 294.9. The smallest sample size is 295295.

  5. xˉ=13\bar{x} = 13 and the margin is 0.640.64. z×2.88=0.64⇒z=1.829z \times \dfrac{2.8}{8} = 0.64 \Rightarrow z = 1.829. Φ(1.829)=0.9663\Phi(1.829) = 0.9663, so each tail has 0.03370.0337 and the level is 1−2(0.0337)=0.93261 - 2(0.0337) = 0.9326, that is 93.3%93.3\%.

  6. (a) The population mean is a fixed value, not a random variable, so it either lies in (4.2,5.8)(4.2, 5.8) or it does not. The 95%95\% refers to the method: if many samples were taken, about 95%95\% of the intervals calculated would contain the population mean. (b) The number containing μ\mu is B(3,0.95)B(3, 0.95). P(exactly 2)=3(0.95)2(0.05)=0.135P(\text{exactly } 2) = 3(0.95)^2(0.05) = 0.135.

  7. (a) 10.22±2.576×0.520=10.22±0.288010.22 \pm 2.576 \times \dfrac{0.5}{\sqrt{20}} = 10.22 \pm 0.2880, giving (9.932,10.508)(9.932, 10.508) mm. (b) 9.99.9 lies below the interval, so the sample gives evidence (at the 1%1\% level) that the mean length is not 9.99.9 mm; the claim appears to be incorrect, and the mean appears to be higher.

  8. (a) xˉ=43\bar{x} = 43 and the 90%90\% margin is 2.6=1.645×σn2.6 = 1.645 \times \dfrac{\sigma}{\sqrt{n}}, so σn=1.5805\dfrac{\sigma}{\sqrt{n}} = 1.5805. The 99%99\% margin is 2.576×1.5805=4.07152.576 \times 1.5805 = 4.0715, giving (38.93,47.07)(38.93, 47.07). (b) 10n=1.5805⇒n=6.327⇒n=40.03\dfrac{10}{\sqrt{n}} = 1.5805 \Rightarrow \sqrt{n} = 6.327 \Rightarrow n = 40.03, so n=40n = 40.

How well do you know this?

Builds on

Where this leads

Console

Search notes, courses and tools, or run an action