02 - Stochastic Differential Equation - Part II

Some more examples of ito integrals.
quant-finance
ito-integral
stochastic-calculus
Author

Francois de Ryckel

Published

July 22, 2023

Modified

August 12, 2023

\(V(S)\) when S is a SDE - Itô III

Let \(V\) be a function of \(S\) where \(S\) satisfies the stochastic differential equation \(dS = \mu S \space dt + \sigma S \space dX(t)\) Note how in this case \(\mu\) and \(\sigma\) are constants. In more elaborate models, both can be time-dependent variables and be stochastic themselves.

Using a one-dimension Taylor Series expansion, we can write \[V(S + dS) \approx V(S) + \frac{dV}{dS} \space dS + \frac{1}{2} \frac{d^2V}{dS^2} \space dS^2\]

To express \(dS^2\)? \[dS^2 = (dS)^2 = \mu^2 S^2 \space dt^2 + 2 \mu \sigma S^2 \space dt dX(t) + \sigma^2 S^2 \space dX(t)^2\]

\[dS^2 = \sigma^2 S^2 \space dX(t)^2 = \sigma^2 S^2 \space dt \tag{1}\]

Tip

We could generalize this a bit further Let’s have a function \[dG_t = A(t, X_t) \space dt + B(t, X_t) \space dW_t\]

Then \[\mathbb{E}[dG_t] = \mathbb{E}[A \space dt] + \mathbb{E}[B \space dW_t] = A \space \mathbb{E}[dt] + B \space \mathbb{E}[dW_t]\]

Recall that \(\mathbb{E}[dW_t] = 0\), hence \[\mathbb{E}[dG_t] = A \space \mathbb{E}[dt]\] Considering the variance, we can write \[\mathbb{V}ar[dG_t] = \mathbb{V}ar[A \space dt] + \mathbb{V}ar[B \space dW_t] = A^2 \space \mathbb{V}ar[dt] + B^2 \space \mathbb{V}ar[dW_t] = B^2 \space dt\] Recall that \(\mathbb{V}ar[dt] = 0\), hence \[\mathbb{V}ar[dG_t] = B^2 \space \mathbb{V}ar[dW_t]\]

Going back to our expansion and considering \(dV = V(S+dS) - V(S)\): \[dV = \frac{dV}{dS} \space (\mu S \space dt + \sigma S \space dX(t)) + \frac{1}{2} \frac{d^2V}{dS^2} \space (\sigma^2 S^2 \space dt)\] \[dV = \left( \mu S \frac{dV}{dS} + \frac{1}{2} \sigma^2 S^2 \frac{d^2V}{dS^2} \right) \cdot dt + \left( \sigma S \frac{dV}{dS} \right) \cdot dX(t) \tag{2}\]

Example

Let \(V(S) = log(S)\) with S satisfies the usual SDE: \(dS = \mu S dt + \sigma S dX_t\). We can then use the above SDE form.

\[\frac{dV}{dS} = \frac{1}{S}\] \[\frac{d^2V}{dS^2} = - \frac{1}{S^2}\]

Using above Equation 2: \[dV = \left( \mu S \frac{1}{S} + \frac{1}{2} \sigma^2 S^2 \frac{-1}{S^2} \right) \cdot dt + \left( \sigma S \frac{1}{S} \right) \cdot dX(t)\] \[dV = \left( \mu - \frac{1}{2} \sigma^2 \right) \cdot dt + \sigma \cdot dX(t)\] Using the integral form:

\[\int_0^t d(log \space S) = \int_0^t \mu - \frac{1}{2} \sigma^2 \space d\tau + \int_0^t \sigma \space dX(\tau)\] \[log(S_t) - log(S_0) = \mu t - \frac{1}{2} \sigma^2 t + \sigma (X_t - X_0)\] \[log \left( \frac{S_t}{S_0} \right) = \mu t - \frac{1}{2} \sigma^2 t + \sigma (X_t - X_0)\] \[S_t = S_0 \cdot e^{\mu t - \frac{1}{2} \sigma^2 t + \sigma (X_t - X_0)}\]

