Combining two or more probabilities

267 Views Asked by At

I'm trying to simplify a win/loss simulation. The situation is as follows:

Let's say there are two players A and B where:

  • When A goes into a battle, it's probability of a win is 0.1 (10%)
  • When B goes into a battle, it's probability of a win is 0.2 (20%)

Note 1 : The win probability is invariant to the opponent.

Note 2 : There are no draws, though there could be in a future enhancement, for now trying to keep things simple.

Note 3 : There are other players in the game each with their own probabilities.

If A and B were to battle each other I need to determine who will win.

Currently what I'm doing is sampling 2 different Bernoulli distributions, one for A (with $P_a = 0.1$) and one for B (with $P_b = 0.2$)

I sample each of the distributions until only one of them returns success. That player is the winner of the battle, the other player will have lost. The following is pseudo code of the process:

while (true)
{
   bool win_a = bernoulli(pr_a);
   bool win_b = bernoulli(pr_b);

   if (win_a == win_b) // either both won or both lost
      continue;

   if (win_a)
      return "A won";
   else
      return "B won";
}

The problem with the above approach is that even though it will eventually determine a winner, it may end-up looping for a long time before it does.

I was wondering if there's a mathematically valid way of combining the above probabilities into a singular Bernoulli trial such that $Pr(A_{winning})= k$ and $Pr(B_{winning}) = 1 - k$ for some particular k.

My current thinking is that $k = \frac{P_a}{(P_a + P_b)}$ but I'm not sure if it is correct or how to reason about it correctness.

2

There are 2 best solutions below

14
On BEST ANSWER

Let $X=1$ if A wins and $0$ otherwise. Let $Y=1$ if B wins and $0$ otherwise.

$P(\text{A wins})=P(X=1,Y=0)=P(X=1)P(Y=0)=P_a(1-P_b)$

$P(\text{B wins})=P(X=0,Y=1)=P(X=0)P(Y=1)=P_b(1-P_a)$

So you need to generate a Bernoulli r.v. $Z$ with odds ratio $P_a(1-P_b):P_b(1-P_a)$

$P(\text{A wins})=P(Z=1)=\frac{P_a(1-P_b)}{P_a(1-P_b)+P_b(1-P_a)}$

$P(\text{B wins})=P(Z=0)=\frac{P_b(1-P_a)}{P_a(1-P_b)+P_b(1-P_a)}$

8
On

In sports simulations, there is a standard way to combine win probabilities for head-to-head contests in which no tie is possible, even when the contestants have not faced off previously. It should be emphasized that this is heuristic only; there is no first-principles validation for this approach, because the situation is underdetermined.

Essentially, suppose that $A$'s winning probability is $p$, and $B$'s winning probability is $q$. Then we write that

$$ P(\text{$A$ beats $B$}) = \frac{p(1-q)}{p(1-q)+q(1-p)} $$

and

$$ P(\text{$B$ beats $A$}) = \frac{q(1-p)}{p(1-q)+q(1-p)} $$

Your simulation happens to yield these same probabilities, but as I said, that's not provably correct.