Module 06

Confidence Intervals

Quantifying uncertainty in your estimates

Understanding Estimation Uncertainty

  • 01

    Point vs Interval

    Single estimate versus range of plausible values

  • 02

    Confidence Level

    Probability interpretation of interval coverage

  • 03

    Margin of Error

    Half-width of confidence interval

  • 04

    Sample Size Effect

    How n affects interval precision

01

Point vs Interval Estimates

Interactive CI Simulator

Confidence Interval Explorer
50
30
Intervals containing μ: - Coverage: -

See what '95% confidence' really means! Click 'Run Simulation' to generate many random samples and their confidence intervals. The red line shows the true population mean (μ = 100). Watch how about 95% of intervals capture the true mean—some miss! This demonstrates that confidence refers to the method's reliability, not any single interval.

Two Types of Estimation

x̄ = 72.5
Point Estimate
Single best guess
→
[68.2, 76.8]
Interval Estimate
Range of plausible values

A point estimate gives a single value as our best guess for a population parameter. An interval estimate provides a range of values that likely contains the true parameter. While the point estimate is precise, it's almost certainly wrong. The interval estimate acknowledges uncertainty by providing bounds.

The Need for Uncertainty

Sample 1: x̄ = 71.2
Sample 2: x̄ = 73.8
Sample 3: x̄ = 72.1
Sample 4: x̄ = 74.5
Different samples → Different point estimates
We need a way to capture this variability

Every sample gives a different point estimate due to sampling variability. If we took 100 samples, we'd get 100 different means. A confidence interval captures this variability by providing a range that, in repeated sampling, would contain the true parameter a specified percentage of the time.

Building a Confidence Interval

CI = x̄ ± (t × SE)
x̄
Point Estimate
t
Critical Value
SE
Standard Error

A confidence interval has three components: (1) the point estimate (sample mean), (2) a critical value from the t or z distribution that determines width based on confidence level, and (3) the standard error which measures sampling variability. Together: CI = point estimate ± margin of error.

02

Confidence Level Interpretation

What 95% Means

95% confidence: If we repeated this process many times,
~95 of 100 intervals would contain the true μ

A 95% confidence level does NOT mean there's a 95% probability that μ is in this particular interval. The true μ is fixed - it either is or isn't in the interval. Instead, 95% refers to the long-run success rate of the procedure: if we constructed many intervals this way, about 95% would capture μ.

Choosing Confidence Level

90%
Narrower
z = 1.645
95%
Standard
z = 1.960
99%
Wider
z = 2.576

Higher confidence levels produce wider intervals. 90% CI is narrower but misses μ more often. 99% CI is wider but rarely misses. 95% is the most common choice, balancing precision and reliability. The choice depends on the cost of being wrong versus the need for precision.

What CIs Do NOT Mean

✗
"95% probability μ is in this interval"
✗
"95% of the data falls in this range"
✗
"We're 95% sure about this result"
✓
"95% of such intervals contain μ"

Common misinterpretations: CIs don't give probability statements about a fixed parameter, don't describe where data falls, and don't measure subjective confidence. The correct interpretation is frequentist: in repeated sampling, 95% of intervals constructed this way would contain the true parameter.

03

Margin of Error

Understanding Margin of Error

x̄
← ME →
← ME →
ME = t × (s / √n)

Margin of error (ME) is the half-width of a confidence interval. It represents the maximum likely difference between the sample estimate and true parameter. ME depends on: (1) confidence level (via t or z), (2) sample variability (s), and (3) sample size (n). Wider margins mean less precision.

What Affects Margin of Error

↑ n
Sample Size
↓ ME decreases
↑ s
Variability
↑ ME increases
↑ C
Confidence
↑ ME increases

Three factors affect margin of error: (1) Larger samples decrease ME because √n is in the denominator, (2) More variable data increases ME because s is in the numerator, (3) Higher confidence levels increase ME because the critical value grows. Only sample size is within researcher control.

Poll Margin of Error

Election Poll Results
Candidate A: 52%
Candidate B: 48%
n = 1,000, ME = ±3.1%
Candidate A: 48.9% to 55.1%
Candidate B: 44.9% to 51.1%
Intervals overlap → Race is too close to call!

In polling, ME shows the uncertainty in reported percentages. With ME = ±3.1%, a reported 52% really means 48.9% to 55.1%. When two candidates' intervals overlap, the race is 'within the margin of error' - we can't confidently declare a leader.

04

Sample Size and Precision

The √n Relationship

n=25
ME=10
n=100
ME=5
n=400
ME=2.5
n=1600
ME=1.25
To halve ME, you must quadruple n

Margin of error decreases with the square root of sample size. This means diminishing returns: to halve your ME, you need 4× the sample size. Going from n=100 to n=400 halves ME. Going from n=400 to n=1600 halves it again. This relationship drives sample size planning.

Sample Size Calculation

