This is a simulation of finding a confidence interval for a proportion where the user can select the population proportion, the confidence level, sample size, and whether to simulate one or 25 confidence intervals.
It simulates the process of taking an election poll involving two candidates. Some proportion p of the population plans to vote for candidate A. If we sample n people from the population, the proportion of people in the sample who say they plan to vote for candidate A is our best estimate of the population proportion. We can then construct a level C confidence interval, where C is the probability that the interval actually includes the true value of p. More specifically, the confidence interval is calculated as the sample proportion ± z* times the standard deviation of the sample proportion, where z* is the critical value of z that has (1-C)/2 of the normal distribution to the right of the value, and the standard deviation is.