Let $A\sim U(0,4)$ and $B\sim N(a^3,1)$ given that $A=a$. What is the conditional PDF $P_{A|B}(a, b)$? I know I need to find the joint PDF $P_{A,B}(a,b)$ but I'm not sure how. For independent variables the joint PDF is just $P_{A}(a)P_{B}(b)$ but we aren't given that A and B are independent.
Find the conditional pdf of two random variables
85 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 2 best solutions below
On
I think they mean that $B\sim N(A^3,1)$ by letting $a$ be random. This will statistically link $A$ and $B$. In fact, the definition of $B$ above is a conditional distribution (read: density $p_B(b)$ here since $A,B$ are continuous):
$$p_{B|A}(b;a) = N(a^3,1):= \phi(b;a^3,1)=\frac{1}{\sqrt{2\pi}}e^{-(b-a^3)^2/2}$$
The joint density $p_{A,B}(a,b)$ can be expressed in terms of a conditional and unconditional density:
$$p_{A,B}(a,b) = p_A(a)p_{B|A}(b;a) = \left[\frac14 \cdot \mathbb{1}_{[1,4]}(a)\right]\frac{1}{\sqrt{2\pi}}e^{-(b-a^3)^2/2} = \frac{1}{4\sqrt{2\pi}}e^{-(b-a^3)^2/2}\;\;0\leq a \leq 4$$
Now we need to "flip the conditional" to get $p_{A|B}(ab)$:
$$p_{A|B}(a;b) = \frac{p_{A,B}(a,b)}{p_B(b)} = \frac{ \frac{1}{4\sqrt{2\pi}}e^{-(b-a^3)^2/2}}{\frac14\int_0^4 \frac{1}{\sqrt{2\pi}}e^{-(b-z^3)^2/2}dz} = \frac{e^{-(b-a^3)^2/2}}{\int_0^4 e^{-(b-z^3)^2/2}dz}\;\;0\leq a \leq 4$$
Obviously $A$ and $B$ cannot be independent: the conditional mean of $B$ depends on the value of $A$, so a statement like $\Pr[B > 0 \mid A = 4] = \Pr[B > 0]$ cannot possibly hold true.
The conditional density is $$f_{A \mid B}(a \mid b) = \frac{f_{A,B}(a,b)}{f_B(b)}. \tag{1}$$ But we are given the conditional variable
$$B \mid A \sim \operatorname{Normal}(A^3,1),$$ hence the conditional density of $B$ given $A$ is
$$f_{B \mid A}(b \mid a) = \frac{1}{\sqrt{2\pi}} e^{-(b-a^3)^2/2}. \tag{2}$$ The joint density is
$$f_{A,B}(a,b) = f_{B \mid A}(b \mid a) f_A(a) = \frac{1}{4 \sqrt{2\pi}} e^{-(b-a^3)^2/2}, \quad 0 \le a \le 4, \quad -\infty < b < \infty. \tag{3}$$
So all that remains is to compute the marginal (unconditional) density of $B$ via the law of total probability:
$$f_B(b) = \int_{a=0}^4 f_{A,B}(a,b) \, da. \tag{4}$$ But this integral does not have an elementary closed form, so we leave it as is and write
$$f_{A \mid B}(a \mid b) = \frac{e^{-(b-a^3)^2/2}}{\int_{a^*=0}^4 e^{-(b-(a^*)^3)^2/2} \, da^*}, \quad 0 \le a^* \le 4, \tag{5}$$ where we have used $a^*$ in the denominator instead of $a$ so as to avoid confusion. Note we also canceled out the factor $1/(4 \sqrt{2\pi})$.
For example, if we observe $B = 1$, then we can numerically evaluate the denominator as $$\int_{a^* = 0}^4 e^{-((a^*)^3-1)^2/2} \, da^* \approx 0.10326829139863961063$$ so the posterior density of $A$ given $B = 1$ is $$f_{A \mid B}(a \mid 1) \approx 9.6835 e^{-(a^3-1)^2/2}, \quad 0 \le a \le 4.$$