I have 1100 objects to inspect whether they meet the standard or not (yes or no question), of which 100 have been inspected already and 99% of them passed the test.

Due to resource constraints, we can't inspect all the remaining 1000 objects and hence need to take a random sample of them. How can I calculate the minimum sample size required to test the hypothesis that at least 98% of them will pass the test.

Note: 95% Significance Level & 99% Confidence Level


1 Answer 1


The minimum number of additional samples you need to test is $135$.

In your problem you have a Bernoulli random variable $X$ with an unknown parameter $p$. Your current estimate for $p$ is that it is $.99$, of course, because of uncertainty we are not $95\%$ sure that this estimate is correct.

If we assume a uniform proir on $p$, then the posterior distribution for $p$, after gathering data of $99$ successes and $1$ failure is given by the function, $$ f(p) = \frac{101!}{(99!\times 1!)}p^{99}(1-p)^1 $$

The minimum number of additional samples $n$ will occur when they are all successes (otherwise you will need to keep on gathering more data). If we gather $n$ more samples, and if they are all successes, then the posterior distribution changes to, $$ f(p) = \frac{(101+n)!}{(99+n)!\times 1!}p^{99+n}(1-p)^1 = (101+n)(100+n)p^{99+n}(1-p) $$

You want to be $95\%$ sure that the true value of $p$ is at least $.98$.

Therefore, you need to find the minimum $n$ such that, $$ \int_{.98}^1 (101+n)(100+n)p^{99+n}(1-p) ~ dp \geq .95 $$

Using WolframAlpha,

integrate (101+n)(100+n) x^(99+n) (1-x) dx from .98 to 1 where n = 134

We find this integral computes to $.949$, however at $n=135$ it will exceed $.95$.

  • $\begingroup$ Note the Bernoulli variables are not independent though - you in fact have a hypergeometric rather than a binomial sampling scheme. $\endgroup$ Commented Mar 13, 2023 at 17:16
  • $\begingroup$ @Scortchi-ReinstateMonica You are correct. My answer is wrong, however, I still think it is helpful to keep it posted since it does answer what happens when the samples are chosen with replacement. $\endgroup$ Commented Mar 14, 2023 at 1:49
  • $\begingroup$ Not precisely, as $p$ can only take values in $0, \frac{1}{1100}, \ldots, \frac{1099}{1100}, 1$. Your method might be best billed as an approximation for when the sample is a small fraction of a large population. $\endgroup$ Commented Mar 14, 2023 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.