Confidence Intervals
How certain are we? Quantifying uncertainty
📌 Before You Start
What you need: Module 3 (CLT and standard error) completed. Understanding of the normal distribution.
What you’ll learn: What a confidence interval actually means. How to calculate one manually and with t.test(). How confidence level affects interval width. The correct — and incorrect — ways to interpret a CI.
📖 The Concept: Confidence Intervals
A confidence interval (CI) gives a range of plausible values for a population parameter (like μ). It pairs our best estimate with a measure of uncertainty.
A 95% confidence interval means: if we repeated this study many times and built a CI each time, about 95% of those intervals would contain the true population parameter.
- Wider CI = less precision, more uncertainty (small n, high variability, or high confidence level)
- Narrower CI = more precision (larger n, lower variability)
- The t-distribution is used instead of the normal when we don’t know the population SD (which is almost always in practice)
- The t* critical value depends on the confidence level and degrees of freedom (df = n − 1)
🔢 The Formula
x̄ = sample mean | t* = critical value | s = sample SD | n = sample size
For 95% CI: α = 0.05, so qt(0.975, df=n-1)
💻 In R — Worked Example (read-only)
Two ways to get a confidence interval — manual calculation and the quick way with t.test(). Both give the same result.
⚠️ Common Misconception
A 95% CI does NOT mean "there is a 95% probability the true mean is in this interval." The true mean is either in the interval or it isn’t — probability doesn’t apply to a fixed (unknown) constant. The correct interpretation: the method produces intervals that contain the true mean 95% of the time across many repetitions.
🖐️ Your Turn
Exercise 1 — Three Confidence Levels
A sample of 20 students has mean = 78 and SD = 9. Calculate 90%, 95%, and 99% confidence intervals. Notice how the interval widens as you demand more confidence.
Exercise 2 — Simulate 50 Confidence Intervals
Generate 50 random samples of n = 30 from a Normal(70, 10) population. Build a 95% CI for each. Count how many intervals contain the true mean of 70. It should be close to 47–48 (95% of 50).
Exercise 3 — Interpret Three Real CIs
Plain-language interpretation practice. Three studies report confidence intervals. For each, interpret what the CI tells us — and what it does NOT tell us.
🧠 Brain Break
A confidence interval is not about the probability that the parameter is inside — it’s about how often the method works.
Quick check: If you want a narrower CI without changing the confidence level, what would you do? (Collect a larger sample! SE = s/√n decreases as n increases.)
✅ Key Takeaway
A 95% CI means the method captures the true parameter 95% of the time — not that there’s a 95% chance the parameter is in this specific interval. Use t.test() in R for confidence intervals. Wider CI = lower precision; narrower CI = higher precision.
🏆 Module 4 Complete!
You can now build and correctly interpret confidence intervals — one of the most commonly misunderstood concepts in all of statistics. Next up: the closely related idea of hypothesis testing.