Suppose you have an urn with "N" marbles. All marbles are either black or white. You take a sample of size "n" without replacing them to the urn.

With this one sample you would like to be able to make one of the following two statements:

  1. Y% or greater of the marbles are white.
  2. Less than Y% of the marbles are white.


  • This approach uses the hypergeometric distribution.
  • In practice, my "N" will be large (1*10E5 to 1*10E6).


  1. What is the size of "n"?
  2. What is the formula for calculating the required sample size "n"?
  3. How to estimate the confidence interval for Y?

Thanks in advance.

  • $\begingroup$ Do you have a rough idea of the size of the proportion $Y$? $\endgroup$ – Glen_b Aug 28 '14 at 0:34
  • $\begingroup$ Roughly 1 in 1000 marbles is black. $\endgroup$ – Stan Aug 28 '14 at 12:58

First of all for background:

β€œThe hypergeometric distribution applies to sampling without replacement from a finite population whose elements can be classified into two mutually exclusive categories like Pass/Fail” (Wikipedia)

That being said, if your sample size is extremely large it is possible that even without replacement your results may approximate the binomial distribution.

Equation for sample size calculation for small populations:

Hypergeometric distribution

𝑛 = (𝑁𝑧^2 π‘π‘ž) / ((𝐸^2 (π‘βˆ’1)+𝑧^2 π‘π‘ž))


  • n = Minimum sample size
  • N = Population size
  • z = Confidence level (zΞ±/2)
  • p = Proportion of events in population
  • q = Proportion of non-events in population
  • E = Accuracy of sample proportions

Simple binomial distribution (included for comparison)

𝑛=(𝑍^2 π‘π‘ž)/𝐸^2

Useful links and resources:

My current reputation prevents me from posting more than 2 links so please vote this answer up if it is helpful to you:
Formula and examples: University of Regina
Online calculator
Google has the book: "Six sigma and beyond"
Useful examples on "stattrek.com"
Wolfram Alpha

| cite | improve this answer | |
  • $\begingroup$ First link ends up with "Forbidden", the second one does not open. $\endgroup$ – Vladislavs Dovgalecs Jan 8 '18 at 19:37
  • 1
    $\begingroup$ The first link is indeed no longer valid. I am leaving it in case someone wants to use it to track down another source. The online calculator link still works for me (albeit slow). $\endgroup$ – Stan Jan 9 '18 at 16:57

Using the formula provided by Stan in his answer to his own question and plugging in the values for $N$, $p$ and $q$ in the question, i.e.

Population: $N = 1,000,000$

proportion of white marbles: $p = 0.001$

proportion of black marbles: $q = 1 - p$

and assuming a precision

$E = 0.05$

we end up with

$$ n = \frac{1,000,000 \cdot z_{1-\alpha / 2}^2 \cdot 0.000999}{2499.998 + z_{1-\alpha / 2}^2 \cdot 0.000999} $$

Here we need a clarification:

$z$ is not the confidence level but usually interpreted as the $(1-\alpha/2)$ quantile of the standard normal Distribution.

The confidence level is $1-\alpha$.

Typical values of $\alpha$ are 0.01, 0.05 and 0.1 and are set to control the probability of error type 1 in hypothesis testing. Wikipedia

Using the $(1-\alpha/2)$ quantile implies we want to conduct a two sided hypothesis test (otherwise we would have to use the $(1-\alpha)$ quantile).

Back to the example:

Let's use $\alpha = 0.01$, i.e. an 99% confidence level. Now we get a result for sample size $n$:

$$ \begin{align} n &= \frac{1,000,000 \cdot 2.58^2 \cdot 0.000999}{2499.998 + 2.58^2 \cdot 0.000999}\\ &= 2.6513 \end{align} $$

Discussion of result:

Clearly it is impractical to draw 2.6513 marbles from the urn. Thus drawing 2 or 3 marbles are the options to choose from.

Neither would be very satisfying...

Imagine we opt for drawing 3 marbles. What are the probabilities of drawing 0, 1, 2 or even 3 white marbles?

$P(0) = 0.997003$

$P(1) = 0.002994009$

$P(2) \approx 0$

$P(3) \approx 0$

Regarding a hypothesis test $H_0: p_0 = 0.001$ we are fine because the chances of rejecting the true hypothesis are at most 1% (as required by setting $\alpha = 0.01$).


If it is not just about hypothesis testing but also about estimating the proportion of white marbles in the population you would not want to do this based on a sample size of just 3, because your estimate would be limited by design to the values 0%, 33.3%, 66.% or 100%. Not quite what you had in mind when specifying a precision of 0.05 (i.e. 5 percentage points).

| cite | improve this answer | |

Your Answer

By clicking β€œPost Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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