Statistics lab charts
NumLM logo
NumLM
LEARN · SIMULATE · VERIFY

From probability to LLMs — a self-paced learning platform that teaches the principles properly

Sign in
Learn
ToolsBlog
Help
Home
This page in other languages:한국어 원문
English

Confidence Interval

Master it step by step with milestone learning
statistics
confidence interval
inferential statistics
interval estimation
margin of error
Try this concept yourself
한국어
What you will be able to do
Foundations
  • • Understand the basic concept of a confidence interval and how to interpret it
Deeper study
  • • Compute confidence intervals in a variety of situations
Real-world practice
  • • Construct and interpret confidence intervals for complex parameters
At a glance

A confidence interval is an interval estimate constructed so that, if the same sampling procedure were repeated many times, a specified proportion of the resulting intervals (the confidence level, usually 95%) would contain the fixed population parameter (Neyman 1937).

You can verify this hands-on in the NumLM interactive lab (Korean).

한국어

Learning roadmap

Click a step to view its content

Foundations
Definitions and core principles
About 25 min
Open
Deeper study
Derivations and worked examples
About 35 min
Open
Real-world practice
Real cases and advanced applications
About 45 min

Progress (completed levels)

0%

Basic: What Is a Confidence Interval?

Difficulty 3/5
About 25 min

A confidence interval is a range of values that is expected to contain a population parameter. A 95% confidence interval means that if you built an interval the same way 100 times, about 95 of those intervals would contain the true parameter.

Key points
  • A range of values expected to contain the parameter
  • Certainty is expressed by the confidence level (usually 95%)
  • A narrower interval means a more precise estimate
  • Larger samples produce narrower intervals
A simple example

If you measure 100 people and find a mean height of 170 cm with a standard deviation of 5 cm, the 95% confidence interval for the population mean is about 169 to 171 cm.
Want to see it for yourself? Click the "Try this concept yourself — Confidence Interval Simulator" button at the top of this page. It throws 100 confidence intervals like nets and lets you count how many of them catch the true value.

20 different 95% confidence intervals — one per sampleThe intervals (the net) move; the true value μ (the fish) stays fixedtrue value μ (fixed)Sample 1Sample 20Missed the true value!19 of 20 (95%) contain the true value μ — that is what "95% confidence" meansAbout 5% of intervals, like the red one, will inevitably miss — it is the success rate of the "method", not a probability attached to one interval
Check your understanding

Answer:

If you construct a confidence interval the same way 100 times, about 95 of those intervals will contain the true population parameter.

Answer:

Strictly speaking, no. The population mean is a fixed number, so it is either inside a given interval (100%) or not (0%). The 95% is a property of the method used to build intervals, not of any single interval: if you repeat the method, about 95% of the intervals you produce will contain the true value.

Answer:

It shrinks by half. The width is inversely proportional to √n, so quadrupling the sample makes the estimate √4 = 2 times more precise. In other words, doubling your precision costs four times as much data collection.

At the Basic level you learned that a confidence interval is a "net for catching the true value." Now let's see how the size of that net is determined. A confidence interval is built as point estimate ± margin of error.
Why the ±? By the central limit theorem, the sample mean x̄ scatters around the true value μ in a symmetric, bell-shaped pattern. So we center the interval on x̄ and add and subtract the same width on both sides.
Why divide by √n? When you average several values, their random errors partially cancel out, so the wobble of the sample mean (its standard error) is σ/√n — smaller than the standard deviation σ of the individual data points. This is why quadrupling the sample halves the interval width.
Margin of error = critical value × standard error. If the population variance is known you use a critical value from the Z (standard normal) distribution; if it is unknown, you use the t distribution.

Mathematical formula

x̄ is the sample mean, z is the Z critical value, t is the t critical value, σ is the population standard deviation, s is the sample standard deviation, and n is the sample size. The t critical value depends on the degrees of freedom (n−1); for example, with n=25 you have 24 degrees of freedom and t₀.₀₂₅ = 2.064.

Learn through examples
Example 1: Confidence Interval for a Mean

Testing the lifetime of a new battery

Sample: n=25, x̄=120 hours, s=10 hours
95% CI: 120 ± 2.064 × (10/√25) = 120 ± 4.13 = [115.87, 124.13] hours

Answer:

The 95% confidence interval is [115.9, 124.1] hours. This does not mean "there is a 95% chance the population mean is in this interval." It means that if you repeated the study the same way, about 95% of the intervals you produced would contain the true mean lifetime. (Note: 2.064 is the upper 2.5% point of the t distribution with 24 degrees of freedom.)

When the population standard deviation is unknown and the sample is small (n=25), use the t distribution. Using the Z critical value 1.96 on the same data gives a narrower interval, [116.1, 123.9], which overstates your precision. The smaller the sample, the larger the t critical value — and the wider interval that results is the honest representation of your uncertainty.

Example 2: Confidence Interval for a Proportion

Results of an election poll

Sample: n=1000, p̂=0.52 (52%)
95% CI: 0.52 ± 1.96 × √(0.52×0.48/1000) = 0.52 ± 0.031 = [48.9%, 55.1%]

Answer:

The 95% confidence interval for the candidate's support is [48.9%, 55.1%]. Because the interval straddles 50%, this poll alone cannot establish that the candidate has a majority. The "sampling error of ±3.1 percentage points (95% confidence level)" you see in news reports is exactly the margin of error of this interval.

