# how to get joint pdf of mixed random variables

I would like to know how the joint probability density function $$p(b,r,\sigma^2)$$ can be calculated for the following graph. Random variable $$b$$ is a latent binary variable, and random variable $$\sigma^2$$ is Inverse-Gamma. Random variable $$r$$ is observed and assumed Gaussian with two means ($$\mu_0 = -1$$ and $$\mu_1 = 1$$). In other words, $$r$$ can be generated from a Gaussian with mean = -1 or it can be generated from a Gaussian with mean 1.

$$\sigma^2$$ represents a common variance between the two Gaussians.

• What happens when you try to factorize this graph? Sep 26 '18 at 17:58
• So my understanding of probability density function is that in 1-D single variable $p(r)dr$ is the probability of sampling between $r$ and $r+dr$ where $r$ is a continuous variable as a binary variable, $b$ can equal 0 with probability $\pi$ and 1 with probability $1-\pi$ seems to me that $p(r,b,\sigma^2) = \left(\pi\delta_{\beta,0}+(1-\pi)\delta_{\beta,1}\right)p(r,\sigma^2)$ Sep 26 '18 at 18:02

This graph can be factorized according to the usual rules of Bayesian graphs:

$$p(b,r,\sigma^2) = p(r|b,\sigma^2)p(b)p(\sigma^2)$$

If you want the marginal distribution $$p(r, \sigma^2)$$ (that is, averaged over possible $$b$$ outcomes), then you have the familiar mixture density:

$$p(r,\sigma^2) = \Pr(b=1)p(r|b=1,\sigma^2)p(\sigma^2) + \Pr(b=0)p(r|b=0,\sigma^2)p(\sigma^2)$$

I'm abusing notation pretty badly here. I can clarify if any of it doesn't make sense.

• what will $p(r|b,\sigma^2)$ be, when the means $\mu_0 = -1$ and $\mu_1 = 1$ are known and the variance unknown? Jan 15 '19 at 18:10
• @fountain3 you are conditioning on $\sigma^2$, so it must be known. Just write $\sigma^2$. For $\mu$, you can write $\mu_b$, since $b$ is also known. Jan 16 '19 at 20:08
• Terribly sorry I meant to write $p(r,\sigma^2|b)$. If $r$ is Gaussian, $\sigma^2$ is Gamma, and $b$ is binary, I need to get the expression for $p(r,\sigma^2|b)$. Jan 17 '19 at 8:06
• @fountain3 just plug in $\mu_b$? Jan 17 '19 at 15:00
• If I use the Normal-Gamma equation from wikipedia: en.wikipedia.org/wiki/Normal-gamma_distribution what should I use for the parameters of the Gamma part? Jan 17 '19 at 15:55