Confidence Interval
calculator.
Put a range around a sample mean or proportion, with its margin of error and method.
- Margin of error
- 3.4104
- Standard error
- 1.6971
- Critical t
- 2.0096
If you took many samples and built a 95% interval from each, about 95% of those intervals would contain the true mean. This one says the mean is plausibly between 70.5896 and 77.4104. It covers sampling error only, not bias in how the data were collected.
The interval on the sampling curve
Drag the point to change the levelA t curve with 49 degrees of freedom around the estimate 74, with a standard error of 1.6971. The shaded band from 70.5896 to 77.4104 is the 95% interval.
Working
- 1Standard error: the SD over the root of n12√50= 1.6971
- 2Critical t for 95% confidence, 49 degrees of freedomt = 2.0096
- 3Margin of error: critical value times standard error2.0096 × 1.6971 = 3.4104
- 4Go that far either side of the mean74 − 3.4104 = 70.589674 + 3.4104 = 77.4104
- 5Check: undo it, and the critical value comes back77.4104 − 741.6971= 2.0096
With a different sample or level
| If you had | Sample | Interval | Margin |
|---|---|---|---|
| Half the samplen = 2569.0466 to 78.9534 | 25 | 69.0466 to 78.9534 | 4.9534 |
| Twice the samplen = 10071.6189 to 76.3811 | 100 | 71.6189 to 76.3811 | 2.3811 |
| Four times the samplen = 20072.3267 to 75.6733 | 200 | 72.3267 to 75.6733 | 1.6733 |
| 90% confidencen = 5071.1548 to 76.8452 | 50 | 71.1548 to 76.8452 | 2.8452 |
| 99% confidencen = 5069.452 to 78.548 | 50 | 69.452 to 78.548 | 4.548 |
The margin shrinks with the square root of the sample, so halving it takes about four times as many.
Sample for the margin you want
- Sample needed at 95%
- 141
How it's worked out
A sample mean is a single best guess at the true mean. An interval adds a range that reflects how much samples vary. The confidence level describes the method: in the long run, about 95% of intervals built this way contain the true mean.
When the SD comes from your sample, use the t distribution with n − 1 degrees of freedom. If the population SD is truly known, use z instead.
Here is the sample mean, s is the sample SD and n is the sample size. The critical value t or z leaves half of what is left over in each tail. The part after the plus or minus sign is the margin of error.
For a proportion, x successes out of n give an estimate of . The tool defaults to the Wilson method, and it has two parts.
It also gives three others. Wald is the plain normal formula. Agresti-Coull adds successes and as many failures, then applies Wald. Clopper-Pearson works from the binomial distribution itself, with no normal curve.
| Level | z | t, df 5 | t, df 10 |
|---|---|---|---|
| 80% | 1.282 | 1.476 | 1.372 |
| 90% | 1.645 | 2.015 | 1.812 |
| 95% | 1.96 | 2.571 | 2.228 |
| 98% | 2.326 | 3.365 | 2.764 |
| 99% | 2.576 | 4.032 | 3.169 |
| 99.9% | 3.291 | 6.869 | 4.587 |
| Level | t, df 20 | t, df 30 | t, df 60 |
|---|---|---|---|
| 80% | 1.325 | 1.31 | 1.296 |
| 90% | 1.725 | 1.697 | 1.671 |
| 95% | 2.086 | 2.042 | 2 |
| 98% | 2.528 | 2.457 | 2.39 |
| 99% | 2.845 | 2.75 | 2.66 |
| 99.9% | 3.85 | 3.646 | 3.46 |
Worked examples
Ms. Reyes reports a mean test score
Ms. Reyes samples 50 tests, with a mean of 74 and an SD of 12. The standard error is 1.697, and t with 49 degrees of freedom is 2.01.
Her 95% interval runs from 70.59 to 77.41. To bring the margin of error down to 2 points, she needs 141 tests. Four times her sample, 200 tests, brings it to 1.67, a little under half of the current 3.41.
Jo measures ten bolts
Jo measures ten bolts: 12.1, 11.8, 12.4, 12, 11.6, 12.3, 12.2, 11.9, 12.5, 12 mm. They have a mean of 12.08 mm and a sample SD of 0.278 mm. Her 95% interval runs from 11.88 to 12.28 mm.
With so few values, the t interval leans on the lengths being roughly normal. A plot of the values is worth a look before she reports this, because one wild bolt would change both the mean and the SD.
A plant counts 1 fault in 29 units
A quality team finds 1 faulty unit in 29. The Wald formula gives −0.0319 to 0.1009, and a negative share of faults is impossible.
The Wilson interval gives 0.0061 to 0.1718, and Clopper-Pearson gives 0.0009 to 0.1776. Neither is symmetric around the estimate, since little room is left below it.
With 81 of 263, the methods nearly agree: Wilson gives 0.2553 to 0.3662, and Wald gives 0.2522 to 0.3638. Trouble only starts when the counts get small.
Reading your result
Read the width as precision. A narrow interval means the estimate is pinned down well. A wide one says you need more data before you lean on the figure.
Know what moves it. The margin shrinks with the root of the sample, so halving it takes about four times as many. A higher level widens it: for a large sample, 99% is about 31% wider than 95%, the ratio of 2.576 to 1.96.
Use it as a test. A hypothesized value inside the interval cannot be rejected at the matching level. A value outside it can be. That gives you more than a yes or no, as it shows every value still in play.
Need one side only? Swap the critical value so all of what is left over sits in one tail. In practice, the upper limit of a two-sided 90% interval is a one-sided 95% upper bound. For the test scores, that is 76.85.
Check it against a published example. NIST's measurement data has 195 values with a mean of 9.26146 and an SD of 0.022789. The calculation gives 9.258241 to 9.264679, within one step in the last place of the handbook's 9.258242 and 9.264679.
Common mistakes
- Saying "95% chance the mean is in this interval". The true mean is fixed, and this interval either holds it or does not. The 95% describes how often the method works over many samples.
- Using z because n is over 30. With an SD from your sample, t is correct at any size. At 36 people, z gives 70.08 to 77.92, and t gives a slightly wider 69.94 to 78.06.
- Using Wald for small counts. NIST warns that it can give a lower limit below zero. Use Wilson, or the exact method when the sample or the count is very small.
- Thinking it covers everything that can go wrong. An interval reflects sampling error only. It says nothing about a biased sample or a badly calibrated instrument.
- Treating overlap as a test. Two intervals can overlap while their difference is still significant. Compare groups with a test built for that.
Questions people ask
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods, section 1.3.5.2, Confidence Limits for the Mean
- NIST/SEMATECH e-Handbook of Statistical Methods, section 7.2.2.1, Confidence Limits for the Mean
- NIST/SEMATECH e-Handbook of Statistical Methods, section 7.2.2.2, Sample Sizes Required
- NIST/SEMATECH e-Handbook of Statistical Methods, section 7.2.4.1, Confidence Intervals for a Proportion