Goal: Estimate mean with ME = 5, σ ≈ 20
Confidence: 95% (z = 1.96)
n = (z × σ / ME)²
n = (1.96 × 20 / 5)²
n = (7.84)²
n ≈ 62

To plan a study, determine the desired margin of error, estimate population variability (from pilot study or literature), and solve for n. The formula n = (z × σ / ME)² gives minimum sample size. Always round up, and add extra for potential dropouts or incomplete data.

Precision vs Resources

Small n
✓ Cheaper
✓ Faster
✓ Easier
✗ Wide CI
✗ Less power
Large n
✗ Expensive
✗ Time-consuming
✗ Harder to manage
✓ Narrow CI
✓ More power
Rule of thumb: Find smallest n that gives acceptable precision for your decision-making needs

Sample size involves trade-offs between precision and resources. Larger samples give narrower intervals but cost more time and money. The optimal n is the smallest sample that provides adequate precision for your specific needs. Over-sampling wastes resources; under-sampling wastes the entire study.

05

Types of Confidence Intervals

CI for Population Mean

When σ is known (rare):
x̄ ± zα/2 × (σ / √n)
When σ is unknown (common):
x̄ ± tα/2, df × (s / √n)
df = n - 1

For means, use z-interval when population σ is known (rare in practice). Use t-interval when estimating σ from sample s (common). The t-distribution has heavier tails than z, giving wider intervals that account for uncertainty in estimating σ. As n increases, t approaches z.

CI for Population Proportion

p̂ ± zα/2 × √(p̂(1-p̂) / n)
Example: 520 of 1000 favor policy A
p̂ = 0.52
SE = √(0.52 × 0.48 / 1000) = 0.0158
95% CI = 0.52 ± 1.96(0.0158)
95% CI = [0.489, 0.551]

For proportions, the standard error depends on p̂ itself. This Wald interval works well when np̂ ≥ 10 and n(1-p̂) ≥ 10. For small samples or extreme proportions, use Wilson score interval or exact binomial methods for better coverage.

CI for Difference Between Groups

Difference in means:
(x̄₁ - x̄₂) ± t × SEdiff
Difference in proportions:
(p̂₁ - p̂₂) ± z × SEdiff
If CI contains 0: groups may not differ
If CI excludes 0: significant difference

CIs for differences help compare two groups. The interval is centered on the difference between sample statistics. If the interval contains zero, the difference is not statistically significant. If it excludes zero, we have evidence of a real difference. This connects CIs directly to hypothesis testing.

Bootstrap Confidence Intervals

1. Resample with replacement (B times)
θ̂₁*
θ̂₂*
θ̂₃*
...
θ̂B*
2. Use percentiles of bootstrap distribution
95% CI = [θ̂*2.5th, θ̂*97.5th]

Bootstrap CIs don't require distributional assumptions. Resample your data thousands of times, compute the statistic each time, then use percentiles of the bootstrap distribution as CI bounds. Works for any statistic (medians, correlations, ratios) where formulas don't exist.

★

Real-World Examples

Apply your knowledge to practical scenarios

01

Election Night Confidence

A poll of n = 1,200 likely voters shows Candidate A at 48% and Candidate B at 44%, with 8% undecided. The margin of error is ±2.8 percentage points at 95% confidence.

Q What is the 95% CI for Candidate A's support? +
A 48% ± 2.8% = [45.2%, 50.8%]. We're 95% confident A's true support is between 45.2% and 50.8%.
Q Do the candidates' confidence intervals overlap? What does this mean? +
A A: [45.2%, 50.8%], B: [41.2%, 46.8%]. Yes, they overlap (45.2 to 46.8). This means the race is within the margin of error—too close to call definitively.
Q If the poll wanted to halve the margin of error to ±1.4%, how many people would need to be surveyed? +
A To halve ME, quadruple n. Need approximately 4 × 1,200 = 4,800 voters. The √n relationship means precision is expensive!
Q The news reports 'Candidate A leads by 4 points.' Is this accurate reporting? +
A Technically yes (48% - 44% = 4 points), but incomplete. Better reporting: 'Candidate A leads by 4 points, within the 2.8-point margin of error.' The lead isn't statistically significant.
Key Insights
  • Overlapping CIs indicate the difference isn't statistically significant
  • Margin of error applies to EACH candidate, not the gap between them
  • Media often report point estimates without uncertainty—ask about the margin
02

Clinical Trial Results

A drug trial compares a new medication to placebo. Treatment group (n=150): mean blood pressure reduction 12 mmHg, SD = 8. Placebo group (n=150): mean reduction 4 mmHg, SD = 7. Calculate the 95% CI for the difference.

