Confidence Interval Calculator
Calculate a confidence interval for a mean from data or summary statistics, with t or z, or for a proportion by the Wilson, exact (Clopper-Pearson) and Wald methods.
Formula
- critical value of Student's t with n − 1 degrees of freedom
- the population standard deviation, when known
How it works
A confidence interval shows the range of values of a quantity compatible with the data, at a stated confidence level. For a mean it is the sample mean plus and minus a critical value times the standard error. Because the standard deviation is estimated from the same data, the critical value comes from Student's t distribution, which is wider than the normal for small samples.
For a proportion, the simple normal (Wald) interval performs badly for small samples and for proportions near 0 or 1, and can even fall outside 0 to 100%. The Wilson interval is recommended for general use, and the exact Clopper-Pearson interval is a conservative alternative. All three are shown for comparison.
Worked example
Eight measurements with mean 4.875 and SD 0.748; and 5 successes in 20 trials.
- Mean: t(0.975, 7) = 2.3646, SE = 0.748 / √8 = 0.264, so the 95% CI is 4.875 ± 0.625.
- Proportion 5/20 = 25%: Wilson 11.2% to 46.9%, exact 8.7% to 49.1%, Wald 6.0% to 44.0%.
The mean is 4.875 (95% CI 4.25 to 5.50). The proportion is 25% (Wilson 11.2 to 46.9%).
These are the values the calculator opens with, so you can check its output against this example.
Assumptions
- Independent observations; for the mean, roughly normal data or a large enough sample.
- For a proportion, a fixed number of independent trials with the same probability.
- For the z interval, that the population SD is truly known, which it seldom is.
Common mistakes
- Saying there is a 95% probability that the true value lies in the computed interval. The 95% refers to the procedure.
- Using the Wald interval for small samples or for extreme proportions.
- Using the z interval when the standard deviation was estimated from the data.