Chapter 8 · OpenStax Ch 8

Confidence Intervals

What a 95% interval promises, and how to build one for a mean or a proportion.

8.1 What “95% confident” means

A sample mean is a point estimate of \(\mu\), and it is almost never exactly right. A confidence interval wraps it in a margin that says how far off it could reasonably be. When \(\sigma\) is known, the interval is

\[\bar{x} \pm z^{*}\,\frac{\sigma}{\sqrt{n}},\]

where \(z^{*}\) cuts off the chosen tail area, so \(z^{*} = 1.96\) for 95 %. The confidence level is a promise about the method, not about one interval. Draw fifty samples. Each interval either contains \(\mu\) or it does not, and no interval knows which. The orange ones missed. In the long run about 95 % of them capture \(\mu\). Raise the level and the intervals widen. Raise \(n\) and they shrink. Confidence is bought with width or with data.

Reading: OpenStax Introductory Statistics, Section 8.1.

Try it

  1. Confidence level is 95% and Sample size, n is 20. Ten intervals are already drawn.
  2. Press Draw 1 sample. A new interval appears at the top. Orange dashed ones miss μ.
  3. Press Draw 50 several times. Capture rate settles toward Nominal.
  4. Slide the level to 80%. The intervals narrow and more of them miss.
  5. Slide n to 100. Margin of error shrinks, so the intervals narrow without missing more.

8.2 The t distribution

In practice \(\sigma\) is unknown, so we estimate it with the sample standard deviation \(s\). That estimate is itself noisy, especially for small samples, and the noise costs certainty. William Gosset worked out the price in 1908. Replace the normal with the t distribution, whose degrees of freedom \(df = n - 1\) set how heavy its tails are. The interval becomes \(\bar{x} \pm t^{*}\, s/\sqrt{n}\).

With \(df = 4\) the shaded tails are far fatter than the normal's, and \(t^{*}\) is 2.78 instead of 1.96. Slide \(df\) up and the t curve melts into the normal. By 30 the difference is small. The lower panel takes one real sample and builds both intervals. The t-interval is usually wider. That width is honest, because it admits we had to guess \(\sigma\).

Reading: OpenStax Introductory Statistics, Section 8.2.

Try it

  1. Degrees of freedom, df starts at 4. The solid t curve sits under the dashed normal with fatter tails.
  2. Read t* against z*. At df = 4 they are 2.78 and 1.96.
  3. Slide df down to 1. The tails swell and t* jumps past 12.
  4. Slide df up to 60. The t curve melts into the normal and t* approaches 1.96.
  5. Press New sample. The lower panel builds a z-interval and a t-interval from one sample of df + 1 values. The t one is usually wider.

8.3 Intervals for proportions

Polls estimate a proportion, the share \(p\) of voters who support something. Ask \(n\) voters, count \(x\) supporters, and the sample proportion is \(\hat{p} = x/n\). Because a count of successes is binomial and nearly normal for large \(n\), the interval has the familiar shape,

\[\hat{p} \pm z^{*}\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}.\]

Poll a hundred voters over and over. The intervals wobble around the true \(p\), and about 95 % of them capture it, exactly as in 8.1. Now drop \(n\) to 10 and push \(p\) toward 0.05. The capture rate falls short of the promise, because the normal approximation needs both \(n p\) and \(n(1-p)\) to be at least 5. Real polls quote a “margin of error” of about three points, which is this formula with \(n \approx 1000\).

Reading: OpenStax Introductory Statistics, Section 8.3.

Try it

  1. True support p is 0.40 and each poll asks 100 voters.
  2. Press Poll 100 voters. The poll's p̂ and its interval appear at the top.
  3. Press Poll 50 times a few times. Capture rate settles near Nominal.
  4. Slide Voters per poll, n down to 10 and poll again. A warning appears and the capture rate falls short.
  5. Slide p to 0.05 for the same effect. The normal approximation needs n·p and n·(1 − p) of at least 5.

Where 1.96 comes from

Transcript

Where 1.96 comes from.

Shade the middle 95% of the standard normal.

That leaves 2.5% in each tail.

The z that cuts off 2.5% is 1.96. Read it off the curve, not a table.

A 95% interval reaches 1.96 standard errors either side of the sample mean.

One sample of 20 from a population with σ = 10. Its mean is 52.1.

52.1 plus or minus 4.38, so 47.7 to 56.4.

Change 95% and the 1.96 changes with it. The shape of the curve decides, not the data.