Sample Data
{
  "treatment": {
    "n": 150,
    "mean": 12,
    "sd": 8
  },
  "placebo": {
    "n": 150,
    "mean": 4,
    "sd": 7
  }
}
Q What is the point estimate of the treatment effect? +
A 12 - 4 = 8 mmHg. The drug appears to reduce blood pressure by 8 mmHg more than placebo on average.
Q Calculate the standard error of the difference. +
A SE_diff = √(s₁²/n₁ + s₂²/n₂) = √(64/150 + 49/150) = √(0.427 + 0.327) = √0.754 ≈ 0.87 mmHg
Q What is the 95% CI for the treatment effect? +
A 8 ± 1.96(0.87) = 8 ± 1.7 = [6.3, 9.7] mmHg. We're 95% confident the true effect is between 6.3 and 9.7 mmHg.
Q Is the drug effective? How do you know from the CI? +
A Yes! The CI [6.3, 9.7] excludes 0. Even the lower bound (6.3 mmHg) represents a clinically meaningful reduction. Both statistical and clinical significance achieved.
Key Insights
  • CI excluding 0 for a difference = statistically significant effect
  • Look at the entire interval: even the lower bound should be meaningful
  • Clinical significance (Is 6 mmHg useful?) differs from statistical significance
03

The 95% Misunderstanding

A researcher calculates a 95% CI for the mean height of adult males: [175.2 cm, 178.8 cm]. Their colleague asks: 'So there's a 95% chance the true mean is in this interval?'

Q Is the colleague's interpretation correct? +
A No! This is the most common CI misconception. The true mean μ is a fixed value—it either IS or ISN'T in the interval. Probability doesn't apply to fixed values.
Q What does 95% confidence actually mean? +
A If we repeated this study many times, about 95% of the CIs we'd calculate would contain the true μ. The 95% refers to the reliability of the METHOD, not this specific interval.
Q If 20 researchers each calculate a 95% CI from their own sample, how many would contain μ? +
A About 19 out of 20 (95%). One researcher's interval would miss μ, but they wouldn't know which one. Each individual researcher's interval either contains μ or doesn't.
Q For Bayesian credible intervals, IS the colleague's interpretation correct? +
A Yes! A 95% credible interval DOES mean there's a 95% probability μ is in the interval. This is a key difference between frequentist CIs and Bayesian credible intervals.
Key Insights
  • 95% confidence = 95% of such intervals contain μ (procedural interpretation)
  • It does NOT mean 95% probability for this specific interval
  • Bayesian credible intervals allow the probability interpretation people want
?

Confidence Intervals Quiz

Test your understanding • Passing score: 70%

0 of 10 answered
Q1 multiple-choice

A 95% confidence interval for a mean is [40, 60]. What does '95% confidence' mean?

Explanation: 95% confidence refers to the long-run success rate of the method. If we repeated sampling and interval construction, about 95% of intervals would contain the true parameter.
Q2 multiple-choice

To halve the margin of error, you must:

Explanation: ME ∝ 1/√n. To halve ME, you need 4× the sample size because √4 = 2. This is the diminishing returns principle of sampling.
Q3 multiple-choice

Which of the following would make a confidence interval WIDER?

Explanation: Higher confidence levels require wider intervals to capture μ more often. 99% CI is wider than 95% CI. Larger n and lower variability make intervals narrower.
Q4 calculation

Sample: n = 100, x̄ = 50, s = 10. Using z = 1.96, what is the 95% CI?

Explanation: SE = s/√n = 10/√100 = 1. CI = 50 ± 1.96(1) = 50 ± 1.96 = [48.04, 51.96]
Q5 multiple-choice

A 95% CI for the difference between two means is [-2, 8]. What can we conclude?

Explanation: Since the CI [-2, 8] contains 0, we cannot rule out that the true difference is 0. The difference is NOT statistically significant at the 95% level.
Q6 multiple-choice

Why do we use the t-distribution instead of z for most confidence intervals?

Explanation: We almost never know the true σ and must estimate it with s. The t-distribution accounts for this extra uncertainty with heavier tails, giving appropriate (wider) intervals.
Q7 multiple-choice

Which sample size formula is correct for planning a study (estimating a mean)?

Explanation: To achieve a target margin of error ME with confidence level z and estimated variability σ: n = (zσ/ME)². Always round up.
Q8 multiple-choice

What is the margin of error?

Explanation: Margin of error is the HALF-width of the CI. If CI is [40, 60], the ME is 10 (not 20). It represents the maximum likely error in either direction from the point estimate.
Q9 multiple-choice

Bootstrap confidence intervals are particularly useful when:

Explanation: Bootstrap CIs don't require formulas—they work for any statistic (medians, ratios, correlations) by resampling. They're especially useful when theoretical distributions are unknown.
Q10 multiple-choice

Two polls show Candidate A at 51% ± 3% and 53% ± 4%. Are these results contradictory?

Explanation: Poll 1: [48%, 54%]. Poll 2: [49%, 57%]. These overlap substantially (49% to 54%). The polls are consistent—both compatible with the same true value.

Quiz Results

0 %

← Experimental Design Next: Hypothesis Testing →