Derivatives of Brownian motion or Box Options Greeks

Here's the probability (I think) that a particle in Brownian motion (w/ standard deviation $\sqrt{t}$) will exceed $m$ between times $t_1$ and $t_2$:

$$\frac1{2\sqrt{2\pi}}\int_{-\infty }^m \frac1{\sqrt{t_1}}e^{-\frac{x^2}{2t_1}}\left(1+\mathrm{erf}\left(\frac{m-x}{2\sqrt{t_2-t_1}}\right)\right)\mathrm{d}x$$

or, in Mathematica (slightly different form):

p[m_,t1_,t2_] := Integrate[
PDF[NormalDistribution[0,Sqrt[t1]]][x]*
CDF[NormalDistribution[x, Sqrt[2]*Sqrt[t2-t1]]][m],
{x,-Infinity,m}, Assumptions -> {
t2 >= t1 >= 0, Element[m,Reals], Element[t2, Reals], Element[t1, Reals]}
]


Mathematica can numerically integrate this for specific values of m, t1, and t2, but it's not superfast.

I now want to find the partial derivatives of p[] with respect to each of its variables. Ideally in closed-form (Mathematica can't find one), but a good approximation if not.

I've tried power series and a few other techniques, but I've found nothing good enough for a wide range of values for m, t1, and t2.

Solving this problem will calculate the "Greeks" for box options:

http://money.stackexchange.com/questions/4312/calculating-fair-value-of-an-oanda-com-box-option

-
Perhaps, there is something wrong in your expression for that probability. I will post an answer soon. –  Shai Covo Nov 18 '10 at 23:38
You do know the error function is built-in in Mathematica as Erf[]? –  Ｊ. Ｍ. Nov 19 '10 at 0:22
Yes, I used Mathematica to generate the TeX. I'm not sure why I didn't use it in the Mathematica code, but it shouldn't affect Mathematica's ability to integrate. –  barrycarter Nov 19 '10 at 17:42
add comment

1 Answer

In view of your previous post, the probability you are considering is actually $$\bar P(m,t_1,t_2) = 1 - \frac{1}{{\sqrt {2\pi t_1 } }}\int_{ - \infty }^m {{\rm erf}\bigg(\frac{{m - x}}{{2\sqrt {t_2 - t_1 } }}\bigg)e^{ - x^2 /(2t_1 )} {\rm d}x},\;\; m \in {\bf R}.$$ This is the complement of the probability considered in your previous post. So, we may consider instead the partial derivatives of $$P(m,t_1,t_2) = \frac{1}{{\sqrt {2\pi t_1 } }}\int_{ - \infty }^m {{\rm erf}\bigg(\frac{{m - x}}{{2\sqrt {t_2 - t_1 } }}\bigg)e^{ - x^2 /(2t_1 )} {\rm d}x}.$$ Now, erf(x) has derivative ${\rm erf}'(x)= \frac{2}{{\sqrt \pi }}e^{ - x^2 }$, $x > 0$. Then, the partial derivative with respect to $t_2$ is obtained as follows: $$\frac{{\partial}}{{\partial t_2 }}P(m,t_1 ,t_2 ) = \frac{1}{{\sqrt {2\pi t_1 } }}\int_{ - \infty }^m {\frac{\partial }{{\partial t_2 }}{\rm erf}\bigg(\frac{{m - x}}{{2\sqrt {t_2 - t_1 } }}\bigg)e^{ - x^2 /(2t_1 )} {\rm d}x},$$ and explicitly, $$\frac{{\partial}}{{\partial t_2 }}P(m,t_1 ,t_2 ) = \frac{{ - 1}}{{\sqrt {8 \pi ^2 t_1 (t_2 - t_1 )^3 } }}\int_{ - \infty }^m {\exp \bigg[ - \frac{{(m - x)^2 }}{{4(t_2 - t_1 )}} - \frac{{x^2 }}{{2t_1 }}\bigg](m - x){\rm d}x}.$$ (The probability that the maximum is smaller than $m$ decreases as $t_2$ increases, hence the minus sign in this equation.) To find the partial derivative with respect to $m$ corresponds to taking the derivative of a convolution, according to the rule $(f * g)' = f' * g$. Specifically, this says that $$\frac{{\partial}}{{\partial m }}P(m,t_1 ,t_2 ) = \frac{1}{{\sqrt {2\pi t_1 } }}\int_{ - \infty }^m {\frac{\partial }{{\partial m }}{\rm erf}\bigg(\frac{{m - x}}{{2\sqrt {t_2 - t_1 } }}\bigg)e^{ - x^2 /(2t_1 )} {\rm d}x},$$ and explicitly, $$\frac{{\partial}}{{\partial m }}P(m,t_1 ,t_2 ) = \frac{{1}}{{\sqrt {2 \pi ^2 t_1 (t_2 - t_1 ) } }}\int_{ - \infty }^m {\exp \bigg[ - \frac{{(m - x)^2 }}{{4(t_2 - t_1 )}} - \frac{{x^2 }}{{2t_1 }}\bigg]{\rm d}x}.$$ Maybe you can simplify further. The partial derivative with respect to $t_1$ is apparently a quite complicated expression.

-
The partial derivative with respect to $m$ is equivalent to $\frac{m^2}{\sqrt{2\pi(2t_2-t_1)}}\exp\left(-\frac{m^2}{2(2t_2-t_1)}\right)\left‌​(1+\mathrm{erf}\left(m\sqrt{\frac{t_2-t_1}{t_1(2t_2-t_1)}}\right)\right)$ . The other one looks quite complicated. –  Ｊ. Ｍ. Nov 19 '10 at 2:36
Elegant expression! Thank you. –  Shai Covo Nov 19 '10 at 3:04
Thanks! I'd actually been looking at the CDF for m, so meant to say "less than or equal to m", but you are correct. I wonder if that's any way to coerce Mathematica into coming up with this answer. –  barrycarter Nov 19 '10 at 17:55
Since I can scale my time unit, I'm wondering if I can set t1 to 1 without loss of generality, hmm... (or t2-t1 to one, and leaving t1 arbitrary) –  barrycarter Nov 19 '10 at 20:14
OK, I think I'm confused by the @/@m derivative, since m is a limit of the integral. Would the fundamental theorem of calculus apply? –  barrycarter Nov 19 '10 at 20:26
show 3 more comments