# sampling without replacement in an urn with unknown parameters

I have an urn containing $N$ balls, of which $n$ ~ Uniform(1, ..., $N$) are white and the rest black. After sampling $i$ balls without replacement (of which $m$ are white), how can I find the conditional distribution on the colour of the next ball, p($x_{i+1}$ | $m$)?

I've been reading about hypergeometric and beta-binomial distributions but haven't been able to work out an answer. Thanks.

Define the events $A=\{x_{i+1}=\text{white}\}$, $B=\{\text{in$i$firstly sampled balls$m$are white}\}$. By definition of conditional probability, $$p(x_{i+1}\mid m)=\mathbb P(A\mid B) = \frac{\mathbb P(A\cap B)}{\mathbb P(B)}$$ Find numerator and denominator by Law of total probability. $$\mathbb P(B) = \sum_{n=1}^N p(n)\mathbb P(B\mid \text{n white balls in urn})=\sum_{n=m}^N \frac1N \frac{\binom{n}{m}\binom{N-n}{i-m}}{\binom{N}{i}}$$ It is assumed that the binomial coefficients vanish if the subscript exceeds the upper index. So we can rewrite this sum in more convinient form $$\mathbb P(B) =\frac1N \frac{1}{{\binom{N}{i}}} \sum_{n=0}^N \binom{n}{m}\binom{N-n}{i-m} = \frac1N \frac{\binom{N+1}{i+1}}{{\binom{N}{i}}}. \tag{1}\label{1}$$ In last equality we applied the equation (8) from this wiki page.

Similar way, $$\mathbb P(A\cap B) = \sum_{n=1}^N p(n)\,\mathbb P(B\mid n)\,\mathbb P(A\mid B \cap \{n \text{ white balls\}})$$ $$=\sum_{n=m+1}^N \frac1N \frac{\binom{n}{m}\binom{N-n}{i-m}}{\binom{N}{i}}\,\frac{n-m}{N-i}.$$ Rewrite $$\binom{n}{m}\frac{n-m}{N-i} = \frac{m+1}{N-i} \binom{n}{m+1}$$ (simply check the identity!). Then
$$\mathbb P(A\cap B) = \frac1N \frac{m+1}{N-i} \frac{1}{\binom{N}{i}} \sum_{n=m+1}^N {\binom{n}{m+1}\binom{N-n}{i-m}}$$ $$=\frac1N \frac{m+1}{N-i} \frac{1}{\binom{N}{i}} \sum_{n=0}^N {\binom{n}{m+1}\binom{N-n}{(i+1)-(m+1)}} = \frac1N \frac{m+1}{N-i} \frac{\binom{N+1}{i+2}}{\binom{N}{i}} \tag{2}\label{2}.$$ In last equality we used equation (8) from wiki again.

Finally, put (\ref{1}) and (\ref{2}) into the conditional probability: $$p(x_{i+1}\mid m)=\frac{ \frac1N \frac{m+1}{N-i} \frac{\binom{N+1}{i+2}}{\binom{N}{i}}}{ \frac1N \frac{\binom{N+1}{i+1}}{\binom{N}{i}}} = \frac{m+1}{i+2}.$$

Edit: As rightly noted by Luke Hewitt, this solution implicitly assumes that $m> 0$. For this case only the equality (\ref{1}) is valid. For $m=0$,

$$\mathbb P(B) =\frac{\sum_{n=1}^N \binom{n}{m}\binom{N-n}{i-m}}{N{\binom{N}{i}}} =\frac{1}{N{\binom{N}{i}}} \sum_{n=0}^N \binom{n}{m}\binom{N-n}{i-m}-\frac1N = \frac1N \frac{\binom{N+1}{i+1}}{{\binom{N}{i}}}-\frac1N. \tag{3}\label{3}$$ Divide (\ref{2}) to (\ref{3}) and obtain the conditional probability $p(x_{i+1}\mid m)$ for $m=0$: $$p(x_{i+1}\mid m) =\frac{m+1}{i+2}\cdot\frac{N+1}{N-i}.$$

So, the final answer looks as: $$p(x_{i+1}\mid m) =\begin{cases}\frac{m+1}{i+2}\cdot\frac{N+1}{N-i}, & m=0 \cr \frac{m+1}{i+2} & m>0 \end{cases}$$

• Hi, thanks so much for your help! :) This answer is almost entirely correct, but solves the problem for n ~ Uniform(0, ..., N) whereas I want n ~ Uniform(1, ..., N). To get n ~ Uniform(1, ..., N), I think we need to subtract 1/N from equation (1) when m = 0 (in order to correct for the index starting at 0). That gives p(x_{i+1} | m) = ( (m+1)*(N+1))/((i+2)*(i+1) ) / ( (N+1)/(i+1) - 1 ) for m = 0 and the current answer, (m+1)/(i+2) when m > 0. – Luke Hewitt Jun 5 '17 at 18:19
• No, this answer solves the problem for $n\sim \text{Uniform}(1,\ldots, N)$! – NCh Jun 5 '17 at 18:28
• Consider N = 1. In your solution, p(x_1 | m = 0) = 1/2. Therefore, n ~ Uniform({0,1}). Is there something I'm missing? – Luke Hewitt Jun 5 '17 at 21:51
• I'm sorry, the first time I read your reply inattentively. Thank you for your perseverance. Indeed, the case $m=0$ crushes equality (1). Or, you are right again, this answer without corrections is valid for $U(0,1\ldots,N)$. I'll make corrections in few mnutes. – NCh Jun 6 '17 at 10:44