For a normally distributed $X$ (with mean zero and variance $\sigma^2$) and a constant $Y$, I need to know
$\mathbb{E}(\max(X-Y,0))$
I think that this should be $\mathbb{P}(X<Y)\times 0 + \mathbb{P}(X>Y)\times \mathbb{E}(X-Y|X>Y))$
I know $\mathbb{P}(X>Y)$ is $\Phi(-Y)=1-\Phi(Y)$ for a normal cdf $\Phi(\cdot)$
I'm guessing that $\mathbb{E}(X-Y|X>Y))=\mathbb{E}(X|X>Y))-Y$
I don't know what $\mathbb{E}(X|X>Y))$ is.
Presumably it is something like $(\int_y^\infty x \Phi(x) dx)/(1-\Phi(Y))$.
But is there a nice answer, like, something that can be typed into R?
(This is not homework!)
$$E((X-x)^+)=\sigma\int_{x/\sigma}^\infty(t-x)\,\varphi(t)\,\mathrm dt=\sigma\cdot\varphi(x/\sigma)-x\cdot(1-\Phi(x/\sigma))$$