3
$\begingroup$

My student made the interesting problem and asked me how to solve it. I believe the Bayesian approach is promising, and got a kind of solution. But, I'm not confident of my solution because it's too complicated considering the simpleness of the problem.

There are two questions:

  • Is this problem equivalent some famous one?
  • Could you please suggest how to solve it?

The problem my student made

Setting

There are two boxes. Each box contains $N^{c}$ coins. The coins are labeled with numbers $1,2,3,\cdots,N^{C}$. The probabilities of getting heads or tails are NOT necessarily 0.5 (distorted cons).

Also, $p^{A,i}$ is NOT necessarily $p^{B,i}$, where $p^{\eta,i}$ is the probability of getting head when tossing $i$-th coin in the box $\eta \in \{A,B\}$.

enter image description here

Data 1

Alice tossed each coin in both of the box A and B with $N^{\eta,i}$ times, where $N^{\eta,i}$ is how many times she tossed the $i$-th coin in the box $\eta$. She recored how many times head or tail had been obtained. So, the observed data is like $D_1=\{N^{A,1}_{head}, N^{A,1}_{tail},N^{A,2}_{head}, N^{A,2}_{tail},\cdots,N^{B,1}_{head}, N^{B,1}_{tail},N^{B,2}_{head}, N^{B,2}_{tail},\cdots\}$. (Of course, $N^{\eta,i}_{head}+ N^{\eta,i}_{tail} = N^{\eta,i}$)

Data 2

Then, Bob selected randomly the box A or box B and tossed all of coins inside the selected box. He recorded head or tail of each coin and passed the result to Alice as the data 2. So, the data 2 is like $D_2=\{x^{1}, x^{2}, \cdots,x^{N_c}\}$, where $x^{i}$ is head or tail of $i$-th coin.

problem

Using the two kind of data, Alice is supposed to infer the posterior probability that Bob chose the box A. Formally, she calculates $P(Box=A|D_1, D_2)$.

My answer

probability of each coin

Using the data $D_1$ the probability of getting the head of each coin can be calculated as below.

By the bayese theorem, the probability $p^{\eta, i}$, by which one gets the head of the $i$-th coin in the box $\eta \in \{A, B\}$ is $Beta(\alpha=1+N^{A,i}_{head}, \beta=1+N^{A,i}_{tail})$, where $Beta(\alpha, \beta)$ is the beta distribution.

Likelihood of $D_2$

With Monte Carlo simulation, you can calculate the likelihood $P(D_2|\eta, p^{\eta, i})$.

Posterior

With MCMC, you can calculate $P(\eta|D_1, D_2) = P(\eta|D_1, p^{\eta, i})$ with a setting of that the likelihood is set as $P(D_2|\eta, p^{\eta, i})$ calculated at the above step, and the prior $P(A) = P(B) = 0.5$.

$\endgroup$
0

1 Answer 1

1
$\begingroup$

Towards reducing the complexity of your notations, let us consider the case there is a single coin in each box, with probability of head $p_A$ and $p_B$, respectively.

The learning experiment means observing $N^A$ heads and $M^A$ tails, versus $N^A$ heads and $M^A$ tails, for boxes A and B, respectively. Starting with a flat prior on both $p_A$ and $p_B$, the resulting posterior is then $$p_A\sim\text{Be}(1+N^A,1+M^a)\qquad p_B\sim\text{Be}(1+N^B,1+M^B)$$ which becomes the prior for the testing experiment.

Having observed $x\in\{\text{head},\text{tail}\}$, rewritten as $y=\mathbb{I}_{\text{head}}(x)\in\{0,1\}$, the marginal distribution of $Y$ is $$m_A(y)=\int_0^1 p_A^y (1-p_A)^{1-y} \text{Be}(p_A;1+N^A,1+M^A)\text{d}p_A$$ for box A and $$m_B(y)=\int_0^1 p_B^y (1-p_B)^{1-y} \text{Be}(p_B;1+N^B,1+M^B)\text{d}p_B$$ for box B. Those integrals are available in closed form: \begin{align*}m_A(y)&=\dfrac{B(1+N^A+y,1+M^A+1-y)}{B(1+N^A,1+M^A)}\\ &=\dfrac{(2+N^A+M^A)!}{(1+N^A+M^A)!}\Big/\dfrac{(N^A+y)!(M^A+1-y)!}{N^A!M^A!}\\ &=\dfrac{2+N^A+M^A}{y(N^A+y)+(1-y)(M^A+1-y)} \end{align*} and $$m_B(y)=\dfrac{2+N^B+M^B}{y(N^B+y)+(1-y)(M^B+1-y)}$$ Therefore,$$\mathbb{P}(A|y)=\dfrac{m_A(y)}{m_A(y)+m_B(y)}$$ The extension to the case described in the question is straightforward since the $N^c$ coins are independent. Therefore the marginal distribution of $D_2$ is just the product of the marginals over all coins.

$\endgroup$

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.