# Calculation of an “unconstrained” normal distribution (starting from a censored one)

Assume that two r.v. $W$ and $Y|W=w$ with

(1) $W \sim \text{N}(\mu_w,\sigma_w^2)$ (iid)

(2) $Y|W=w \sim \text{N}(w,\sigma_y^2)$ (iid)

Further we only observe $Y$ if $Y$ is less then $W$, i.e.,

(3) $Y|Y\le W$

Goal: Find the pdf of the censored observations, i.e., of $Y|Y\le W$ and from that deduce the uncensored pdf and the first two moments (so i.m.h.o. we have to find$f_Y(y)$). The first two moments of this uncensored pdf are supposed to depend upon $E(Y|Y\le W)$ and $Var(Y|Y\le W)$.

By definition of conditional pdf we have that:

(4) $f_{Y|W}(y|W = w)= \frac{f_{Y,W}(y,w)}{f_W(w)}$

Next, the definition of a truncated density gives for a abitrary value of $W$:

(5) $f_{Y|Y\le W}(y|y\le w) = \frac{f_Y(y)}{P(Y\le W)}$

I would simply rewrite (4) to

$f_{Y|W}(y|W = w)f_W(w) = f_{Y,W}(y,w)$

then integration over $f_{Y,W}(y,w)$ w.r.t $w$ should yield $f_Y(y)$, i.e.,

(a) $\int_{-\infty}^{\infty} f_{Y,W}(y,w) dw = \int_{-\infty}^{\infty} f_Y(y|W = w)f_W(w) dw = f_Y(y)$

Plugin in $f_Y(y)$ into (5), ($P(Y\le W)$ will also be given by $f_Y(y)$) I will se how the moments of $f_{Y|Y\le W}(y|y\le w)$ will look and how the moments of $f_Y(y)$ depend upon them.

So (a) will look like

$f_Y(y) = \int_{-\infty}^{\infty}\frac{1}{\sqrt{2\pi\sigma^2_y}}\text{exp}\big(-\frac{(y-w)^2}{2\sigma_y^2}\big)\frac{1}{\sqrt{2\pi\sigma^2_w}}\text{exp}\big(-\frac{(w-\mu_w)^2}{2\sigma_w^2}\big)dw$

Except for the $w$ in the first $\text{exp}$, this looks very easy but since there is a $w$ im a little bit stuck how to solve this...

• Look up the answer to this question : stats.stackexchange.com/questions/72857/… – Alecos Papadopoulos Oct 18 '13 at 21:56
• Thanks. This might be stuipid but would it not help to center $Y$ w.r.t $W$ then $Z:=Y-W$ will have expectation $0$ and variance $\sigma_y^2$ – Druss2k Oct 18 '13 at 22:09
• Then you should also eliminate $W$ from the second exp which would make $Z$ appear in there too, having again your new integrating variable ($z$) present in the two exp's. You don't gain anything, really. – Alecos Papadopoulos Oct 18 '13 at 22:54
• Ah sure, thats what I missed. I already presumed that this would not work... Why should centering solve a integral... – Druss2k Oct 18 '13 at 23:01
• This question was also answered later at stats.stackexchange.com/questions/166273 . – whuber Jun 17 '16 at 14:48

Ok. Let's do this, for CV's shake.

First compact by setting $C=\frac{1}{\sqrt{2\pi\sigma^2_y}}\frac{1}{\sqrt{2\pi\sigma^2_w}} = \frac{1}{2\pi\sigma_y\sigma_w}$, so

$$f_Y(y) =C \int_{-\infty}^{\infty}\exp\left\{-\frac{(y-w)^2}{2\sigma_y^2}\right\}\exp\left\{-\frac{(w-\mu_w)^2}{2\sigma_w^2}\right\}dw$$

We have $$exp\left\{-\frac{(y-w)^2}{2\sigma_y^2}\right\}\exp\left\{-\frac{(w-\mu_w)^2}{2\sigma_w^2}\right\} = \exp\left\{-\frac{y^2-2yw+w^2}{2\sigma_y^2}\right\}\exp\left\{-\frac{w^2-2w\mu_w+\mu_w^2}{2\sigma_w^2}\right\} =\exp\left\{-\frac{y^2}{2\sigma_y^2}-\frac{\mu_w^2}{2\sigma_w^2}\right\} \exp\left\{-\frac{w^2}{2\sigma_y^2}-\frac{w^2}{2\sigma_w^2}\right\}\exp\left\{\frac{2yw}{2\sigma_y^2}+\frac{2w\mu_w}{2\sigma_w^2}\right\}$$

Setting $s^2\equiv \sigma_y^2+\sigma_w^2$ we arrive at

$$=\exp\left\{-\frac{y^2}{2\sigma_y^2}-\frac{\mu_w^2}{2\sigma_w^2}\right\} \exp\left\{-\frac{s^2}{2\sigma_y^2\sigma_w^2}w^2\right\}\exp\left\{\frac{\sigma_w^2y+\sigma_y^2\mu_w}{\sigma_y^2\sigma_w^2}w\right\}$$

Include the first $\exp$ in the constant, $C^*=C \exp\left\{-\frac{y^2}{2\sigma_y^2}-\frac{\mu_w^2}{2\sigma_w^2}\right\}$. Set $$\beta\equiv \frac{s^2}{2\sigma_y^2\sigma_w^2},\qquad \alpha\equiv \frac{\sigma_w^2y+\sigma_y^2\mu_w}{\sigma_y^2\sigma_w^2}$$ to obtain

