Statistics and research
Confidence interval calculator
Confidence intervals for a mean (t interval, from data or summary statistics) or a proportion (Wilson, Clopper–Pearson, Jeffreys, Agresti–Coull and Wald).
Runs in your browser. What you enter stays on this page and is not uploaded.
Results
- Sample size n
- 10
- Mean
- 0.75
- Standard deviation
- 1.78901
- Standard error s / √n
- 0.56573464
- Critical t (9 df)
- 2.2621572
- Margin of error t · SE
- 1.2797807
- 95% confidence interval (t)
- -0.52978066 to 2.0297807
- Interval if σ were known (z)
- -0.35881951 to 1.8588195
The t interval assumes independent observations from a roughly normal population; for n of about 30 or more it is robust to moderate skew.
Method and limits
How to use it
For a mean, enter n, the mean and the standard deviation, or paste the raw data. For a proportion, enter the number of successes and the number of trials. Set the confidence level (95% is usual).
Formulas
- Mean (t interval): x̄ ± tα/2, n−1 · s / √n.
- Wilson score: (p̂ + z²/2n ± z √(p̂(1 − p̂)/n + z²/4n²)) / (1 + z²/n); with continuity correction as Newcombe’s method 4.
- Clopper–Pearson exact: the α/2 and 1 − α/2 quantiles of Beta(x, n − x + 1) and Beta(x + 1, n − x).
- Jeffreys: quantiles of Beta(x + ½, n − x + ½). Agresti–Coull: Wald interval around (x + z²/2)/(n + z²). Wald: p̂ ± z √(p̂(1 − p̂)/n).
Which proportion interval?
Wilson is a good default: its coverage stays close to the nominal level for small samples and for proportions near 0 or 1 (Brown, Cai and DasGupta 2001). Clopper–Pearson never under-covers but is wide. Avoid Wald when n is small or p̂ is near 0 or 1 — it can even give limits of exactly 0.
Assumptions and limits
- Independent observations, and a random or representative sample.
- The t interval assumes a roughly normal population; with 30 or more observations it is robust to moderate skew, but not to strong outliers.
- A 95% interval means that the procedure captures the true value in 95% of repeated samples — not that this interval has a 95% chance of containing it.
Worked example
Sleep data (R’s sleep dataset, group 1): n = 10, mean 0.75, SD 1.789. SE = 0.5657, t0.025, 9 = 2.2622, so the 95% interval is −0.530 to 2.030 — the same as R’s t.test. For 81 successes in 263 trials, p̂ = 0.308; Wilson gives 0.2553 to 0.3662 and Clopper–Pearson 0.2527 to 0.3676, matching Newcombe (1998), Table I.
References
- NIST/SEMATECH e-Handbook of Statistical Methods: confidence limits for the mean
- Newcombe (1998), Two-sided confidence intervals for the single proportion, Statistics in Medicine 17
- Brown, Cai and DasGupta (2001), Interval estimation for a binomial proportion, Statistical Science 16(2)
- Clopper and Pearson (1934), Biometrika 26(4)
- Wilson (1927), Journal of the American Statistical Association 22
- R documentation: t.test
Related tools
- Standard deviation calculatorPaste data to get the standard deviation (sample and population), variance, mean, median, mode, quartiles with the method stated, IQR, outliers, skewness and kurtosis.
- Z-score and normal distribution calculatorConvert a value to a z-score and find normal probabilities to the left, right, between two values or in both tails, or find the value for a percentile.
- Margin of error calculatorMargin of error for a survey proportion or a mean at any confidence level, with the finite population correction.
- Sample size calculatorSample size to estimate a proportion or a mean within a chosen margin of error, with the finite population correction for small populations.
- T-test calculatorOne-sample, independent two-sample (Welch and pooled) and paired t-tests from raw data or summary statistics, with confidence intervals and Cohen’s d.
- P-value calculatorFind the p-value and critical values for a z, t, chi-square or F test statistic, one- or two-tailed, accurate far into the tails.