The confidence interval

The confidence interval is a basic concept that sets the foundation for statistical tests. With this tool in your hands, you can compare the means of two samples.

The true value of a parameter such as the mean is found within the confidence interval with a probability chosen by you. The higher probability that the true parameter value is within the interval, the larger the interval needs to be. The width of the confidence interval is determined by the standard error (which gives you the precision of your estimate) and z:

Confidence interval

where CI is the confidence interval, \overline{x} is the estimated mean, z is the number of standard errors (SE) from the mean that the limit of the confidence interval reaches.

The probability that the true mean is found within this interval is determined by the value of z. To be certain that the true mean is found within the interval with a probability of 0.95 and 0.99, the z – value is set to 1.96 and 2.58, respectively. Refer to the section about the normal distribution. You call these intervals for the 95 and 99 % confidence intervals. The 95 % interval is most commonly used.


Calculate the 95 and 99 % confidence interval where the mean is 50 mm and the standard error is 0.02 mm.

Use the equation for the confidence interval:

CI95 %= 50 ±1.96×0.02=50 ±0.039

CI99 %= 50 ±2.58×0.02=50 ±0.052

More in depth

Recall the Central Limit Theorem. This concept says that all possible means that you can estimate from a population taking endless number of samples conforms to a normal distribution. The standard deviation of this population is the standard error.

Remember that 95 and 99 % of the units within a normally distributed population is found at 1.96 and 2.58 standard deviations from the mean, respectively. So, 95 % of all possible means that can be estimated from a particular population are found 1.96 standard errors from the true mean of the population. Similarly, there is a 95 % chance that the true mean of the population is found 1.96 standard errors from a mean that is estimated from a sample.

It can be illustrated by bringing up the population of all possible means that can be estimated based on samples from the standard error section:

confidence interval graph

In this figure, the estimated mean from a sample (black dot on the x-axis) is found within the region (closer than 1.96 SE from the true mean) of the most likely means that can be estimated from this population. Therefore, the true mean is found within the confidence interval.

confidence interval graph2

In the next figure, however, the estimated mean from the sample is found outside the region (1.96 SE from the true mean). In this case, the true mean is not found within the confidence interval. The probability of this is 0.05 or 5 %, since the filled areas in total constitutes 5 % of all possible means that can be estimated based on samples from the population in question.

How to produce the graphs in this article in R

mnorm_plot<-function(my,sigma,EM){    #my = True mean, sigma = standard deviation and EM = Estimated mean
	mnorm<-function(my, sigma,x){


	for(i in 1:length(x)) {

	plot(x,p,ylab="",xlab="Estimated Means",type="n",las=1,bty="l",pch=19,yaxt="n")