Confidence Intervals
Point estimates need ranges to be honest
A confidence interval is a range that captures the population parameter with a chosen confidence, e.g., 95% of such intervals. It converts a point estimate into a statement with honest uncertainty.
What you will learn
- Interpret a confidence interval correctly
- Construct CIs for means and proportions
- Explain why width reflects uncertainty, not bad luck
What is this?
A 95% confidence interval for a parameter is the range μ̂ ± 1.96·SE: constructed this way, 95% of such intervals across repeated samples would contain the true parameter. It is NOT '95% chance the true value is in this specific interval' — the parameter is fixed; the procedure is what's probabilistic. Wider CIs mean less certainty; bigger samples narrow them.
Why do you need it?
- A point estimate alone invites false precision — 'revenue is 4.3% flat' hides a wide band.
- CIs make decisions reasonable: 'the lift could be -1% to +4%' changes the bet.
- They encode sample size and variance transparently.
- They pair with tests: a 95% CI excluding 0 ≈ significance at α=0.05.
Mental model
Betting on a target with a dartboard's halo
Confidence interval
The dart (estimate) may be off, but the halo (interval) says how far off it might plausibly be. A small halo = confident shot; a huge halo = urgent need for more darts (data).
How it works
- Compute the point estimate and its standard error SE.
- Choose the confidence level; the z-multiplier (1.96 for 95%, 1.645 for 90%).
- Interval = estimate ± z·SE.
- Interpretation: in 95 of 100 repeated experiments, such intervals capture the truth.
- Narrow it with a bigger sample or lower variance; only tighten the level by accepting more risk.
Repeated sampling: 95% of CIs capture the truth.
Examples
CI for a mean in one line
import numpy as npnp.random.seed(5)x = np.random.normal(100, 12, 150)n, mean, s = len(x), x.mean(), x.std(ddof=1)se = s/np.sqrt(n)lo, hi = mean - 1.96*se, mean + 1.96*seprint(f"mean={mean:.2f} 95% CI [{lo:.2f}, {hi:.2f}]")The 95% CI brackets the sample mean by 1.96 standard errors — the analog of 'estimate ± uncertainty'.
In production
- Executive dashboards show revenue change as a CI, not a single 'up/down' arrow.
- Survey reporting prints margin of error (half-width) with every CSAT score.
- Forecast baselines ship with 80%/95% bands for capacity planning.
Best practices
- Always report intervals for estimates that will be compared or budgeted against.
- Prefer 90–95%; avoid absurd 99.9% bands that look like 'no accuracy at all'.
- For skewed metrics, consider bootstrap CIs instead of the normal approximation.
- State n and variance alongside the interval so readers see what drives width.
Common mistakes
- Saying 'there's a 95% chance the truth is in THIS interval' (the parameter isn't random).
- Reading non-overlapping CIs as 'proven different' without a proper test.
- Using the population SD when only the sample is known.
- Overstating precision for log-normal-like data by using the normal-approx interval.
Debugging tips
- Absurdly narrow CI? Check you divided by n instead of sqrt(n), or used population σ.
- CI wider than the data range? Likely a typo'd scaling or heavy outliers.
- Interval hugs zero but test p ≈ 0.05 — report the interval and its implications, not the cutoff.
- Bootstrap CI wildly different from normal? Returns skewed data — trust the bootstrap.
Interview checkpoint
Quick quiz
A 95% CI for a mean is computed as estimate ±:
Doubling the sample size roughly halves the CI width.