Smallest sample size for true proportion estimation (Binomial distribution with 1 found defective unit) Suppose that we allow only 1 defective unit in the control sample. What is the smallest sample it should be in order to conclude that my true defective proportion of the population is smaller than 0.5% (with 95% confidence level).
I have tried to solve this problem using the binom.confint function in R. Since my defective rate is too small (near 0), I have calculate the confidence interval of the true proportion with the Wilson interval. Then I look for the sample size who gives the nearest upper limit from the 0.5% value. The sample size that I found is 1130 since the upper limit of the IC is 0.4999%. So I can conclude that if I found 1 defective unit in a sample of 1130 units, my true defective proportion should be lower than 0.5% (with 5% error)
binom.confint(x = 1, n = 1130)

Is this a good approach? Do you have other suggestion?
Thank you

It sounds like you will want a one-sided confidence interval since you are interested in testing whether the proportion is less than 0.5%. The binom.confint function uses a two-sided interval.
The upper limit for an exact one-sided 95% interval is equal to the 95% quantile of a $\text{Beta}(x + 1, n - x)$ random variable, so you need to find $n$ such that qbeta(0.95, 2, n-1) $\leq 0.005$. This is the case when $n \geq  947$.
