A confidence interval (CI) is a range of values that estimates an unknown population parameter with a specified level of confidence. Rather than providing a single point estimate (like a sample mean or proportion), a confidence interval acknowledges uncertainty and gives a plausible range where the true parameter is likely to fall. The "confidence level" (typically 90%, 95%, or 99%) represents the long-run frequency with which such intervals would contain the true parameter if we repeated the sampling process many times.
It's crucial to understand that a 95% confidence interval does NOT mean "there's a 95% probability the true parameter is in this interval." Once the interval is calculated, the parameter either is or isn't in it—the probability is either 0 or 1. What 95% means is: if we constructed confidence intervals from 100 random samples using the same method, approximately 95 of those intervals would contain the true parameter. This is a statement about the long-run performance of the method, not about a single interval.
Confidence Interval for a Population Mean (σ Known - Z-Interval)
When the population standard deviation σ is known and the sample size is large (n ≥ 30), or the population is normally distributed for any n, use the z-interval formula:
CI = x̄ ± zα/2 × (σ / √n)
Where x̄ is the sample mean, zα/2 is the critical z-value (e.g., 1.96 for 95% confidence), σ is the population standard deviation, and n is the sample size. The term σ / √n is the standard error of the mean (SE), which measures the variability of the sample mean across different samples.
Confidence Interval for a Population Mean (σ Unknown - t-Interval)
In practice, the population standard deviation σ is rarely known. When you only have the sample standard deviation s, use the t-interval formula:
CI = x̄ ± tα/2, df × (s / √n)
Where tα/2, df is the critical t-value with degrees of freedom df = n - 1. The t-distribution accounts for the additional uncertainty from estimating σ with s. For small samples, the t-distribution has heavier tails than the normal distribution, resulting in wider confidence intervals. As n increases, the t-distribution approaches the normal distribution.
Confidence Interval for a Population Proportion (Wald Method)
For a single proportion p̂ = x / n, the Wald (normal approximation) confidence interval is:
CI = p̂ ± zα/2 × √(p̂(1 - p̂) / n)
This formula works well when n is large and p̂ is not too close to 0 or 1. A common rule of thumb is np̂ ≥ 10 and n(1 - p̂) ≥ 10. However, the Wald interval has known problems with small samples or extreme proportions—it can produce intervals outside [0, 1] or have poor coverage (the actual confidence level is lower than the nominal level).
Wilson Score Interval (Better for Proportions)
The Wilson score interval is a more reliable alternative to the Wald interval, especially for small samples or extreme proportions. It adjusts the center point and width of the interval to account for the discrete binomial distribution, resulting in better coverage properties. The Wilson interval never extends outside [0, 1] and provides more accurate confidence levels, particularly when p̂ is near 0, 0.5, or 1, or when n is small. Many statisticians recommend using Wilson by default for proportion intervals.
Confidence Intervals for Differences
Two-Sample Mean Difference (Pooled t-Interval): When comparing means from two independent samples with equal variances, use the pooled standard deviation and the formula:
CI = (x̄₁ - x̄₂) ± tα/2, df × SEpooled
Where df = n₁ + n₂ - 2 and SEpooled combines the sample variances weighted by sample sizes. The pooled method assumes equal population variances (homoscedasticity), which should be verified with an F-test or Levene's test before use.
Two-Sample Mean Difference (Welch's t-Interval): When the assumption of equal variances is violated or uncertain, use Welch's t-interval, which does not pool variances and uses adjusted degrees of freedom (Welch-Satterthwaite approximation). Welch's method is more robust and is the default in many statistical software packages because it doesn't require the equal variances assumption.
Two-Sample Proportion Difference: For comparing two proportions p̂₁ and p̂₂, the confidence interval for the difference is:
CI = (p̂₁ - p̂₂) ± zα/2 × √(p̂₁(1-p̂₁)/n₁ + p̂₂(1-p̂₂)/n₂)
This uses the Wald approach for differences. More sophisticated methods like the Wilson interval or exact methods (e.g., score interval) can be used for better coverage, especially with small samples or extreme proportions.