If the gap between two candidates is within the margin of error (±3.1 points), the race should be described as "a statistical tie." The standard error of a proportion, √(p̂(1−p̂)/n), is largest near p̂=0.5, so the closer the race, the harder it is to call with the same sample size.

You learned what a confidence interval means at the Basic level and how to compute one at the Intermediate level. Now we look at how it is actually used to make decisions. In practice, confidence intervals go far beyond a simple calculation — they are a core tool of business decision-making. They connect to more advanced techniques: understanding how they differ from Bayesian credible intervals, estimating effect sizes in meta-analysis, and power analysis in experimental design. Nonparametric methods such as the bootstrap offer a robust alternative when distributional assumptions are violated, and Bayesian approaches allow more flexible uncertainty quantification that incorporates prior information.

Real-world applications
Manufacturing / Quality Control
Setting product quality standards and controlling processes

Example:

Assessing mean lifetime and variability in durability tests of automotive parts

Why it matters:

Setting quality standards, forecasting defect rates, improving customer satisfaction, and minimizing recall risk to reduce the cost of quality

Finance / Risk Management
Computing Value at Risk (VaR) and assessing portfolio risk

Example:

Evaluating the potential daily loss of an investment portfolio and its credit risk

Why it matters:

Meeting regulatory capital requirements, strengthening investor confidence, and improving risk-adjusted return (RAROC) for a competitive edge

Digital Marketing / A/B Testing
Improving conversion rates and measuring campaign effectiveness

Example:

Quantifying the effect of a website UI change on purchase conversion rate

Why it matters:

Higher marketing ROI, faster decisions, and increased revenue through more accurate personalized recommendation systems

Healthcare / Clinical Research
Drug development and evaluation of treatment effects

Example:

Evaluating COVID-19 vaccine efficacy and monitoring safety

Why it matters:

Shorter development timelines, patient safety, and a higher probability of regulatory approval, making development spending more efficient

Case study: A Global E-Commerce Company's Delivery-Time Improvement Project
Background

Note: The scenario below is fictional and created for learning purposes; the figures are not real company data.
A global e-commerce company wants to quantify the effect of faster delivery on customer satisfaction. As competition intensifies, delivery speed has become a key factor in customers' choices, and the company needs scientific evidence of the return on its investment in a new logistics system.

The problem

Delivery times under the existing logistics system fall short of customer expectations, and the company lags competitors on speed. The company needs to measure objectively how much the new logistics system actually improves delivery times and to verify whether the improvement is statistically significant.

The data

Old system: mean delivery time 3.2 days (standard deviation 1.5 days). New logistics system: mean 2.8 days (standard deviation 1.2 days). Samples of 10,000 shipments per group. The data were stratified across 16 regions nationwide, split into urban and rural areas, and broken down by product category (electronics, apparel, household goods).

Method

An independent-samples t-test to build a 95% confidence interval for the difference in delivery time; stratified analysis by region and product category to measure detailed effects; bootstrap methods to correct for non-normality and produce robust intervals. Time-series analysis was run in parallel to remove seasonal effects.

Solution and results

Overall reduction in delivery time: 0.4 days ± 0.04 days [95% CI: 0.36, 0.44 days]
By region: 0.5-day reduction in urban areas, 0.3 days in rural areas
By product category: electronics 0.6 days, apparel 0.4 days, household goods 0.2 days
Statistical significance: t = 20.8, p < 0.001 — a highly significant improvement

A statistically significant improvement was confirmed, and the entire confidence interval sits clearly above zero (at least 0.36 days), so the company can conclude that the reduction is "real, not chance." This translates into higher customer satisfaction and repeat-order rates and fewer delivery complaints, strengthening the company's competitive position.

Conclusion:

Quantitative analysis with confidence intervals provided scientific proof of the logistics investment's effect and a basis for deciding to expand it. Because the improvement was demonstrated at the 95% confidence level, the analysis became the justification for approving a company-wide logistics upgrade.
[Try it yourself] What if each sample in this case had been 100 shipments instead of 10,000? Plug n=100 into the standard error formula √(s₁²/n₁ + s₂²/n₂) and the 95% confidence interval widens dramatically to about [0.02, 0.78] days — making it hard to claim the 0.4-day reduction with confidence. Work through the calculation and see for yourself how sample size changes the level of confidence behind a decision.

References
  • Neyman, J. (1937), "Outline of a Theory of Statistical Estimation Based on the Classical Theory of Probability", Philosophical Transactions of the Royal Society A 236, 333–380 — the original paper introducing confidence intervals
  • Student [W. S. Gosset] (1908), "The Probable Error of a Mean", Biometrika 6(1), 1–25 — the origin of the t distribution used for small-sample inference
  • Brown, L. D., Cai, T. T. & DasGupta, A. (2001), "Interval Estimation for a Binomial Proportion", Statistical Science 16(2), 101–133 — a comparison of confidence interval methods for proportions
  • Efron, B. (1979), "Bootstrap Methods: Another Look at the Jackknife", The Annals of Statistics 7(1), 1–26 — the original paper on bootstrap confidence intervals
  • NIST/SEMATECH e-Handbook of Statistical Methods §1.3.5.2 — Confidence Limits for the Mean (the t-based confidence interval formula used at the Intermediate level)
Back to the theory page