Stochastic Processes#

A pricing model is a description of how a price or a rate moves through time. This page sets out the processes that most models are built from, what each one is used for, and how each can be simulated exactly when its distribution is known. SDE Discretisation: Euler & Milstein then covers the case where it is not.

Brownian motion#

A Brownian motion (or Wiener process) \(W_t\) starts at zero, has independent increments, and the increment over a period \(\Delta t\) is normal with mean zero and variance \(\Delta t\). Its paths are continuous and nowhere smooth, and the variance grows in proportion to time, so the spread grows with the square root of time. It is the source of randomness in almost every model below.

Processes driven by it#

The basic processes#

Process

Stochastic differential equation

Terminal distribution

Used for

Arithmetic Brownian motion

\(dX = \mu \, dt + \sigma \, dW\)

Normal

Rates and spreads that can be negative. The Bachelier model of Interest Rate Volatility, Part 2: The Bachelier (Normal) Model.

Geometric Brownian motion

\(dS = \mu S \, dt + \sigma S \, dW\)

Lognormal

Stock prices, FX rates, forwards. The Black-Scholes model.

Ornstein-Uhlenbeck

\(dX = a(\theta - X) \, dt + \sigma \, dW\)

Normal

Mean-reverting quantities. The state variable of the Hull-White model in Interest Rate Mean Reversion, Part 2: The Hull-White Model & Calibration.

Cox-Ingersoll-Ross

\(dv = \kappa(\theta - v) \, dt + \xi \sqrt{v} \, dW\)

Non-central chi-squared

Variances and intensities that must stay positive. The variance of the Heston model, and credit intensities.

Poisson process

Jumps of size 1 at rate \(\lambda\)

Poisson

Counts of events: defaults, jumps.

Jump-diffusion (Merton)

GBM plus lognormal jumps at rate \(\lambda\)

A Poisson mixture of lognormals

Skew and fat tails in short-dated options.

Geometric Brownian motion#

Applying Itô’s lemma to \(\ln S\) gives the exact solution:

\[S_T = S_0 \exp\left[ \left(\mu - \tfrac{1}{2}\sigma^2\right) T + \sigma W_T \right]\]

The term \(-\tfrac{1}{2}\sigma^2\) is the Itô correction. It makes the mean \(S_0 e^{\mu T}\) and not \(S_0 e^{(\mu + \sigma^2/2) T}\), and leaving it out is a common coding error. Pricing uses the risk-neutral drift, \(\mu = r\).

Mean reversion#

The Ornstein-Uhlenbeck process is pulled back to the level \(\theta\) at the speed \(a\). Its variance approaches a limit, \(\sigma^2 / 2a\), and does not grow without bound. The speed \(a\) is the mean reversion of Interest Rate Mean Reversion, where its effect on the price of a Bermudan swaption is measured.

The square-root process#

The CIR process stays positive if \(2\kappa\theta \ge \xi^2\), which is the Feller condition. When the condition fails the process can touch zero, and a numerical scheme that is not designed for this can produce negative variances. SDE Discretisation: Euler & Milstein shows this.

Jumps#

A diffusion cannot produce a sudden large move. A jump process adds one. In the Merton model the jumps are lognormal, and the drift is reduced by \(\lambda k\), where \(k\) is the mean jump size, so that the mean of the stock is unchanged. The log return then has negative skew, if the mean jump is negative, and excess kurtosis. Lévy processes, such as the variance gamma process of Transform Methods, Part 1: Characteristic Functions, generalise this with many small jumps.

Worked example#

The example draws a million terminal values of each process at \(T = 2\) from its exact distribution, and compares the sample mean and variance with the theoretical values.

Python code
"""Exact simulation of the basic processes, with the sample mean and variance of the terminal value against theory."""
import numpy as np
from scipy.stats import ncx2

rng = np.random.default_rng(2024)
N, T = 1_000_000, 2.0


def row(name, theory_mean, theory_var, sample):
    print(f"{name:<30} mean {theory_mean:10.5f} {sample.mean():10.5f}   variance {theory_var:10.5f} {sample.var():10.5f}")