Using \(X_0 = 0\) and \(X_t = \phi \sqrt{t}\): \[S_t = S_0 \cdot e^{\mu t - \frac{1}{2} \sigma^2 t + \sigma \phi \sqrt{t}}\]

Another example with interest rate

Vasicek model

This model developed in 1978 by Vasicek is about interest rate.

The basic SDE takes this form \[dr = (\eta - \gamma r) dt + \sigma dX \tag{3}\] In this model, \(\eta\), \(\gamma\) and \(\sigma\) are all constant.

  • \(\gamma\) is the speed of reversion to the (long term) mean rate. It’s the rate of reversion.
  • we demote \(\bar{r}\) the mean interest rate such that \(\bar{r} = \frac{\eta}{\gamma}\)

\[dr = \gamma (\bar{r} - r) \space dt + \sigma \space dX \tag{4}\]

If we let \(u = r - \bar{r}\), then \(du = dr\) because we consider \(\bar{r}\) as a constant. Hence \[du = - \gamma u \space dt + \sigma dX\] \[du + \gamma u dt = \sigma dX\]
\[e^{\gamma t} du + \gamma u e^{\gamma t} dt = e^{\gamma t} \sigma dX\] \[d(u e^{\gamma t}) = \sigma e^{\gamma t} dX\] \[\int_0^t d(u_s e^{\gamma s}) = \sigma \int_0^t e^{\gamma s} dX_s\] \[u(t) e^{\gamma t} - u(0) = \sigma \int_0^t e^{\gamma s} dX_s\] \[u(t) = u(0) e^{-\gamma t} + \sigma \int_0^t e^{\gamma (s - t)} dX_s\]

\(V(t, S)\) when S is a SDE - Itô IV

This time \(V\) is a function of both time \(t\) and \(S\) which satisfies the usual SDE: \(dS = \mu S dt + \sigma S dX_t\)

We can also do a Taylor Series expansion on this. And recall Equation 1 when dealing with \(dS^2\)

\[V(S + dS, t + dt) \approx V(S, t) + \frac{\partial V}{\partial S} dS + \frac{\partial V}{\partial t} dt + \frac{1}{2} \frac{\partial^2 V}{\partial S^2} dS^2\] \[V(S + dS, t + dt) - V(S, t) \approx \frac{\partial V}{\partial S} dS + \frac{\partial V}{\partial t} dt + \frac{1}{2} \frac{\partial^2 V}{\partial S^2} \sigma^2 S^2 dt\]

\[dV = \left( \frac{\partial V}{\partial t} + \frac{1}{2} \frac{\partial^2 V}{\partial S^2} \sigma^2 S^2 \right) dt + \frac{\partial V}{\partial S} dS\]

\[dV = \left( \frac{\partial V}{\partial t} + \frac{1}{2} \frac{\partial^2 V}{\partial S^2} \sigma^2 S^2 \right) dt + \frac{\partial V}{\partial S} (\mu S dt + \sigma S dX_t)\] \[dV = \left( \frac{\partial V}{\partial t} + \frac{1}{2} \frac{\partial^2 V}{\partial S^2} \sigma^2 S^2 + \mu S \frac{\partial V}{\partial S} \right) dt + \sigma S \frac{\partial V}{\partial S} dX_t \tag{5}\]

Transition probabilty function as ODE

For background on the transition probability function, check this post

Recall from the above linked post that \(y, t\) are current state and \(y', t'\) are future values.
The transition probabilty function was expressed as a partial differential equation of the form \(\frac{\partial P}{\partial t'} = C^2 \frac{\partial^2 P}{\partial y'^2}\) which was the FKE.

