2

$$Y|X=x \sim N(x,1)\\X\sim N(\mu,\sigma^2 )$$ What distribution does $X|Y=y$ follow?

My initial startegy was to $f_{Y|X}f_X=f_{X,Y}$ and solve for $f_{X|Y}=f_{X,Y}/f_{Y}$ . Computing for $f_{X,Y}$, I get the following: $$f_{X,Y}=\frac{1}{\sqrt{2\pi\sigma^2}}\exp\left\{-\frac{(x-\mu)^2}{2\sigma^2}\right\}\frac{1}{\sqrt{2\pi}}\exp\left\{-\frac{(y-x)^2}{2}\right\}$$ And in trying to compute for $f_{Y}$, I was trying to integrate above w.r.t $x$, but I was stuck. I am not sure if that's integratable, and if this is a right approach to solve this question. I am curious if there is some kind of tricks/insights I am missing.

Alby
  • 2,223
  • 1
    Generally, the gist of these kind of problems go: combine and expand the exponents, collect like terms, complete the square, write quadratic as $(x-g(y,\mu,...))^2+S$, spot the density. – Glen_b Oct 15 '13 at 23:06
  • 1
    You can now find a shorter way to calculate your integral, here: http://stats.stackexchange.com/questions/73157/calculation-of-an-unconstrained-normal-distribution-starting-from-a-censored/73327#73327 – Alecos Papadopoulos Oct 20 '13 at 23:41

1 Answers1

1

Separate the exponents to terms that do not contain $x$ and those that contain $x$ . You will obtain an integrand that can be written in the form $e^{-ax^2-bx}$ (all other terms go out of the integral, since you want to integrate w.r.t $x$). Then Gradshteyn & Ryzhik (2007), "Table of Integrals, Series and Products", 7th ed. p.336, eq. 3.322(2) give the formula:

$$\int_{0}^{\infty}\exp\left\{−\frac {x^2}{4\beta}−\gamma x\right\}dx = \sqrt {\pi\beta} \exp\left\{\beta \gamma^2\right\} \left[1-\operatorname{erf}(\gamma \sqrt \beta)\right]$$

I presume you can turn a $\int_{-\infty}^{\infty}$ integral into $\int_{0}^{\infty}$ integrals.

It's going to be a bit long and tedious, easy to make an algebraic mistake. After you're done, don't forget to remember the connection of the error function with the cdf of the standard normal.

  • For a more general case: $Y|X=x \sim N(x,\sigma_x^2)$ and $X\sim N(\mu_x,\sigma^2_x)$ I've $\beta = \frac{2\sigma_x^2 + 2\sigma_y^2}{\sigma_y^2\sigma_x^2}$ and $\gamma = \frac{-4\sigma_x^2 y - 4\sigma^2_y\mu_x}{4\sigma_y^2\sigma_x^2}$. It seems that $\int_{-\infty}^0 \text{exp}{-\frac{x^2}{4\beta}-\gamma x}dx = \int_{0}^\infty \text{exp}{-\frac{x^2}{4\beta}-\gamma x}dx$. With this I'll get smth. like a density multiplied by the $\text{erf}$. But since $\text{erf}$ integrates over $\gamma\sqrt{\beta}$ which depends upon $y$ how am I supposed to find the expected value and variance of $y$? – Druss2k Oct 20 '13 at 15:03
  • Short: $\text{erf}(x) = \frac{2}{\sqrt{\pi}}\int_0^x \text{exp}{-\tau^2}d\tau$. Because $\tau = \gamma\sqrt{\beta} = \text{f}(y,\mu_x,\sigma_x^2,\sigma_y^2)$ the $\text{erf}$ part seems rather complicated. – Druss2k Oct 20 '13 at 15:13
  • 1
    $\int_{-\infty}^0 \text{exp}{-\frac{x^2}{4\beta}-\gamma x}dx = \int_{0}^\infty \text{exp}{-\frac{x^2}{4\beta}+\gamma x}dx$. Use the relation of erf with the standard normal cdf, and we'll take it from there. – Alecos Papadopoulos Oct 20 '13 at 17:19