Confidence intervals

Top  Previous 

Often we need to estimate the value of some parameter of a population, such as the mean. One useful way to do this is to take a sample and produce an interval which gives a “plausible range of values” for the parameter.

More technically: if we are to take a large number of random samples from the population and from each one calculate a “95% confidence interval” then 95% of these intervals should contain the true value of the parameter which we are estimating. In practice, of course, we only take one sample and calculate the confidence interval from it. The 95% refers to the long-term success rate of our method in producing intervals which contain the true value of the parameter.

 

In the simulation you can simulate both the normal distribution and the binomial distribution to see the size of the confidence intervals. For the normal distribution you can adjust the average and the standard deviation. For the binomial distribution only the probability p can be changed.

The program shows the percentage of intervals which contain the true value of the parameter, and whether this number is more or less in agreement with the expected value.

In the case of estimating the mean of the normal distribution, you will notice that the intervals vary in length. This is because the variance is estimated from the sample, and therefore changes.

In the case of estimating the probability of success in the binomial distribution, you will notice that the sample mean is not always in the center of the confidence interval. This is because the binomial distribution is only symmetric when p=0.5.