# integral involving the normal CDF

Does anyone know if I have a chance to get a closed form for the following integral (and if yes, what would be the trick)?

$$\int \left\{1-\Phi(x)\right\}^k \Phi(x)^{n-k} \varphi\left(\frac{x-\mu}{\sigma}\right) dx,$$

where $\Phi$ and $\varphi$ are the normal cumulative distribution and density functions, $k \leq n$ are integers, and $\mu$ and $\sigma >0$ are real numbers.

I had a look at this page https://en.wikipedia.org/wiki/List_of_integrals_of_Gaussian_functions, but I'm not sure it contains what I need.

• $k=0$ or $n-k=0$ can yield analytical solutions: see stats.stackexchange.com/questions/61080. (See Dilip Sarwate's solution for a suggestive interpretation.) Nothing else does in general. You can of course expand $(1-\Phi)^k$ to reduce the integral to an alternating sum (for $k\gt 0$, $\mu=0$, $\sigma=1$). Would that count as a "closed form"? – whuber Oct 8 '17 at 14:21

One better reference for Gaussian integrals is "A table of normal integrals" by D. B. Owen, in Commun. Statist. Simulat. Computa. B9(4), 389-419, 1980. That reference includes a few very special cases of your integral, but nothing close to its generality. One very special case which yields simply is when $\mu=0, \sigma=1$ when the substitution $u=\Phi(x)$ reduces the integral to $$\int_0^1 u^{n-k} (1-u)^k \; du = \frac{k(n-k)B(k,n-k)}{n(1+n)}$$ where $B$ is the beta function. That could at least serve as a check on numerical solutions.
• +1 Good point about the Beta. You don't need to limit yourself to the definite integral: if one accepts the Beta CDF as a "closed form" (which seems reasonable to me), then the indefinite integral is also available in closed form. Conceivably, for small $|\mu/\sigma|$, this could serve as the beginning of a good approximation, too. – whuber Oct 8 '17 at 18:40
Let $X_1, X_2, \ldots, X_n, Y$ be independent normal random variables with $X_i \sim N(0,1)$ for $i = 1,2,\ldots, n$, and $Y \sim N(\mu, \sigma^2)$. Then, consider the probability that $k$ specified $X_i$ are larger than $Y$ and the remaining $n-k$ of the $X_i$ are smaller than $Y$. As a specific example, suppose that we wish to find the probability of the event $$\mathcal A =\big(X_1 > Y, X_2 > Y, \ldots, X_k > Y, X_{k+1} < Y, X_{k+2} < Y, \ldots, X_ n < Y\big).$$ Following the argument used in this answer of mine, we have that the conditional probability of $\mathcal A$ given that $Y = x$ is \begin{align}P(\mathcal A \mid Y = y) &= P(X_1>x, \ldots, X_k > x, X_{k+1} < y, \ldots, X_n < y \mid Y =x)\\&= P(X_1>x, \ldots, X_k > x, X_{k+1} < y, \ldots, X_n < y)\\ &= \prod_{i=1}^k P(X_i > y)\prod_{i=k+1}^n P(X_i < y)\\ &=[1-\Phi(x)]^{k}[\Phi(x)]^{n-k} \end{align} and so $$P(\mathcal A) = \int_{-\infty}^\infty [1-\Phi(x)]^{k}[\Phi(x)]^{n-k} \phi\left(\frac{x-\mu}{\sigma}\right)\,\mathrm dx.$$ There is no closed-form expression for this probability and there are no simple approximations that can be used except in special cases such as $k=0$ (cf. @whuber's comment).