#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
Module 3
10 min read

Confidence Intervals

Build and interpret confidence intervals

What You'll Learn

  • What confidence intervals are
  • Calculating CIs
  • Interpreting results
  • Common confidence levels

Confidence Interval Basics

What it is: Range where we're confident true population parameter lies

Example: "95% confident true mean is between 45 and 55"

NOT: "95% chance true mean is in this range"

Interpretation

Correct: If we repeated sampling 100 times, ~95 of those intervals would contain true mean

Wrong: Probability true mean is in this specific interval

Calculating CI for Mean

Formula: CI = Sample Mean ± (Critical Value × SE)

Where:

  • SE = s / √n
  • Critical value from t-distribution
  • Usually 1.96 for 95% confidence (large n)

Example: Sample: n=100, mean=50, SD=10 SE = 10/√100 = 1 95% CI = 50 ± (1.96 × 1) = [48.04, 51.96]

Confidence Levels

90% CI: Narrow, less confident 95% CI: Most common 99% CI: Wide, more confident

Trade-off: Higher confidence = Wider interval

Margin of Error

Half-width of CI: ME = Critical Value × SE

Example: If CI = [48, 52] ME = 2

Reducing ME:

  • Increase sample size
  • Accept lower confidence

Sample Size Calculation

For desired ME: n = (Z × σ / ME)²

Example: Want ME = 1 with 95% confidence, σ = 10 n = (1.96 × 10 / 1)² = 384

Excel Implementation

Formula: =CONFIDENCE.T(alpha, stdev, n)

Example: =AVERAGE(A1:A100) ± CONFIDENCE.T(0.05, STDEV.S(A1:A100), 100)

Python Implementation

Example: python from scipy import stats import numpy as np

confidence = 0.95 data = [...] mean = np.mean(data) se = stats.sem(data) ci = stats.t.interval(confidence, len(data)-1, mean, se)

Real-World Applications

Product testing: "95% confident conversion rate is 2-4%"

Medical trials: "Drug reduces symptoms by 10-20 points (95% CI)"

Polling: "Candidate has 48-52% support"

Common Mistakes

Misinterpretation: NOT probability true value in range

Using wrong formula: Z vs t distribution

Too small sample: n < 30 needs t-distribution

Practice Exercise

Sample: n=50, mean=75, SD=12

Calculate 95% CI for mean.

Next Steps

Learn about T-Tests!

Tip: CI tells you precision of your estimate!

SkillsetMaster - AI, Web Development & Data Analytics Courses