if __name__ == "__main__":
    print(f"{N:,} draws of the value at T = {T}. For each process: theory, then sample.\n")
    w = np.sqrt(T) * rng.standard_normal(N)
    row("Brownian motion", 0.0, T, w)

    mu, sigma, x0 = 0.05, 0.20, 100.0
    s = x0 * np.exp((mu - 0.5 * sigma**2) * T + sigma * w)
    row("Geometric Brownian motion", x0 * np.exp(mu * T), x0**2 * np.exp(2 * mu * T) * (np.exp(sigma**2 * T) - 1), s)

    sigma_n = 1.0
    row("Arithmetic Brownian motion", x0 + mu * T, sigma_n**2 * T, x0 + mu * T + sigma_n * w)

    a, theta, sigma_ou, x0_ou = 1.5, 0.04, 0.02, 0.01
    sd = sigma_ou * np.sqrt((1 - np.exp(-2 * a * T)) / (2 * a))
    ou = x0_ou * np.exp(-a * T) + theta * (1 - np.exp(-a * T)) + sd * rng.standard_normal(N)
    row("Ornstein-Uhlenbeck", theta + (x0_ou - theta) * np.exp(-a * T), sd**2, ou)

    kappa, theta_c, xi, v0 = 2.0, 0.04, 0.30, 0.09
    c = xi**2 * (1 - np.exp(-kappa * T)) / (4 * kappa)
    dof, nc = 4 * kappa * theta_c / xi**2, v0 * np.exp(-kappa * T) / c
    cir = c * ncx2.rvs(dof, nc, size=N, random_state=rng)
    mean_c = theta_c + (v0 - theta_c) * np.exp(-kappa * T)
    var_c = (v0 * xi**2 / kappa * (np.exp(-kappa * T) - np.exp(-2 * kappa * T))
             + theta_c * xi**2 / (2 * kappa) * (1 - np.exp(-kappa * T)) ** 2)
    row("Cox-Ingersoll-Ross", mean_c, var_c, cir)
    print(f"{'':<30} Feller: 2 kappa theta = {2 * kappa * theta_c:.3f}, xi^2 = {xi**2:.3f}, "
          f"so the CIR process {'cannot' if 2 * kappa * theta_c >= xi**2 else 'can'} reach zero")

    lam = 0.8
    row("Poisson, intensity 0.8", lam * T, lam * T, rng.poisson(lam * T, N).astype(float))

    # Merton jump-diffusion: lognormal jumps, with the drift reduced so that the mean of S is unchanged.
    lam, m_j, s_j = 0.8, -0.10, 0.15
    k = np.exp(m_j + 0.5 * s_j**2) - 1
    n_jumps = rng.poisson(lam * T, N)
    jumps = m_j * n_jumps + s_j * np.sqrt(n_jumps) * rng.standard_normal(N)
    s_jd = x0 * np.exp((mu - 0.5 * sigma**2 - lam * k) * T + sigma * w + jumps)
    print(f"{'Merton jump-diffusion':<30} mean {x0 * np.exp(mu * T):10.5f} {s_jd.mean():10.5f}   "
          f"(jumps compensated, so the mean is that of GBM)")
    print(f"{'':<30} skew of log return {np.mean(((np.log(s_jd / x0) - np.log(s_jd / x0).mean()) / np.log(s_jd / x0).std()) ** 3):+.3f}, "
          f"excess kurtosis {np.mean(((np.log(s_jd / x0) - np.log(s_jd / x0).mean()) / np.log(s_jd / x0).std()) ** 4) - 3:+.3f} "
          f"(GBM: 0 and 0)")

The output is:

1,000,000 draws of the value at T = 2.0. For each process: theory, then sample.

Brownian motion                mean    0.00000    0.00120   variance    2.00000    2.00385
Geometric Brownian motion      mean  110.51709  110.55126   variance 1017.27054 1019.45767
Arithmetic Brownian motion     mean  100.10000  100.10120   variance    2.00000    2.00385
Ornstein-Uhlenbeck             mean    0.03851    0.03851   variance    0.00013    0.00013
Cox-Ingersoll-Ross             mean    0.04092    0.04098   variance    0.00094    0.00094
                               Feller: 2 kappa theta = 0.160, xi^2 = 0.090, so the CIR process cannot reach zero
Poisson, intensity 0.8         mean    1.60000    1.59940   variance    1.60000    1.59774
Merton jump-diffusion          mean  110.51744  (jumps compensated, so the mean is that of GBM)
                               skew of log return -0.264, excess kurtosis +0.293 (GBM: 0 and 0)

Reading the output:

  • Every sample matches its theory to the accuracy that a million draws allow. A check of this kind on the mean and the variance is the first test of any simulator.

  • The jump-diffusion has the same mean as GBM because the jumps are compensated, but the log return is skewed to the left and has fat tails. Two models with the same mean can give very different option prices away from the money.

  • The CIR and OU variables are simulated exactly, from the non-central chi-squared and normal distributions. No time-stepping is needed, and so there is no discretisation error.

A valuation control view#

  • Know which process a trade is priced with, and why: a lognormal model cannot handle a negative rate, a normal model can produce a negative price for a stock. The choice must suit the underlying. See Interest Rate Volatility, Part 2: The Bachelier (Normal) Model.

  • Check the drift: under the risk-neutral measure the discounted price of a traded asset is a martingale. A simulated forward that does not equal the market forward points to a wrong drift or a missing Itô correction.

  • Check the Feller condition and the parameters of a variance process: calibrated parameters often violate it, and then the choice of numerical scheme matters.

  • Use exact distributions where they exist: they remove the discretisation error, and a simulator that uses them is a clean benchmark for one that does not.

  • Test the moments of the simulator: the sample mean and variance of every state variable against the formulas above, as in the example, is a short test that catches most coding errors.

Next, SDE Discretisation: Euler & Milstein covers processes that have no exact solution.