Proportion confidence interval
When using the sample data, we know the proportion sample statistic but we don't know the true value of the population's proportion. Instead, we may treat the population's measures as random variables and calculate the confidence interval.
First, we need to define the confidence level which is the required certainty level that the true value will be in the confidence interval Researchers commonly use a confidence level of 0.95.
The Wilson score interval supports a better result than the normal approximation interval, especially for small samples and for edge proportions near 0 or 1.
The following R code should produce the same results: