50

Suppose $\phi(\cdot)$ and $\Phi(\cdot)$ are density function and distribution function of the standard normal distribution.

How can one calculate the integral:

$$\int^{\infty}_{-\infty}\Phi\left(\frac{w-a}{b}\right)\phi(w)\,\mathrm dw$$

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
hadisanji
  • 793
  • 6
  • 7
  • 5
    This is all fine. An early reference to a more general result which includes this one is Ellison (1964, J.Am.Stat.Assoc, 59, 89-95); see Corollary 1 of Theorem 2. –  Jun 22 '13 at 12:31

3 Answers3

77

Let $X$ and $Y$ be independent normal random variables with $X \sim N(a,b^2)$ and $Y$ a standard normal random variable. Then, $$P\{X \leq Y \mid Y = w\} = P\{X \leq w\} = \Phi\left(\frac{w-a}{b}\right).$$ So, using the law of total probability, we get that $$P\{X \leq Y\} = \int_{-\infty}^\infty P\{X \leq Y \mid Y = w\}\phi(w)\,\mathrm dw = \int_{-\infty}^\infty \Phi\left(\frac{w-a}{b}\right)\phi(w)\,\mathrm dw.$$ Now, $P\{X \leq Y\} = P\{X-Y \leq 0\}$ can be expressed in terms of $\Phi(\cdot)$ by noting that $X-Y \sim N(a,b^2+1)$, and thus we get $$\int_{-\infty}^\infty \Phi\left(\frac{w-a}{b}\right)\phi(w)\,\mathrm dw = \Phi\left(\frac{-a}{\sqrt{b^2+1}}\right)$$ which is the same as the result in whuber's answer.

Dilip Sarwate
  • 41,202
  • 4
  • 94
  • 200
  • 2
    Just wanted to mention this was generalized to the multivariate case in Lemma 2.1 of "On fundamental skew distributions" by Arellano-Valle, Genton – bringingdownthegauss May 11 '20 at 18:50
  • @ Dilip Sarwate: Would you mind to tell how did you get the second expression of P{X≤Y}=∫∞−∞P{X≤Y∣Y=w}ϕ(w)dw ? To my understanding, the integrand of the integral should be the product of P{X≤Y∣Y=w} with the pdf of w, not with ϕ(w). Am I wrong ? – user295357 Sep 06 '20 at 19:59
  • @user295357 $w$ is a real number and does not have a pdf. I am multiplying the _conditional_ probability $P\{X \leq Y\mid Y=w\}$ by the _"probability"_ $\phi(w)$ of the _conditioning_ event $\{Y=w\}$ and summing these by integrating. Remember that an integral is basically a sum, and remember also that the total probability law is the sum $$P(A)=\sum_i P(A\mid B_i)P(B_i).$$ All I am doing is using the continuous version of the law of total probability. Compare $$f_X(x)=\int f_{X\mid Y}(x\mid y)f_Y(y) \mathrm dy$$ which you can understand by noting that $ f_{X\mid Y}(x\mid y)f_Y(y)=f_{X,Y}(x,y)$ – Dilip Sarwate Sep 06 '20 at 21:32
  • @ Dilip Sarwate: Thank for your reply. I understand that if Y (as well as w) is a discrete RV, then the integrand should be the product of P{X≤Y∣Y=w} with the probability of w. However, here Y is a continuous random variable of normal distribution, so I think the integrand should be the product of P{X≤Y∣Y=w} with the pdf of w. Furthermore, even you consider Y (as well as w) as a discrete RV, is there any reason to assume the probability that Y=w being ϕ(w) ? – user295357 Sep 06 '20 at 23:25
  • Dilip Sarwate's elegant answer only works because of the independence between $X$ and $Y$. Otherwise we don't have $P(X \le Y | Y=w) \ne P(X \le w)$ – user67724 Mar 26 '21 at 21:43
55

A more conventional notation is

$$y(\mu, \sigma) = \int\Phi\left(\frac{x-\mu}{\sigma}\right)\phi(x) dx = \Phi\left(\frac{-\mu}{\sqrt{1+\sigma^2}}\right).$$

This can be found by differentiating the integral with respect to $\mu$ and $\sigma$, producing elementary integrals which can be expressed in closed form:

$$\frac{\partial y}{\partial \mu}(\mu, \sigma) = -\frac{1}{\sqrt{2 \pi } \sqrt{\sigma ^2+1}}e^{-\frac{1}{2}\frac{\mu ^2}{\sigma ^2+1}},$$

$$\frac{\partial y}{\partial \sigma}(\mu, \sigma) = \frac{\mu\sigma }{\sqrt{2 \pi } \left(\sigma ^2+1\right)^{3/2}}e^{-\frac{1}{2}\frac{\mu ^2}{\sigma ^2+1}}.$$

This system can be integrated, beginning with the initial condition $y(0,1)$ = $\int\Phi(x)\phi(x)dx$ = $1/2$, to obtain the given solution (which is easily checked by differentiation).

Di Chen
  • 3
  • 4
