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

This is a very good approximate approach.  For exact inference you can reference the CDF of a binomial distribution with $p=0.005$ and identify the $n$ such that the probability of observing $1$ or fewer events is $2.5\%$.  This approach yields an $n$ of 1,113.  The resulting two-sided equal-tailed $95\%$ confidence interval from inverting the binomial CDF would be would be $(0.00002275, 0.00499)$.
