Skip to main content

Confidence interval calculator

Type the sample mean, standard deviation and size (or paste the data) and choose the confidence level. You get the interval, the margin of error and the critical value used.

95% confidence interval: 59.7 < μ < 65.1
Lower limit
59.7
Upper limit
65.1
Margin of error
2.71
t
2.09
Show the working

σ is unknown, so estimate it with sn−1 and use the t-distribution with 19 degrees of freedom: t = 2.09.

Standard error = s ÷ √n = 5.80 ÷ √20 = 1.30

x̄ ± t × standard error = 62.4 ± 2.09 × 1.30 = 62.4 ± 2.71

59.7 < μ < 65.1

Answers are rounded to 3 significant figures, which is what IB papers ask for unless a question says otherwise.

How to do it by hand

  1. Decide which distribution: if the population standard deviation σ is known, use z; if you estimate it from the sample with s (divide by n − 1), use t with n − 1 degrees of freedom.
  2. Find the critical value that leaves (1 − level) ÷ 2 in each tail, for example z = 1.960 for 95%.
  3. The interval is x̄ ± critical value × (standard deviation ÷ √n).

Worked example

A random sample of 16 phone batteries lasts a mean of 12.4 hours, with unbiased standard deviation 1.8 hours. Find a 95% confidence interval for the mean lifetime of all the batteries.

Solution

σ is unknown, so estimate it with sn−1 and use the t-distribution with 15 degrees of freedom: t = 2.13.

Standard error = s ÷ √n = 1.80 ÷ √16 = 0.450

x̄ ± t × standard error = 12.4 ± 2.13 × 0.450 = 12.4 ± 0.959

11.4 < μ < 13.4

Answer: 95% confidence interval: 11.4 < μ < 13.4

Every number in this example is worked out by the same code as the tool above, and the code is tested against independent results from Python's SciPy library.

Where you need it

Where it is used in IB Maths
AA SLNot in the syllabus
AA HLNot in the syllabus
AI SLNot in the syllabus
AI HLConfidence intervals for a population mean (t, or z when σ is known).

On your calculator

In the exam you use your own calculator, so practise it too. Our guides give the exact keystrokes for the Casio fx-CG50, TI-Nspire CX II and TI-84 Plus CE, with a worked example to check against:

Common mistakes

Questions students ask

Why does a 99% interval come out wider than a 95% one?

To be more confident of catching the true mean you need a wider net: the critical value grows from about 1.96 to about 2.58 (for z).

How can I make a confidence interval narrower?

Take a bigger sample. The width shrinks with √n, so four times the sample size halves the width.

What does the confidence level mean?

If you took many samples and made an interval from each, that percentage of the intervals would contain the true mean.

More maths tools