Estimation and Confidence Intervals

Quantifying uncertainty around estimates with standard errors and confidence intervals, and reporting them plainly.

Intermediate · about 4 hours · difficulty 3/5

Learn first: Probability and Distributions, Sampling, Bias and Data Collection

A single number hides uncertainty. "Conversion is 4.2%" means little until you know whether that came from 100 or 100,000 visitors. Confidence intervals express that uncertainty.

The idea

  • The standard error measures how much an estimate would vary across repeated samples. For a mean it is the standard deviation divided by the square root of n.
  • A 95% confidence interval is roughly the estimate plus or minus 1.96 standard errors.
  • For a proportion p with n observations, the standard error is sqrt(p(1-p)/n).

Interpreting correctly

The precise meaning: if we repeated the sampling many times, 95% of intervals built this way would contain the true value. In practice, say "our best estimate is 4.2%, and values between 3.8% and 4.6% are consistent with the data."

Useful habits

  • Show intervals as error bars on charts comparing segments.
  • If two segments' intervals overlap heavily, do not rank them confidently.
  • For skewed data or medians, use the bootstrap: resample your data with replacement thousands of times and take the middle 95% of the resulting estimates. It is easy in Python and works for almost any statistic.

Pitfall: saying "there is a 95% probability the true value is in this interval" in a technical review; it is a common but imprecise phrasing. Also, intervals only cover sampling noise, not bias. Move on when you can compute and explain an interval for a conversion rate by hand.

Key concepts

  • Standard error
  • Confidence interval for a mean
  • Confidence interval for a proportion
  • Interpreting intervals in plain language
  • Bootstrap resampling
  • Error bars on charts

Mini project

For the Titanic passenger dataset on Kaggle, compute survival rates with 95% confidence intervals by passenger class and plot them with error bars.

Check yourself

If you quadruple your sample size, what happens to the width of a confidence interval?

Free resources