Confidence Interval Simulator

Inference Core Capture the Parameter

Watch repeated random samples construct horizontal confidence intervals. Count how many intervals span the fixed truth (μ) to understand what 95% confidence actually means.

👨‍🏫 Professor Mode: Guided Learning Experience

New to confidence intervals? Enable Professor Mode for step-by-step guidance on repeated sampling, parameter capture, and frequentist interpretations!

OVERVIEW & WHAT THIS TOOL SOLVES

The most widespread statistical misconception in business is claiming that a "95% confidence interval of [$58, $72]" means there is a 95% probability the true population mean μ sits inside that specific range. In reality, μ is a fixed number—your random sample interval either captured it or missed it! The Confidence Interval Simulator draws hundreds of repeated random samples from a known population so you can watch intervals hit or miss μ in real time and see what "95% coverage" actually means.

🎯 Questions It Answers

  • What does "95% confidence" mean across repeated random studies from the same customer population?
  • How do sample size (n) and confidence level (90%, 95%, 99%) trade off interval width against miss rate?
  • Does Student's t interval still achieve its promised coverage when customer spend is right-skewed or bimodal?

📂 What Data You Need

  • Population Shape: Choose Right-Skewed Customer LTV, Normal Satisfaction, Bimodal Segments, or Uniform
  • Sampling Design: Sample size per study (n) and target confidence level (1 − α)
  • Estimator & Simulation Batch: Student's t (estimated s) vs. known-σ Z interval, drawn 1, 25, or 100 studies at a time

💡 What You'll Discover

  • Live Hit/Miss Interval Forest: Horizontal intervals colored green when they bracket true μ and red when they miss
  • Empirical Coverage Scoreboard: Convergence of observed hit rate toward the theoretical (1 − α) target
  • Width & Small-Sample Breakdown: Why naive Z intervals under-cover at small n and how t critical values compensate
🔍 Key Nuances & Common Traps to Watch For
  • The Interval Is Random, Not the Parameter: Before you draw a sample, the procedure has a 95% chance of producing an interval that covers μ. Once calculated from one sample, the interval is fixed—95% refers to the long-run reliability of the method.
  • Higher Confidence Requires Wider Intervals: Moving from 90% to 99% confidence at the same sample size n forces you to widen the margin of error so fewer intervals miss μ. The only way to get both high confidence and a narrow interval is to increase n.
  • Central Limit Theorem & Skewness: On heavily right-skewed spend data with tiny samples (n = 5), sample means and sample standard deviations correlate, causing empirical coverage to dip below 95% until n ≥ 30.
📐 Under the Hood: Model Equations & Variable Definitions

1. Student's t Confidence Interval & Margin of Error

\[ \text{SE}_{\bar{x}} = \frac{s}{\sqrt{n}}, \qquad \text{ME} = t_{\alpha/2,\,n-1} \cdot \frac{s}{\sqrt{n}}, \qquad \text{CI}_{1-\alpha} = \left[\bar{x} - \text{ME},\; \bar{x} + \text{ME}\right] \]

💬 Read it in plain English: Each random sample k centers its interval at its own sample mean x̄_k and extends outward by the critical t-multiplier times the sample standard error s_k / √n.

μ, σ
True Population Mean & SDYOUR DATA ⓘ
Fixed ground-truth population parameters of the selected distribution.
n
Sample Size per StudyYOUR DATA ⓘ
Number of observations drawn independently in each simulated study.
x̄, s
Sample Mean & Sample SDESTIMATED ⓘ
Point estimate and sample standard deviation computed within a single study.
SEx̄, ME
Standard Error & Margin of ErrorOUTPUT ⓘ
Estimated sampling standard deviation s/√n and half-width of the confidence interval.
tα/2, n−1
Critical t-MultiplierINFERENCE ⓘ
Two-tailed quantile from Student’s t distribution with df = n − 1.

2. Long-Run Empirical Coverage Rate Across M Simulated Studies

\[ \text{Hit}_k = \mathbb{I}\!\left(\mu \in [L_k, U_k]\right), \qquad \widehat{\text{Coverage}}_M = \frac{1}{M}\sum_{k=1}^{M} \text{Hit}_k \xrightarrow{M \to \infty} 1 - \alpha \]

💬 Read it in plain English: Study k scores a hit (1) if its lower and upper bounds [L_k, U_k] bracket the true population mean μ; as the number of repeated studies M grows, the fraction of hits converges to the target confidence level 1 − α.

[Lk, Uk]
Study k Interval BoundsOUTPUT ⓘ
Lower bound x̄_k − ME_k and upper bound x̄_k + ME_k for simulated study k.
Hitk, M
Capture Indicator & Study CountOUTPUT ⓘ
Binary indicator (1 = captured μ, 0 = missed μ) and total simulated studies M.
CoverageM
Empirical Coverage RateINFERENCE ⓘ
Observed proportion of the M intervals that contain the true parameter μ.
Total Studies 0 Independent random samples
Captured True μ 0 Intervals containing parameter
Missed True μ 0 Intervals failing to capture
Empirical Coverage — Target: 95%

1. Population Distribution & Sampling Parameters

Notice how larger \(n\) narrows the confidence intervals without altering coverage rate.

Determines the theoretical target capture frequency.

Constructed Intervals (Green = Spans μ, Red = Misses μ)

● Spanned True μ ● Missed True μ - - True Parameter (μ)