In the case of our usual Stochastic Differential Equation, which we write under a more general form like \[dY = A(y, t) \space dt + B(y, t) \space dW_t\] We can find that the transition probability function satisfies the following Partial differential equation: \[\frac{\partial P}{\partial t'} = \frac{1}{2} \frac{\partial^2 \left(B(y', t')^2 p \right)}{\partial y'^2} - \frac{\partial \left( A(y', t') p \right)}{\partial y'} \tag{6}\]

In our financial model, we’ll apply Equation 6 with the usual SDE \(dS=\mu S \space dt+\sigma S \space dW_t\). Remember that \(\mu\) and \(\sigma\) are constant here.

\[\frac{\partial P}{\partial t'} = \frac{1}{2} \frac{\partial^2 (\sigma^2 S'^2 p)}{\partial S'^2} - \frac{\partial (\mu S' p)}{\partial S'}\]

The solution to this partial differential equation has been developed in the trinomial post:

\[p(S, t; S', t') = \frac{1}{\sigma S' \sqrt{2 \pi (t'-t)}} e^{\frac{-log\left( \frac{S}{S'} \right) + (\mu + \frac{1}{2} \sigma^2)}{2 \sigma^2(t'-t)}} \tag{7}\]

Steady-state

In some case, there are situation (random-walk) with a long term mean reversal - we say that they have a steady state distribution. This means that in the long run, the \(p(y, t; y', t')\) doesn’t depend of the starting point \(y, t\); the probability becomes time independent. Think of situations such as interest rate and volatility.

In the case of a steady state situation, \(\frac{\partial P}{\partial t'} = 0\) since the process becomes time independent in the long run. And the probability (now written $p_{} (y’) $) satisfies the ordinary differential equation: \[\frac{1}{2} \frac{d \left(B(y')^2 p_{\infty} \right)}{d y'^2} - \frac{d \left( A(y') p_{\infty} \right)}{d y'} = 0 \tag{8}\] It isn’t anymore a partial differential equation as the time component vanishes (aka steady-state, long-term reversal)

Vasicek revisited

Recall from above the Vasicek model \[dr = \gamma (\bar{r} - r) \space dt + \sigma \space dW_t\] Using Equation 8, we can write the steady state distribution \(p_{\infty} r'\) following ordinary differential equation. \[\frac{1}{2} \sigma^2 \frac{d^2 p_{\infty} }{d r'^2} - \gamma \frac{d( \left(\bar{r} - r) p_{\infty} \right)}{d r'} = 0\] Integrating both sides, we get: \[\frac{1}{2} \sigma^2 \frac{d p_{\infty} }{d r'} + \gamma (r - \bar{r}) p_{\infty} = K\] K being a constant. \[\frac{1}{2} \sigma^2 \frac{d p_{\infty} }{d r'} = - \gamma (r - \bar{r}) p_{\infty} + K\] Letting the constant be 0 (need explanation here) Letting the \({\infty}\) just for convenience purposes.

\[\frac{1}{p} dp = \frac{-2 \gamma}{\sigma^2} (r - \bar{r}) \space dr'\] Integrating both sides, \[\int \frac{1}{p} dp = \frac{-2 \gamma}{\sigma^2} \int (r - \bar{r}) \space dr'\] \[log(p) = \frac{-2 \gamma}{\sigma^2} \frac{1}{2} (r - \bar{r})^2 + K\] Using a normalizing constant, as we inverse the log \[p(r) = A \cdot e^{- \frac{\gamma}{\sigma^2} (r - \bar{r})^2} \tag{9}\]

We know that \(\int_{\mathbb{R}} p(r) dr= 1\), hence \[A \int_{-\infty}^{\infty} e^{- \frac{\gamma}{\sigma^2} (r - \bar{r})^2} dr = 1\] We can integrate this using substitution \(u = \frac{\sqrt{\gamma} \space (r - \bar{r})}{\sigma}\) with \(\frac{du}{dr} = \frac{\sqrt{\gamma}}{\sigma}\) \[A \int_{-\infty}^{\infty} e^{-u^2} \frac{\sigma}{\sqrt{\gamma}} du = 1\] \[A \frac{\sigma}{\sqrt{\gamma}} \int_{-\infty}^{\infty} e^{-u^2} du = 1\] \[A \frac{\sigma}{\sqrt{\gamma}} \sqrt{\pi} = 1\] \[A = \frac{\sqrt{\gamma}}{\sigma \sqrt{\pi}} = \frac{1}{\sigma} \sqrt{\frac{\gamma}{\pi}}\]

Putting it all back together in Equation 9: \[p_{\infty}(r) = A \cdot e^{- \frac{\gamma}{\sigma^2} (r - \bar{r})^2} = \frac{1}{\sigma} \sqrt{\frac{\gamma}{\pi}} e^{- \frac{\gamma}{\sigma^2} (r - \bar{r})^2}\] This means: in our case of a steady state stochastic process, the variable \(r\) follows a normal distribution with mean \(\bar{r}}\) and standard deviation \(\frac{\sigma}{\sqrt{2 \cdot \gamma}}\)

\(V(t, S_1, S_2)\) Modeling correlated random walks

We have now 2 assets

\[\begin{equation} \begin{cases} dS_1 = \mu_1 S_1 \space dt + \sigma_1 S_1 \space dX_1 \\ dS_2 = \mu_2 S_2 \space dt + \sigma_2 S_2 \space dX_2 \end{cases} \end{equation} \]

Using a Taylor series expansion \[V(t+dt, S_1+dS_1, S_2+dS_2) \approx V(t, S1, S2) + \frac{\partial V}{\partial t} dt + \frac{\partial V}{\partial S_1} dS_1 + \frac{\partial V}{\partial S_2} dS_2 + \frac{1}{2} \frac{\partial^2 V}{\partial S_1^2} dS_1^2 + \frac{1}{2} \frac{\partial^2 V}{\partial S_2^2} dS_2^2 + \frac{\partial^2 V}{\partial S_1 \partial S_2} dS_1 dS_2\] \[dV = \frac{\partial V}{\partial t} dt + \frac{\partial V}{\partial S_1} dS_1 + \frac{\partial V}{\partial S_2} dS_2 + \frac{1}{2} \frac{\partial^2 V}{\partial S_1^2} dS_1^2 + \frac{1}{2} \frac{\partial^2 V}{\partial S_2^2} dS_2^2 + \frac{\partial^2 V}{\partial S_1 \partial S_2} dS_1 dS_2 \tag{10}\]

Now we can write down some results we’ll plug into that expansion

  • \(dS_i = \mu_i S_i \space dt + \sigma_i S_i \space dX_i\)
  • Using Equation 1, we write \(dS_i^2 = \sigma_i^2 S_i^2 dt\)
  • Letting \(\mathbb{E}[\phi_1 \phi_2] = \rho\), we write \(\mathbb{E}[dX_1 dX_2] = \mathbb{E}[\phi_1 \sqrt{dt} \phi_2 \sqrt{dt}] = \rho \space dt\)
  • Recall that all terms less than dt = 0. Hence in the product \(dS_1 dS_2 = (\mu_1 S_1 \space dt + \sigma_1 S_1 \space dX_1)(\mu_2 S_2 \space dt + \sigma_2 S_2 \space dX_2)\), the only term that we are considering is the outter product \(\sigma_1 S_1 \space dX_1 \sigma_2 S_2 \space dX_2\). Finally, re-using above result, \(dS_1 dS_2 = \rho \sigma_1 \sigma_2 S_1 S_2 dt\).

Re-writing Equation 10 by substituting \(dS_1\) and \(dS_2\), and factoring the terms in dt and those in \(dX_t\), we get: \[dV = \left( \frac{\partial V}{\partial t} + \mu_1 S_1\frac{\partial V}{\partial S_1} + \mu_2 S_2 \frac{\partial V}{\partial S_2} + \sigma_1^2 S_1^2 \frac{\partial^2 V}{\partial S_1^2} + \sigma_2^2 S_2^2 \frac{\partial^2 V}{\partial S_2^2} + \rho \sigma_1 \sigma_2 S_1 S_2 \frac{\partial^2 V}{\partial S_1 \partial S_2} \right) dt + \left( \sigma_1 S_1\frac{\partial V}{\partial S_1} dX_1 + \sigma_2 S_2\frac{\partial V}{\partial S_2} dX_2 \right)\]

Itô