Confidence interval explained with a simple worked example

Confidence interval explained with a simple worked example

confidence interval explained means a range of values that is used to estimate an unknown population value from a sample. If a survey says 56% of respondents support a policy, the confidence interval tells you how far that estimate might be from the true proportion in the whole population.

The idea comes up everywhere in statistics, from opinion polls to clinical studies. It is one of the main topics in Unit 6 of the masterclass, Estimation and Confidence Intervals, and it connects naturally to How a poll of 1,000 people can speak for a country and What a p-value is, and what it is not.

What a confidence interval means

A confidence interval is built from a sample statistic, such as a mean or a proportion, and a margin of error. The sample gives one best guess, while the interval gives a range of values that are consistent with the data.

Suppose a poll finds that 56% of 1,000 adults support a proposal. A 95% confidence interval might be 53% to 59%. That range says the data are compatible with values in that band for the whole population. A wider interval means less precision. A narrower interval means more precision.

For a mean, the same logic applies. If 40 students report sleeping 7.2 hours a night on average, the confidence interval might be 6.8 to 7.6 hours. The mean is 7.2 hours, and the interval shows the uncertainty around that estimate.

One common misunderstanding is to treat a 95% confidence interval as if there is a 95% probability that the true value lies in that specific interval. In the usual frequentist setup, the interval either does or does not contain the true value. The 95% refers to the long-run method: if we repeated the sampling process many times, about 95% of the intervals built this way would contain the true value.

Why the margin of error appears in a confidence interval explained by sampling

The margin of error comes from random sampling variation. If you take many random samples from the same population, the sample mean or proportion will change a little each time. That is normal. The margin of error gives a rough size for that expected wiggle.

For a proportion, a common approximation is

\[ \hat{p} \pm 1.96 \sqrt{\frac{\hat{p}(1-\hat{p})}{n}} \]

for a 95% confidence interval, where \(\hat{p}\) is the sample proportion and \(n\) is the sample size. For a mean, a similar formula uses the sample standard deviation and the square root of the sample size. In both cases, a bigger sample usually gives a smaller margin of error.

That is why polls with 1,000 people are often more precise than polls with 200 people. Doubling the sample size does not halve the margin of error, because uncertainty shrinks in proportion to \(1/\sqrt{n}\), which is slower than many people expect.

Here is a simple example with a proportion. Imagine a survey of 400 students finds that 220 prefer online classes over in-person classes. The sample proportion is \(\hat{p} = 220/400 = 0.55\).

The estimated standard error is

\[ \sqrt{\frac{0.55(1-0.55)}{400}} = \sqrt{\frac{0.2475}{400}} \approx 0.0249 \]

For a 95% interval, multiply by 1.96:

\[ 1.96 \times 0.0249 \approx 0.049 \]

So the confidence interval is about

\[ 0.55 \pm 0.049 = (0.501, 0.599) \]

or 50.1% to 59.9%. A news story might round that to 50% to 60%.

Reading a confidence interval in a news story or paper

When you see a confidence interval in a report, first identify the quantity being estimated. Is it a proportion, a mean, a difference in means, or an odds ratio? The meaning changes with the statistic.

Then look at the interval itself. A report that says, “The mean score was 72, 95% CI 70 to 74,” is telling you that the data suggest the population mean is around 72, with plausible values from 70 to 74. If another study reports a mean of 72 with 95% CI 66 to 78, the estimate is the same but the uncertainty is larger.

For comparisons, watch for whether the interval includes the null value. For a difference in means, that null value is 0. For a ratio, such as a risk ratio or odds ratio, the null value is 1. If a 95% confidence interval for a risk ratio is 0.8 to 1.3, the data are compatible with both lower risk and higher risk, so the result is not clear-cut on that measure alone.

Confidence intervals are often more informative than a single p-value because they show both direction and precision. A p-value can say whether a result is surprising under a model, while an interval shows the size of the effect that the data support.

How interval width changes what you can say

Interval width depends on sample size, variability, and the confidence level. Bigger samples usually give tighter intervals. More scattered data give wider intervals. A 99% interval is wider than a 95% interval because it is built to capture the true value more often in repeated sampling.

This is why study design matters. A small clinical trial can produce a very wide interval, which means the estimate is still useful but less precise. A large national survey can give a much narrower interval, which makes its estimate easier to use for planning.

For a concrete comparison, imagine two surveys of the same yes or no question. Survey A asks 100 people and finds 52% yes. Survey B asks 1,000 people and finds 52% yes. The point estimate is the same, but Survey B will have a smaller margin of error and a narrower interval. That extra precision comes from the larger sample, not from a different answer.

Worked example in a short summary table

Quantity Sample result 95% confidence interval What it says
Proportion supporting a policy 55% 50.1% to 59.9% The true population proportion is plausibly near 55%
Mean sleep time 7.2 hours 6.8 to 7.6 hours The population mean is likely near 7.2 hours

If you want to practise this kind of interpretation, the Estimation and Confidence Intervals unit is the right place to start. You can also compare this article with The bootstrap in one page and Same statistics, different pictures, which show other ways to think about uncertainty and display data.

Frequently asked questions

Does a 95% confidence interval mean there is a 95% chance the true value is inside it?

In the usual frequentist interpretation, no. It means that if you repeated the whole sampling process many times, about 95% of the intervals made this way would contain the true value.

Why do confidence intervals get wider for small samples?

Small samples have more random variation, so the estimate is less precise. The standard error gets larger, and the margin of error grows with it.

Should I trust a study more if its confidence interval is narrow?

A narrow interval usually means the estimate is more precise, but you should still check study design, sampling, measurement quality, and whether the interval is for the quantity you care about.

For a fuller path through the topic, see Unit 6 of the masterclass and the Sampling and the Central Limit Theorem unit, which explains why these intervals work.

Sources

Learn statistics properly

The Statistics Masterclass: weekly units, quizzes, a final exam, and a certificate.
About the program