$$f_Y(y) =C^* \int_{-\infty}^{\infty}e^{-\beta w^2+\alpha w}dw=C^*\left[ \int_{-\infty}^{0}e^{-\beta w^2+\alpha w}dw + \int_{0}^{\infty}e^{-\beta w^2+\alpha w}dw\right]$$

$$=C^* \int_{0}^{\infty}e^{-\beta w^2}\left[e^{-\alpha w}+e^{\alpha w}\right]dw =2C^* \int_{0}^{\infty}e^{-\beta w^2}\operatorname{cosh}(\alpha w)dw$$

where $\operatorname{cosh}$ is the hyperbolic cosine.

Using a formula provided in Gradshteyn & Ryzhik (2007), "Table of Integrals, Series and Products", 7th ed., p. 384, eq. 3.546(2) we have

$$f_Y(y)=2C^*\frac 12 \sqrt {\frac {\pi}{\beta}} \exp\left\{\frac {\alpha^2}{4\beta}\right\}$$

Now $$\frac {\alpha^2}{4\beta} = \frac {\left(\frac{\sigma_w^2y+\sigma_y^2\mu_w}{\sigma_y^2\sigma_w^2}\right)^2}{4\frac{s^2}{2\sigma_y^2\sigma_w^2}} = \frac {(\sigma_w^2y+\sigma_y^2\mu_w)^2}{2\sigma_y^2\sigma_w^2s^2}$$

and bringing back in $C^*$ (and $\beta$) in all its glory we have

$$f_Y(y)=\frac{1}{2\pi\sigma_y\sigma_w}\exp\left\{-\frac{y^2}{2\sigma_y^2}-\frac{2\mu_w^2}{\sigma_w^2}\right\}\sqrt{\pi} \left(\sqrt {\frac{s^2}{2\sigma_y^2\sigma_w^2}}\right)^{-1} \exp\left\{\frac {(\sigma_w^2y+\sigma_y^2\mu_w)^2}{2\sigma_y^2\sigma_w^2s^2}\right\}$$

The constant terms simplify to

$$\frac{1}{2\pi\sigma_y\sigma_w}\sqrt{\pi} \left(\sqrt {\frac{s^2}{2\sigma_y^2\sigma_w^2}}\right)^{-1} = \frac{1}{s\sqrt{2\pi}}$$

and, the exponentials end up in the normal exponential. So in the end

$$f_Y(y) = \frac{1}{s\sqrt{2\pi}}\exp\left\{-\frac{(y-\mu_w)^2}{2s^2}\right\}= N(\mu_w, s^2),\qquad s^2\equiv \sigma_y^2+\sigma_w^2$$

• Maybe I'm missing something, but you have only derived the distribution of $Y$, whereas the OP requires the conditional distribution of $Y$ given $Y \leq W$. Moreover there's no need to do all these calculations in order to derive the distribution of $Y$. – Stéphane Laurent Oct 21 '13 at 10:33
• @Stephane Laurent In the OP's question the solution to the specific integral is requested at the end of OP' post, where the OP clearly indicates that the solution to this integral is what the OP needs. It would be very useful to everybody if you would post an answer with the alternative and shorter way to derive the solution to this integral. – Alecos Papadopoulos Oct 21 '13 at 12:05
• The formula I used (which makes use of the cosh function) is quicker than what I had proposed to my other answer. Mistake, there isn't, in either ways. Be careful with how signs change/change not when swapping integral limits etc. – Alecos Papadopoulos Oct 21 '13 at 14:02
• @Stephan Laurent Yes, of course, but I wanted to calculate the integral for which the OP said he was stuck. And the bulk of my calculations are not about the constant term, but about manipulating the terms that contain the integrating variable. – Alecos Papadopoulos Oct 21 '13 at 14:05
• I would derive the pdf of $Z= Y-W$, and then calculate the moments of the truncated $Z|Z\le 0$. – Alecos Papadopoulos Oct 25 '13 at 15:46

$Y = W + Z$, where $Z$ is normal with mean 0 and variance $\sigma_z^2$ and is independent of $W$. (Note that I am using $\sigma_z^2$ where the OP used $\sigma_y^2$, which I reserve for the marginal variance of $Y$.) Then the unconstrained joint distribution of $(W,Y)$ is bivariate normal with $\mu_y = \mu_w$, $\sigma_y^2 = \sigma_w^2 + \sigma_z^2$, and $\sigma_{wy} = \sigma_w^2$.

Letting $\phi$ denote the standard normal pdf, integrating over the halfplane $Z<0$ gets the following marginal moments of $Y\,|\,(Y<W)$:

Mean $= \mu_y = 2 \int_{-\infty}^\infty \int_{-\infty}^0 (w \sigma_w + \mu_w + z \sigma_z)\,\phi(z)\mathrm{d}z\,\phi(w)\mathrm{d}w = \mu_w - \sigma_z \sqrt{2/\pi}$.

Variance $=\sigma_y^2 = 2 \int_{-\infty}^\infty \int_{-\infty}^0 (w \sigma_w + \mu_w + z \sigma_z - \mu_y)^2\,\phi(z)\mathrm{d}z\,\phi(w)\mathrm{d}w = \sigma_w^2 + \sigma_z^2 (1-2/\pi)$.

Third central moment $=2 \int_{-\infty}^\infty \int_{-\infty}^0 (w \sigma_w + \mu_w + z \sigma_z - \mu_y)^3\,\phi(z)\mathrm{d}z\,\phi(w)\mathrm{d}w = \sqrt{2}(\pi - 4) \sigma_z^3 / \pi^{3/2}$.

Those can be solved in reverse order to get $\sigma_z^2$, then $\sigma_w^2$, then $\mu_w$, which are necessary and sufficient to specify the unconstrained joint distribution.