Can we generate the ratio of two unknown probabilities?
Your question is related to a body of literature known as the "Bernoulli factory problem": Given a coin with unknown probability of heads $\lambda$, sample the probability $f(\lambda)$. One important result is that $f(\lambda):\mathcal{D}\subseteq(0,1) \to [0,1]$ can be sampled this way if and only if $f=0$, $f=1$, or $f$ is continuous and polynomially bounded on $\mathcal{D}$ (both $f$ and $1-f$ are bounded below by min($\lambda^n$, $(1-\lambda)^n$) for some $n$), so that for example, it's impossible to simulate $2p_A$ with coin $A$ (that is, to double the chance of heads) when $p_A$ can be any value in $(0, 1/2)$ (Keane and O'Brien 1994).
And it follows that without more information on $p_A$ and $p_B$, it's likewise impossible to sample the probability $\frac{p_A}{p_B}$.
On the other hand, there is an algorithm to sample the probability $\frac{p_A}{p_A+p_B}$, as follows (Gonçalves et al. 2017):
- Flip a fair coin. (If this is unavailable and assuming coin $A$ is not one-sided, then just flip $A$ twice until both faces are different then take the first face as the fair coin result [von Neumann 1951].)
- If the fair coin shows heads, flip coin $A$ and return heads if that coin shows heads.
- If the fair coin shows tails, flip coin $B$ and return tails if that coin shows heads.
- Go to step 1.
We can see that the expected number of flips of $A$ and $B$ total, other than fair coin flips, is $1/(\frac{1}{2} p_A + \frac{1}{2} p_B)$.
There are numerous other "Bernoulli Factory" algorithms like this for numerous other functions.
REFERENCES:
- Gonçalves, F. B., Łatuszyński, K. G., Roberts, G. O. (2017). Exact Monte Carlo likelihood-based inference for jump-diffusion processes.
- Keane, M. S., and O'Brien, G. L., "A Bernoulli factory", ACM Transactions on Modeling and Computer Simulation 4(2), 1994.
- von Neumann, J., "Various techniques used in connection with random digits", 1951.