Prob and StatsInference

Confidence Intervals for a Mean

Use t when the population standard deviation is unknown.

Not started Jump to practice

To estimate a population mean, start from the sampling distribution of $\bar{x}$: centered at $\mu$ with standard deviation $\sigma/\sqrt{n}$. The interval looks like the one for a proportion, with one twist: we almost never know $\sigma$.

Key idea

A confidence interval for a mean is $$\bar{x} \pm t^*\dfrac{s}{\sqrt{n}},$$ where $t^*$ comes from the t distribution with $n - 1$ degrees of freedom. Use it with a random sample from a population that is roughly normal, or with a large sample (no strong skew or outliers when n is small).

Why it works

If $\sigma$ were known, $\bar{x} \pm z^*\sigma/\sqrt{n}$ would work exactly as for proportions. Replacing $\sigma$ with the sample SD $s$ adds a second source of randomness: $s$ itself varies from sample to sample, and in small samples it is often too small. The statistic $(\bar{x} - \mu)/(s/\sqrt{n})$ therefore varies more than a z-score; its distribution, the t distribution (worked out by William Gosset, writing as "Student"), has heavier tails. So $t^* > z^*$, and the interval is wider. With more data, $s$ settles down and t approaches the normal curve.
The t curve (blue) against the normal (dashed). Slide the degrees of freedom up: the tails thin out and t approaches the normal.

Worked example: A 95% interval

A random sample of 16 bags of trail mix has mean weight $\bar{x} = 31.4$ grams and $s = 4$ grams. Find a 95% confidence interval for the mean weight of all bags. ($t^* = 2.131$ for 15 df.)
  1. df $= 16 - 1 = 15$; standard error $= \dfrac{4}{\sqrt{16}} = 1$ gram.
  2. Margin: $2.131 \times 1 = 2.131$.
  3. Interval: $31.4 \pm 2.131$, from $29.269$ to $33.531$ grams.
  4. We are 95% confident the mean weight of all bags is between about 29.3 and 33.5 grams.

Answer: $(29.27, 33.53)$ grams

Worked example: A 90% interval

A random sample of 25 commuters has $\bar{x} = 72$ minutes and $s = 10$. Find a 90% interval. ($t^* = 1.711$ for 24 df.)
  1. SE $= \dfrac{10}{\sqrt{25}} = 2$.
  2. Margin: $1.711 \times 2 = 3.422$.
  3. Interval: $72 \pm 3.422$, from $68.578$ to $75.422$ minutes.

Answer: $(68.58, 75.42)$ minutes

Common mistake

Using $z^*$ with $s$, or the wrong degrees of freedom. With 16 observations, $z^* = 1.960$ would give an interval that captures $\mu$ less often than 95% of the time. Check: if you used $s$, use $t^*$ with $n - 1$ degrees of freedom.
Software reports these intervals for regression slopes and means alike; in the econometrics course every coefficient comes with one.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 3 XP.

Loading practice…

Builds on

Leads to

Sources and further reading

  • OpenStax, Introductory Statistics 2e, section 8.2 A Single Population Mean using the Student t Distribution
@teddyrookbook GitHub