
The confidence interval gives an estimated range of values which is likely to include an unknown population parameter. The estimated range is calculated from a given set of observations.
At the α level of significance a two sided confidence interval for the true mean μ for normally distributed data with mean mean and known standard deviation σ can be constructed as:
mean  z_{α/2} σ / √N ≤ μ ≤ mean + z_{α/2} σ / √N, 
where z_{α/2} = invGaussQ (α/2) and N is the number of observations.
If the standard deviation is not known, we have to estimate its value (s) from the data and the formula above becomes:
mean  t_{α/2;N} s / √N ≤ μ ≤ mean + t_{α/2;N} s / √N, 
where t_{α/2;N} = invStudentQ (α/2, N1).
For α=0.05 and N=20 we get z_{0.025}=1.96 and t_{0.025;20}=2.093. This shows that for a fixed value of the standard deviation the confidence interval will always be wider if we had to estimate the standard deviation's value from the data instead of its value being known beforehand.
© djmw, November 9, 2015