# Calculate the expectation of a shift CDF

Suppose $X$ is a normal random variable with mean 0, and variance $\sigma^2$. $F(x)$ is the CDF(cumulative distribution function) of a standard normal random variable(mean 0 and variable 1), how to calculate the expectation of $F(X+a)$, where $a>0$.

This was a quant interview question. I know how to calculate the expectation of F(X), i.e when $a=0$, but I have no idea when $a \neq 0$.

My solution for $a=0$:

Method 1: Since F(x) is the CDF of a normal random variable with mean 0, and variance $\sigma^2$. We will have F(x)=1-F(-x). Suppose that f(x) is the corresponding pdf, and f(x)=f(-x). Then \begin{align} \mathbb{E}[F(X)]&=\int_{-\inf}^{+\inf} F(s)f(s)ds\\ &=\int_{-\inf}^{+\inf} (1-F(-s))f(s)ds\\ &=1-\int_{-\inf}^{+\inf} F(-s)f(s)ds\\ &=1-\int_{-\inf}^{+\inf} F(m)f(m)dm \end{align} Hence we have $$\int_{-\inf}^{+\inf} F(s)f(s)ds=\frac{1}{2}$$

Method 2(This method seems it didn't require that X is normal random variable): Let's first compute the distribution for $F(X)$: \begin{align} \mathbb{P}\{F(X) \leq y\}&=\mathbb{P}\{X \leq F^{-1}(y)\}\\ &=F\cdot F^{-1}(y)=y \end{align} So $F(X)$ is uniformly distributed, hence the mean is $\frac{1}{2}$.

• You say that you know how to calculate $E[F(X)]$, where $F$ is the distribution function of $F$, right? What is the trick. If you show us this, then we can work on $E[F(X+a)]$. – Ric Mar 12 '13 at 11:04
• Wait a moment. Isn't it true that $F(X)$ is uniform if $X$ has a continuous density. Therefore $E[F(X)] = 1/2$? I am not sure whether this helps us for $E[F(X+a)]$ ... – Ric Mar 12 '13 at 11:06
• @Richard I was thinking along the same line, but as you say I'm not sure how this will help us calculate the excpecation of F(X+a). However, I think this question should be asked in math.stackexchange? – Good Guy Mike Mar 12 '13 at 11:29
• I think the question fits for both as it could really be asked in a quant interview. In my mind it is ok. – Ric Mar 12 '13 at 12:32
• Wouldn't this just be positive drift? – jeff m Mar 12 '13 at 16:08

This leads to the same result as Alexeys answer. However, my reasoning is different. $$E[F_X(X+a)]=\int_{-\infty}^{\infty} F_X(x+a) f_X(x)dx=\int_{-\infty}^{\infty} \int_{-\infty}^{x+a}f_X(y)dy f_X(x)dx=\\ \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} 1_{(-\infty,x+a]}(y) f_X(y) f_X(x)dydx= \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} 1_{_{\{y-x\le a\}}}(y) f_X(y) f_X(x)dydx.$$

The product of the two densities in the integral is the density of a bivariate Gaussian vector (X,Y), whose components are independent and follow a normal distribution $N(\mu,\sigma^2)$. Hence this integral is the same as

$$E[1_{\{Y-X\le a\}}]=P[\{Y-X\le a\}],$$

where $Y,X$ are iid $N(\mu,\sigma^2)$. Thus $Y-X$ has a $N(0,2\sigma^2)$ distribution. We get

$$E[F_X(X+a)]=F_{Y-X}(a)=\Phi\left(\frac{a}{\sqrt{2}\sigma}\right).$$

• Great @Andreas, thanks for sharing this proof! – Ric Mar 18 '13 at 14:42

As you already mentioned you can get the CDF of this distribution using distribution transform:

$$P(F(X+a)\le y)=P(F^{-1}(F(X+a))\le F^{-1}(y))=P(X+a\le F^{-1}(y))=P(X\le F^{-1}(y)-a)=F(F^{-1}(y)-a)$$

Then you could write down expectation in integral form, but on the first glance it seems not so trivial how to get an explicit expression. Probably they didn't expect you to do this.

You can also try to run quick Monte-Carlo in R to see what your distribution looks like:

  a <- 1
sigma <- 2
m <- pnorm(rnorm(10000,0,sigma)+a,0,sigma)
hist(m)
plot(ecdf(m))
mean(m)


You will definitely see that it's not uniform for the values of $a$ that are significantly bigger than 0.

• All that I have tried ended up here too. Yes, maybe there is no (at least no easy) closed-form solution. The MC simulation persuades me ... – Ric Mar 13 '13 at 13:37

Hopefully this is correct...

So firstly, what is $F(X)$ when $X$ is a random variabel?

This is where I might be completely wrong, but at least it gives the correct answer in the case of a=0, so let's try that one first.

We have two random variables with the same normal distribution, mean 0 and sd $\sigma^2$. $X_1, X_2$

So we are supposed to calculate $F_{X_1}(X_2) = P(X_1 \leq X_2) = P(X_1 - X_2 \leq 0)$

Since both $X_1$ and $X_2$ are both normal we have that $X =X_1 - X_2$ is also normal with mean $0$ and s.d. $2\sigma^2$

So we have $P(X \leq 0)$ which is 1/2.

For the case of $a \neq 0$ we would get $P(X \leq a)$ which is $F_{X}(a)$. However it seems like it would always end up as a constant, so the expected value seems a bit 'redundant', which makes me think that this might not be the correct solution..

edit: Also, in $P(X \leq a)$ you could divide to get, since mean is 0, divide to get standard normal and you would get $\Phi(\frac{a}{\sqrt2sigma})$ or smth like that.

edit2:

sigma = 2;
n = 5000000;
a=5;
mean(normcdf(normrnd(0,sigma,1,n)+a,0,sigma))
normcdf(a/(sqrt(2)*sigma),0,1)

• It seems that you assume that $X_{1}$ and $X_{2}$ are independent, but we need to assume they are the same random variable. – nkhuyu Mar 12 '13 at 23:17
• If they are the same r.v. you would end up with $P(X_1 \leq X_1) =1$? I see that you provided the correct (?) proof, interesting, I'll look into that when I get home – Good Guy Mike Mar 13 '13 at 7:07
• @GoodGuyMike Sorry to say, but this looks too complicated. Alexey's approach in the other answer is more direct (I tried something similar). – Ric Mar 13 '13 at 13:38
• I tried simulating this in matlab, and it seems to work for $\sigma = 1$, otherwise it fails. Do you know why? – Good Guy Mike Mar 13 '13 at 15:48
• @nkhuyu are you sure they were asking for $F_X(X+a)$ instead of $F_{X+a}(X+a)$? That would require extra care in specification, instead of just saying $F(X+a)$ which should refer to the latter... One could infer from the level of other questions :-) – Quartz Mar 14 '13 at 10:29