whuber
  • 281,159
  • 54
  • 637
  • 1,101
  • 4
    I double-checked the answer via numeric integration and contouring the ratios for $-2 \le \mu \le 2$, $0 \lt \sigma \le 2$: agreement was to eleven significant figures throughout this range. – whuber Jun 06 '13 at 19:02
  • wow, clever solution. – Cam.Davidson.Pilon Jun 06 '13 at 19:03
  • 2
    I think this one can be done almost by inspection. The first term under the integral is a uniform[0,1] random variable. Since the normal pdf is symmetric, the integral should be $1 \over 2$ – soakley Jun 06 '13 at 19:04
  • 2
    @soakley Your approach works for $y(0,1)$, but it's not clear how it would apply to other arguments of $y$. – whuber Jun 06 '13 at 19:05
  • is there a solution for finite bound on the integral? For example, what if the integration was from 0 to u (for upper bound)? – Lewkrr Jan 28 '15 at 20:20
  • 1
    @Lewkrr Sure, just change the initial condition. That will add a constant to the solution. The constant depends on $u$. – whuber Jan 28 '15 at 21:12
  • 2
    @whuber Sorry for not understanding, but once we have the two closed forms for the derivative and the initial condition, how do we go from there to the final solution? In other words, what did you do with the closed form expressions for the derivatives and the initial condition? – user106860 Nov 07 '18 at 04:30
  • 1
    @user106860 For general methods, consult a textbook on ordinary differential equations (ODEs). In the present case, the solution can be found by inspection--essentially by looking at the common terms in the derivatives to guess the solution must be related to $\Phi\left(-\mu/\sqrt{1+\sigma^2}\right)$ and checking. – whuber Jun 21 '21 at 13:54
4

Here is another solution: We define \begin{align*} I(\gamma) & =\int_{-\infty}^{\infty}\Phi(\xi x+\gamma)\mathcal{N}(x|0,\sigma^{2})dx, \end{align*} which we can evaluate $\gamma=-\xi\mu$ to obtain our desired expression. We know at least one function value of $I(\gamma)$, e.g., $I(0)=0$ due to symmetry. We take the derivative wrt to $\gamma$ \begin{align*} \frac{dI}{d\gamma} & =\int_{-\infty}^{\infty}\mathcal{N}((\xi x+\gamma)|0,1)\mathcal{N}(x|0,\sigma^{2})dx\\ & =\int_{-\infty}^{\infty}\frac{1}{\sqrt{2\pi}}\exp\left(-\frac{1}{2}\left(\xi x+\gamma\right)^{2}\right)\frac{1}{\sqrt{2\pi\sigma^{2}}}\exp\left(-\frac{x^{2}}{2\sigma^{2}}\right)dx. \end{align*} and complete the square \begin{align*} \left(\xi x+\gamma\right)^{2}+\frac{x^{2}}{\sigma^{2}} & =\underbrace{\left(\xi^{2}+\sigma^{-2}\right)}_{=a}x^{2}+\underbrace{-2\gamma\xi}_{=b}x+\underbrace{\gamma^{2}}_{=c} \\ &=a\left(x-\frac{b}{2a}\right)^{2}+\left(c-\frac{b^{2}}{4a}\right) \left(c-\frac{b^{2}}{4a}\right)\\ & =\gamma^{2}-\frac{4\gamma^{2}\xi^{2}}{4\left(\xi^{2}+\sigma^{-2}\right)}\\ &=\gamma^{2}\left(1-\frac{\xi^{2}}{\xi^{2}+\sigma^{-2}}\right)\\ &=\gamma^{2}\left(\frac{1}{1+\xi^{2}\sigma^{2}}\right) \end{align*} Thus, \begin{align*} \frac{dI}{d\gamma} & =\frac{1}{2\pi\sigma}\exp\left(-\frac{1}{2}\left(c-\frac{b^{2}}{4a}\right)\right)\sqrt{\frac{2\pi}{a}}\int_{-\infty}^{\infty}\sqrt{\frac{a}{2\pi}}\exp\left(-\frac{1}{2}a\left(x-\frac{b}{2a}\right)^{2}\right)dx\\ & =\frac{1}{2\pi\sigma}\exp\left(-\frac{1}{2}\left(c-\frac{b^{2}}{4a}\right)\right)\sqrt{\frac{2\pi}{a}}\\ &=\frac{1}{\sqrt{2\pi\sigma^{2}a}}\exp\left(-\frac{1}{2}\left(c-\frac{b^{2}}{4a}\right)\right)\\ & =\frac{1}{\sqrt{2\pi\left(1+\sigma^{2}\xi^{2}\right)}}\exp\left(-\frac{1}{2}\frac{\gamma^{2}}{1+\xi^{2}\sigma^{2}}\right) \end{align*} and integration yields

$$ \begin{align*} I(\gamma) &=\int_{-\infty}^{\gamma}\frac{1}{\sqrt{2\pi\left(1+\sigma^{2}\xi^{2}\right)}}\exp\left(-\frac{1}{2}\frac{z^{2}}{1+\xi^{2}\sigma^{2}}\right)dz\\ &=\Phi\left(\frac{\gamma}{\sqrt{1+\xi^{2}\sigma^{2}}}\right) \end{align*} $$

which implies

$$ \begin{align*} \int_{-\infty}^{\infty}\Phi(\xi x)\mathcal{N}(x|\mu,\sigma^{2})dx &=I(\xi\mu)\\ &=\Phi\left(\frac{\xi\mu}{\sqrt{1+\xi^{2}\sigma^{2}}}\right). \end{align*} $$

Sycorax
  • 76,417
  • 20
  • 189
  • 313
Jenny Reininger
  • 244
  • 1
  • 7