Computation of conditional distribution--please review

34 Views Asked by At

I would like to compute the conditional distribution and have posted a question with my attempt here https://stats.stackexchange.com/questions/374401/how-to-obtain-the-posterior-distribution-of-a-given-problem .

Could you please review?

Thank you so much


Problem:

Compute the conditional distribution of a random variable $X$ given $Y$.

  • If a random variable $X$ is Bernoulli distributed with probability $q$ for $X = 0$.

  • The conditional distributions $p\left(y|X=0\right) = \mathcal{N}\left(2,1\right)$ and $p\left(y|X=1\right) = \chi^2\left(3\right)$.


ATTEMPT:

The conditional distribution of $X$ given $Y$ is \begin{align} p(x|y) = \frac{p(x,y)}{p(y)} = \frac{p(y|x)p(x)}{p(y)} . \end{align}

So, we need to compute \begin{align} p(y) = \underbrace{p(y|X=0)}_{= \mathcal{N}\left(2,1\right)} \underbrace{p(X=0)}_{q} + \underbrace{p(y|X=1)}_{=\chi^2\left(3\right)} \underbrace{p(X=1)}_{= 1-q} \end{align}

Then, we can obtain the conditional distribution of $X = 0$ and $X = 1$ given $Y$ as \begin{align} p(X=0|y) = \frac{ \underbrace{p(y|X=0)p(X=0)}_{q \ \mathcal{N}\left(2,1\right) }}{p(y)} , \end{align}

and

\begin{align} p(X=1|y) = \frac{ \underbrace{p(y|X=1)p(X=1)}_{ \left( 1-q\right) \ \chi^2\left(3 \right) }}{p(y)} . \end{align}

Am I doing correctly? Thank you