# Hypergeometric distribution with a priori probabilities of the balls

If we have a urn with $N$ balls of two colours ($D$ red and $N-D$ black balls respectively), then probability of having $k$ red out of $n$ balls drawn at once without replacement follows the Hypergeometric distribution:

$Pr(X = k) = \dfrac{\binom{D}{k} \binom{N - D}{n-k}}{\binom{N}{n}}$

Now assume we have some a priori distribution of the balls: $p_i$ – probability of drawing ball $i$, $i \in \{1, \ldots, N \}$. (Note that it's unrelated to colours.)

Let's make an experiment with drawing balls again. As a result of the experiment we have the following:

$P_n = \{p_{i_1}, \ldots, p_{i_n}\}$ – probabilities of $n$ drawn balls

$P_k = \{p_{j_1}, \ldots, p_{j_k}\}$ – probabilities of $k$ red drawn balls, $P_k \subset P_n$

What the probability of having this result, i.e. having $k$ balls out of $n$ drawn balls which probabilities turned out to be exactly $P_k$ and $P_n$ respectively?

Example.

Say we have a urn with $N = 6$ balls ($D = 3$ are red) with probabilities as follows:

$$\underbrace{\stackrel{\frac{1}{21}}{A} \quad \stackrel{\frac{2}{21}}{B} \quad \stackrel{\frac{3}{21}}{C}}_\text{red} \quad \underbrace{\stackrel{\frac{4}{21}}{D} \quad \stackrel{\frac{5}{21}}{E} \quad \stackrel{\frac{6}{21}}{F}}_\text{black}$$

Let $n = 3, k = 2$. Let's consider two cases.

1. $P_k = \{\frac{1}{21}, \frac{2}{21}\}, P_n = \{\frac{4}{21}\}$
2. $P_k = \{\frac{2}{21}, \frac{3}{21}\}, P_n = \{\frac{4}{21}\}$

In both cases we have the same number of drawn balls and the same number of red balls out of them. Moreover, we have the same probability of the black drawn set of balls. But intuitively it's clear that the probability of having first case as a result is less probable (or more significant in terms of statistical hypothesis testing).

Hypergeometric distribution as it is can't distinguish these two cases, since it assumes equal probability of each ball ($\frac{1}{N}$).

Do you have any idea of how to take the probability into account in hypergeometric distribution? Or maybe you know the name of distribution that fits the problem?

Appreciate any thoughts about the solution.

UPD

It's may be enough just to estimate the probability. This admission stems from the purpose of this research – ranking experiment results by statistical significance.

• Forget the hypergeometric distribution. Your example is actually $2^6=64$ elementary outcomes (each ball either gets drawn or not); you may easily count them all. If we put it this way: $$\underbrace{\stackrel{0.05}A\quad\stackrel{0.05}B\quad\stackrel{0.4}C}_{red} \quad \underbrace{\stackrel{0.05}D\quad\stackrel{0.05}E\quad\stackrel{0.4}F}_\text{blue or whatever}$$ then what are the outcomes leading to case 1? and what about case 2? – Ivan Neretin Feb 4 '16 at 21:01
• I ain't sure I've gotten your question. As I understood so far, you just fix two experiments where number of drawn balls ($n$) and drawn red balls ($k$) are equal, except for probabilities of the red drawn balls. Then you relate to the first case less probable (more significant) result (in terms of red drawn balls) and to second – more probable. Please correct me if I got you wrong. – Ivan Arbuzov Feb 5 '16 at 18:16
• I don't quite get you either, so we are even. Well, here is your urn with 6 balls, 3 of them red, each ball with its certain predefined probability (is that right?) of getting drawn. I just signed the balls with letters A, B, C, D, E, F, so that we could tell one from the other. Now what exactly is the case 1 you were talking about? – Ivan Neretin Feb 5 '16 at 18:40
• Thanks for the clarification. We can put them as follows. Case 1: {A, B} – red, {F} – black. Case 2: {A, C} – red, {D} – black. – Ivan Arbuzov Feb 5 '16 at 19:02
• Fine. I don't see any sense in listing them separately, since we know anyway which is red and which is not. So the elementary outcome {A,B,F} belongs to case 1. Likewise, {A,C,D} belongs to case 2; but is it alone in this respect? What about {A,C,E}? – Ivan Neretin Feb 5 '16 at 19:12