# Finding conditional probability of “success” when success probability is random

Suppose that event $$A$$ is a subset of event $$B$$.

Event $$A$$ happens with probability $$p_A$$ and event $$B$$ happens with probability $$p_B$$.

Here, we only know the distribution of $$p_A$$ and $$p_B$$.

In fact, we have $$p_A\sim Beta(\alpha_1,\beta_1)$$ and $$p_B\sim Beta(\alpha_2,\beta_2)$$ with a condition that $$\alpha_1+\beta_1=\alpha_2+\beta_2$$.

What I want to compute is to find a conditional probability of event $$A$$ given event $$B$$ (denote it by $$p_{A|B}$$).

If $$p_A$$ and $$p_B$$ were deterministic, we can simply have $$p_{A|B}=\frac{p_A}{p_B}.$$

However, how should I proceed if these $$p_i$$'s themselves are random variables? From the beta distribution and the assumption on the beta parameters, we have

$$f_{\mathbb p_A|\mathbb p_B=z}(p_A|p_B=z)=\frac{\Gamma(\alpha_2)\Gamma(\beta_2)}{\Gamma(\alpha_1)\Gamma(\beta_1)}\frac{p_A^{\alpha_1-1}(1-p_A)^{\beta_1-1}}{z^{\alpha_2-1}(1-z)^{\beta_2-1}},~p_A\leq z.$$

From this conditional probability, how to derive $$p_{A|B}$$? Can we proceed by setting $$E[p_{A|B}]=\int^1_0\int^z_0p_Af_{\mathbb p_A|\mathbb p_B=z}(p_A|p_B=z)f_{P_B}(z)dp_Adz?$$

If $$p_A,p_B$$ are both random variables here (unusual situation) then also $$p_{A|B}$$ must be looked at as a random variable: $$p_{A\mid B}=\frac{p_A}{p_B}$$ if $$B\subseteq A$$.

Further it is not in general true that $$\mathbb E\frac{X}{Y}=\frac{\mathbb EX}{\mathbb EY}$$ so it is also not guaranteed that $$\mathbb Ep_{A\mid B}=\frac{\mathbb Ep_A}{\mathbb Ep_B}$$

• That's correct. I've added a conditional distribution, would there be anything that we can tell about $p_{A|B}$ from the distribution? (e.g, say the conditional success probability is $E[p_{A|B}]$?) – Andeanlll Aug 9 at 23:04
• If the distribution of $p_A/p_B$ is known then you can (at most) indeed calculate the "expectation of the conditional success probability". And eventually other things like variance. It depends on the context whether that is useful. The essence of my answer is that you cannot really calculate the conditional success probability. This because it is not a real number, but a function on $\Omega$ taking values in $[0,1]$. – drhab Aug 10 at 8:21

I doubt it is generally possible to have $$P(A)$$ and $$P(B)$$ both Beta distributions and $$p_{A \mid B}=P(A \mid B)$$ independent of the actual value of $$B$$ unless it is $$0$$ or $$1$$ or some other special case.

• The mean of $$p_A =P(A)$$ is $$\frac{\alpha_1}{\alpha_1 + \beta_1}$$ and the variance is $$\frac{\alpha_1 \beta_1}{(\alpha_1 + \beta_1)^2(\alpha_1 + \beta_1+1)}$$ as it has a Beta distribution

• If $$P(A \mid B) = k$$ then $$P(A) = k P(B)$$ with mean $$k\frac{\alpha_2}{\alpha_2 + \beta_2}$$ and variance $$k^2\frac{\alpha_2 \beta_2}{(\alpha_2 + \beta_2)^2(\alpha_2 + \beta_2+1)}$$

For the means and variances to match, you need $$\frac{\beta_2}{\alpha_2(\alpha_2 + \beta_2+1)} = \frac{ \beta_1}{\alpha_1(\alpha_1 + \beta_1+1)}$$ which is unlikely, and even then in non-trivial cases would not guarantee both followed a Beta distribution

• thank you for your comment. I've added an assumption that $\alpha_1+\beta_1=\alpha_2+\beta_2$ and the conditional distribution. Would that make it possible to compute $P(A|B)?$ or should I leave it as a distribution and I can't proceed any further? – Andeanlll Aug 9 at 23:00