# beta-binomial as conjugate to hypergeometric

According to the table of conjugate distributions on Wikipedia, the hypergeometric distribution has as conjugate prior a beta-binomial distribution, where the parameter of interest is "$M$, the number of target members." I interpret "target members" to mean, I am modeling as hypergeometric the number of blue balls in a sample from an urn containing $N$ total balls of which $M$ are blue, $N-M$ non-blue.

But then I cannot make sense of the claim of conjugacy. After the data is observed, say $b$ blue balls in the sample, then it is known that $M>b$. But a beta-binomial distribution is supported on $0,...,F$ (for some parameter $F$). So how can the posterior for $M$ also be beta-binomial?

• I may be wrong but it looks to me like that there is a slight misunderstanding. Hypergeometric distribution describes the probability of drawing $k$ blue balls out of $n$ draws (without replacement) from an urn containing $N$ balls out of which $M$ are blue. It is not the probability distribution over $M$, the number of blue balls in the urn. – Moss Murderer Oct 31 '17 at 23:04
• @MossMurderer No, this is a bayesian setup. – Hasse1987 Nov 1 '17 at 18:59

Hypergeometric distribution describes sampling without replacement from the urn containing $N$ balls, out of which $M \le N$ are target balls, let's say blue. The conjugate beta-binomial prior distribution leads to posterior distribution for unknown $M \in \{x,x+1,\dots,N-n+x\}$ in form

$$f(M\mid x,N,\alpha,\beta) = {N-n \choose M-x} \frac{\Gamma(\alpha+M)\,\Gamma(\beta+N-x)\,\Gamma(\alpha+\beta+n)}{\Gamma(\alpha+x)\,\Gamma(\beta+n-x)\,\Gamma(\alpha+\beta+N)}$$

as described in

Dyer, D. and Pierce, R.L. (1993). On the Choice of the Prior Distribution in Hypergeometric Sampling. Communications in Statistics - Theory and Methods, 22(8), 2125-2146.

• I agree it makes sense to have the prior distribution on $M$ be beta-binomial. What doesn't make sense to me is that the posterior is also beta-binomial (because of the different supports issue mentioned in the question). – Hasse1987 Oct 31 '17 at 22:50
• @Hasse1987 I don't understand what do you mean, the support is $0,1,\dots,N$, where BB distribution is parametrized by $\alpha,\beta,N$, where $N$ is known population size. – Tim Oct 31 '17 at 23:22
• But the posterior distribution of $M$ cannot have that support. After the data is observed you know there are at least $b$ target members. So the support of the posterior is contained on $b,\ldots,N,$ right? – Hasse1987 Oct 31 '17 at 23:27
• @Hasse1987 a priori it has $0,\dots,N$ support, after you observe some data it gets centered on more realistic values. – Tim Nov 1 '17 at 11:46
• Of course. The point is that those "more realistic values" preclude a beta-binomial distribution. – Hasse1987 Nov 1 '17 at 18:59

The problem with the Wikipedia article and the reference therein (Fink D., 1997) is that there is some key information missing.

Specifically, the given posterior is for $$M-x$$ (i.e. the number of target individuals in the population shifted by the number observed in the sample), not for $$M$$. Furthermore, the posterior parameter corresponding to the number of observations is missing and should be $$N-n$$ (i.e. the population size minus the sample size). These two corrections fixes the support problem that you correctly noticed, as shown below.

Suppose that $$0 \leq X \leq n$$ is the number of target individuals in a sample of size $$n$$ from a population of size $$N$$ with $$0 \leq M \leq N$$ total target individuals.

Then, $$X \sim \text{HG}(n, M, N)$$ with support in $$[\max(0, n-N+M), \min(n, M)]$$.

If $$M \sim \text{BB}(N, \alpha, \beta)$$ is the prior distribution of $$M$$, the posterior distribution for $$M - x$$ is also Beta-Binomial-distributed: $$M - x\,|\,x,\alpha,\beta \sim \text{BB}(N-n, \alpha + x, \beta + n - x)$$

If you write the probability mass function for $$M$$ you will find @Tim's answer above.

As an illustration, for $$N = 20$$ and $$n = 10$$, let's assume a non-informative prior distribution for $$M$$ with $$M \sim \text{BB}(N, .5, .5)$$. Suppose that we observe $$x = 9$$.

library(extraDistr)
library(tidyverse)
N = 20
n = 10
a0 <- b0 <- .5
x <- 9
data.frame(
m = 0:N
) %>%
mutate(
prior = dbbinom(m, size = N, alpha = a0, beta = b0),
post = dbbinom(m-x, size = N-n, a0+x, b0+n-x)
) %>%
gather(key, dens, -m) %>%
ggplot(aes(m, dens, col = key)) +
geom_line() +
geom_point()


Created on 2018-10-10 by the reprex package (v0.2.1)

Note that the posterior support is correctly [x, N − n + x].

Dyer, D. and Pierce, R.L. (1993). On the Choice of the Prior Distribution in Hypergeometric Sampling. Communications in Statistics - Theory and Methods, 22(8), 2125-2146.