Monte Carlo, Part 4: Greeks#
A price is not enough for risk management. The Greeks, which are the derivatives of the price with respect to the inputs, give the hedge and the sensitivity of a book. By simulation they are harder to get than the price, and the choice of method matters. This is the last of four pages on Monte Carlo. It compares bump-and-revalue, pathwise derivatives and the likelihood ratio method, and shows where each fails.
Bump and revalue#
The simplest method reprices after a small change of an input and takes the difference:
There are two choices that decide whether this works.
The random numbers. If the two prices use independent draws, the noise of each remains in the difference, and dividing by a small \(h\) multiplies it. If they use the same draws (common random numbers), most of the noise cancels, because both prices see the same paths. This is almost always the right choice.
The size of the bump. A large bump has a bias from the curvature of the price, about \(\tfrac{1}{2}\Gamma h\) for a forward difference. A small bump has little bias and more noise, and for a payoff with a jump the noise rises as the bump falls. A central difference has a smaller bias. The balance between the bias of a large bump and the round-off of a small one, and the complex step, are set out in Numerical Differentiation.
Pathwise derivatives#
If the payoff is a smooth function of the inputs along each path, differentiate it path by path and average. For the call, \(S_T = S_0 e^{(r - \sigma^2/2)T + \sigma\sqrt{T}Z}\), so \(\partial S_T / \partial S_0 = S_T/S_0\) and
The method has no bias and low noise, and it needs one simulation for all the sensitivities. It fails when the payoff is not continuous, such as a digital option or a barrier, because the derivative of a jump is zero almost everywhere and the whole sensitivity sits at one point that the paths do not hit.
Likelihood ratio#
Instead of differentiating the payoff, differentiate the density of the paths, which is smooth even when the payoff is not. For the delta of a payoff that depends on \(S_T\):
It works for any payoff, including digitals, and the same Brownian draw gives the second derivative. Its variance is higher than the pathwise method for smooth payoffs, and it grows as the time step shrinks in a path-dependent product, since every step adds a term.
Worked example#
The example computes the delta, gamma and vega of the benchmark call with 400,000 paths by each method, against the exact Black-Scholes values, and then the delta of a digital call, whose payoff is 1 if the stock ends above the strike.
Python code
"""Monte Carlo Greeks: bump and revalue, pathwise derivatives and the likelihood ratio method."""
import numpy as np
from scipy.stats import norm
from common import K, R, S0, SIGMA, T, bs_greeks
DISC = np.exp(-R * T)
SQT = np.sqrt(T)
N = 400_000
def terminal(z, s0=S0, sigma=SIGMA):
return s0 * np.exp((R - 0.5 * sigma**2) * T + sigma * SQT * z)
def stats(x):
return x.mean(), x.std(ddof=1) / np.sqrt(len(x))
def row(name, value, exact):
est, se = value
print(f"{name:<34} {est:11.5f} {se:9.5f} {est - exact:+10.5f}")
if __name__ == "__main__":
rng = np.random.default_rng(3)
delta, gamma, vega = bs_greeks()
z = rng.standard_normal(N)
st = terminal(z)
call = DISC * np.maximum(st - K, 0)
dS, dV = 1.0, 0.01
print(f"Call, {N:,} paths. Exact: delta {delta:.5f}, gamma {gamma:.5f}, vega {vega:.4f}\n")
print(f"{'Delta':<34} {'Estimate':>11} {'Std error':>9} {'Error':>10}")
# Bump and revalue with separate random numbers for each revaluation.
z2 = rng.standard_normal(N)
row("Bump, independent draws", stats((DISC * np.maximum(terminal(z, S0 + dS) - K, 0) - DISC * np.maximum(terminal(z2) - K, 0)) / dS), delta)
row("Bump, same draws", stats((DISC * np.maximum(terminal(z, S0 + dS) - K, 0) - call) / dS), delta)
row("Pathwise", stats(DISC * (st > K) * st / S0), delta)
row("Likelihood ratio", stats(call * z / (S0 * SIGMA * SQT)), delta)
print(f"\n{'Gamma':<34} {'Estimate':>11} {'Std error':>9} {'Error':>10}")
up, down = DISC * np.maximum(terminal(z, S0 + dS) - K, 0), DISC * np.maximum(terminal(z, S0 - dS) - K, 0)
row("Bump, same draws, central", stats((up - 2 * call + down) / dS**2), gamma)
row("Likelihood ratio", stats(call * ((z**2 - 1) / (S0**2 * SIGMA**2 * T) - z / (S0**2 * SIGMA * SQT))), gamma)
print(f"\n{'Vega (per 1.00 of volatility)':<34} {'Estimate':>11} {'Std error':>9} {'Error':>10}")
row("Bump, same draws", stats((DISC * np.maximum(terminal(z, sigma=SIGMA + dV) - K, 0) - call) / dV), vega)
row("Pathwise", stats(DISC * (st > K) * st * (z * SQT - SIGMA * T)), vega)
# A digital call pays 1 above the strike. Its payoff has a jump, so the pathwise derivative is zero.
d2 = (np.log(S0 / K) + (R - 0.5 * SIGMA**2) * T) / (SIGMA * SQT)
digital_delta = DISC * norm.pdf(d2) / (S0 * SIGMA * SQT)
digital = DISC * (st > K)
print(f"\nDigital call, exact delta {digital_delta:.5f}")
print(f"{'Delta':<34} {'Estimate':>11} {'Std error':>9} {'Error':>10}")
row("Pathwise (derivative of payoff is 0)", stats(np.zeros(N)), digital_delta)
row("Bump, same draws, bump 1.0", stats((DISC * (terminal(z, S0 + dS) > K) - digital) / dS), digital_delta)
row("Bump, same draws, bump 0.1", stats((DISC * (terminal(z, S0 + 0.1) > K) - digital) / 0.1), digital_delta)
row("Likelihood ratio", stats(digital * z / (S0 * SIGMA * SQT)), digital_delta)
The output is:
Call, 400,000 paths. Exact: delta 0.59871, gamma 0.01933, vega 38.6668
Delta Estimate Std error Error
Bump, independent draws 0.63516 0.03212 +0.03645
Bump, same draws 0.60859 0.00092 +0.00988
Pathwise 0.59919 0.00093 +0.00048
Likelihood ratio 0.60062 0.00223 +0.00191
Gamma Estimate Std error Error
Bump, same draws, central 0.01911 0.00017 -0.00022
Likelihood ratio 0.01938 0.00021 +0.00005
Vega (per 1.00 of volatility) Estimate Std error Error
Bump, same draws 38.79590 0.11919 +0.12909
Pathwise 38.78625 0.11850 +0.11944
Digital call, exact delta 0.01933
Delta Estimate Std error Error
Pathwise (derivative of payoff is 0) 0.00000 0.00000 -0.01933
Bump, same draws, bump 1.0 0.01906 0.00021 -0.00027
Bump, same draws, bump 0.1 0.01856 0.00067 -0.00077
Likelihood ratio 0.01938 0.00004 +0.00005
Reading the output:
Common random numbers are essential. The standard error of the bumped delta is 0.032 with independent draws and 0.0009 with the same draws, 35 times smaller. The first is useless as a hedge.
The bump bias is visible. The forward difference with a bump of 1 has an error of +0.0099, which is \(\tfrac{1}{2}\Gamma h = 0.5 \times 0.0193 \times 1 = 0.0097\). A central difference removes it.
The pathwise delta is the best here. Its error, 0.0005, is half a standard error. It is unbiased and costs one run.
The likelihood ratio has a larger standard error for the call, 0.0022 against 0.0009 for the pathwise delta, but it gives the gamma with a standard error comparable to the bumped one, 0.00021 and 0.00017, without a second bump.
The digital option breaks the pathwise method. It returns exactly zero, an error of the whole delta, 0.01933, and with a standard error of zero, so nothing in the output warns of it. The likelihood ratio method gets 0.01938 with a standard error of 0.00004. A bump of 1.0 has a small bias, and a bump of 0.1 has three times the noise, with a standard error of 0.00067 that is larger than the bias it removes. That trade-off is typical of discontinuous payoffs.
The vega estimates are about one standard error above the exact value, 0.12 on 38.67, which is within the sampling error.
A valuation control view#
Check that the method suits the payoff: a pathwise Greek on a digital, a barrier or a payoff with a cap that is hit often is wrong, and its standard error is zero. A zero sensitivity for a product that should have one is a red flag.
Use common random numbers for every bump: and fix the seed, so that a risk run is repeatable and the movement in the Greek day to day is a movement in the market, not in the noise. See Random Numbers & Sampling.
Choose the bump size on purpose: and document it. The noise and the bias both depend on it, and a Greek that jumps from day to day is often a noisy one.
Reconcile Greeks to a second method: a Greek from a finite difference scheme, a tree or a closed form on a simple case, as in this example. A Monte Carlo delta that disagrees with a closed form on a vanilla option is a bug.
Know the cost: each bumped Greek is another full valuation. A book with hundreds of sensitivities needs the pathwise or adjoint approach, as in Advanced Methods, Part 2: Dimension, Adjoints & Machine Learning, or a risk run that is much slower than a price.
Next, Lattice Methods, Part 1: Binomial Trees moves from simulation to the lattice methods.