Confidence intervals for a proportion

The applet below allows one to visually investigate confidence intervals for a proportion. Specify the sample size n and the true proportion p. When you click the Simulate button, 100 separate samples of size n will be selected from a population with a proportion of successes equal to p. For each of the 100 samples, a 95% confidence interval and a 99% confidence interval are displayed in the plot to the right. Each of these intervals is computed based using the standard normal approximation. If an interval does not contain the true proportion, it is displayed in red. Note that the 99% confidence interval is always wider than the 95% confidence interval. Additional simulations can be carried out by clicking the Simulate button multiple times. The cumulative number of times that each type of interval contains the true proportion is also tabled. Press the Clear button to clear existing results and start a new simulation. Things to try with the applet:

  • Simulate at least 1000 intervals with n = 30 and p = 0.1. What proportion of the 95% confidence intervals contain 0.1? What proportion of the 99% confidence intervals contain 0.1?
  • Simulate at least 1000 intervals with n = 30 and p = 0.5. What proportion of the 95% confidence intervals contain 0.5? What proportion of the 99% confidence intervals contain 0.5?
  • Simulate at least 1000 intervals with n = 100 and p = 0.5. What proportion of the 95% confidence intervals contain 0.5? What proportion of the 99% confidence intervals contain 0.5? How does the typical width of these intervals compare to the n = 30 and p = 0.5 case above?