Confidence Interval Calculator
Free Confidence interval Calculator for biostatistics. Enter variables to compute results with formulas and detailed steps.
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer
Confidence Interval Calculator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: CI = x-bar +/- z * (s / sqrt(n)) | CI(p) = p-hat +/- z * sqrt(p*q/n)
Worked example โ 95% CI: [129.63, 140.37] mmHg. We are 95% confident the population mean BP is between 129.63 and 140.37 mmHg.
Formula
CI = x-bar +/- z * (s / sqrt(n)) | CI(p) = p-hat +/- z * sqrt(p*q/n)
For means: the margin of error is the critical z-value (or t-value for small samples) times the standard error (SD / sqrt of sample size). For proportions: the standard error uses p-hat*(1-p-hat)/n. The Wilson score interval provides improved coverage for proportions.
Worked Examples
Example 1: 95% CI for Mean Blood Pressure
Problem:A sample of 30 patients has a mean systolic BP of 135 mmHg with SD of 15 mmHg. Calculate the 95% confidence interval.
Solution:SE = 15 / sqrt(30) = 2.739 z = 1.960 for 95% CI MOE = 1.960 x 2.739 = 5.369 Lower = 135 - 5.369 = 129.631 Upper = 135 + 5.369 = 140.369
Result:95% CI: [129.63, 140.37] mmHg. We are 95% confident the population mean BP is between 129.63 and 140.37 mmHg.
Example 2: 95% CI for Proportion (Success Rate)
Problem:60 out of 100 patients responded to treatment. Calculate the 95% CI for the response rate.
Solution:p-hat = 60/100 = 0.60 SE = sqrt(0.60 x 0.40 / 100) = 0.04899 Wald MOE = 1.960 x 0.04899 = 0.09602 Wald CI: [0.504, 0.696] Wilson CI: [0.501, 0.693] (more accurate)
Result:Wald 95% CI: [50.4%, 69.6%] | Wilson 95% CI: [50.1%, 69.3%]. Treatment response rate is significantly above 50%.
Frequently Asked Questions
What is a confidence interval and what does it tell us?
A confidence interval (CI) provides a range of plausible values for a population parameter based on sample data. A 95% CI means that if you repeated the sampling process many times and computed a CI each time, approximately 95% of those intervals would contain the true population parameter. It does NOT mean there is a 95% probability the true value lies in any single interval. The CI width reflects precision: narrower intervals indicate more precise estimates. Confidence intervals are more informative than p-values alone because they show both the direction and magnitude of an effect, along with the uncertainty in the estimate.
When should I use a z-interval versus a t-interval?
Use a z-interval when the population standard deviation is known (rare in practice) or when the sample size is large (n >= 30), as the Central Limit Theorem ensures the sampling distribution is approximately normal. Use a t-interval when the population standard deviation is unknown and you must estimate it from the sample, especially with small samples (n < 30). The t-distribution has heavier tails than the normal distribution, producing wider confidence intervals that account for additional uncertainty from estimating the standard deviation. As sample size increases, the t-distribution approaches the normal distribution, and z and t intervals become virtually identical above n = 100.
How does sample size affect the confidence interval width?
The margin of error is inversely proportional to the square root of the sample size: MOE = z * sigma / sqrt(n). This means quadrupling the sample size cuts the margin of error in half. For example, with sigma=10 at 95% confidence: n=25 gives MOE=3.92, n=100 gives MOE=1.96, n=400 gives MOE=0.98. This diminishing-returns relationship means that beyond a certain point, large increases in sample size yield small improvements in precision. Researchers use sample size calculators to find the minimum n needed for a desired margin of error, balancing precision against cost and feasibility.
What is the Wilson score interval for proportions?
The Wilson score interval is an improved method for computing confidence intervals for proportions, developed by Edwin Wilson in 1927. Unlike the standard Wald interval (p-hat +/- z*SE), the Wilson interval performs better when the sample size is small or the proportion is near 0 or 1. The Wald interval can produce impossible values (below 0 or above 1) and has poor coverage probability for extreme proportions. The Wilson interval is centered not at p-hat but at a value pulled slightly toward 0.5, and its width adjusts based on the estimated proportion. It is now recommended as the default method by many statisticians and is used in medical research and survey analysis.
How do I interpret overlapping confidence intervals?
A common misconception is that non-overlapping confidence intervals indicate a statistically significant difference. While non-overlap does imply significance, overlapping CIs do NOT necessarily mean the difference is non-significant. Two 95% CIs can overlap by as much as 25% of their width and still indicate a significant difference at the 0.05 level. This is because the CI for the difference between two means is not simply the overlap of individual CIs. To properly compare two groups, construct a CI for the difference (mean1 - mean2) and check if it contains zero. If zero is not in the interval, the difference is statistically significant at the corresponding alpha level.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer ยท Editorial policy
Related Calculators
๐Confidence Interval Builder
Calculate confidence intervals for means and proportions with visualization
๐งฎAlpaca Gestation Calculator
Calculate alpaca gestation with inputs, formulas, and instant results.
๐งฎCat Pregnancy Calculator โ Due Date & Gestation
Calculate cat pregnancy with inputs, formulas, and instant results.
๐งฎCow Gestation Calculator
Calculate cow gestation with inputs, formulas, and instant results.
๐งฎDog Pregnancy Calculator: Due Date by Breed
Calculate dog pregnancy with inputs, formulas, and instant results.
๐งฎGoat Gestation Calculator
Calculate goat gestation with inputs, formulas, and instant results.
๐งฎGuinea Pig Pregnancy Calculator โ Due Date
Calculate guinea pig pregnancy with inputs, formulas, and instant results.
๐งฎLlama Gestation Calculator
Calculate llama gestation with inputs, formulas, and instant results.