Monte Carlo, Part 1: Basic Pricing#
Monte Carlo prices a product by simulating the underlying many times and averaging the discounted payoff. It is the most flexible method in the series, since it needs only a way to simulate the model and a way to evaluate the payoff, and it is the slowest to converge. This is the first of four pages on it. This page sets out the method, its error, and what the error means for a price that is to be reviewed.
The pattern#
Every Monte Carlo price follows the same steps:
For a European call under geometric Brownian motion the terminal value can be drawn directly,
and the estimate is the average of the discounted payoffs of \(N\) independent draws:
Error#
By the law of large numbers \(\hat{V}\) converges to the price, and by the central limit theorem its error is approximately normal with the standard error
where \(s\) is the sample standard deviation of the discounted payoffs. A 95% confidence interval is \(\hat{V} \pm 1.96 \, \text{SE}\). Three consequences follow:
The error falls with \(\sqrt{N}\). A tenfold gain in accuracy needs a hundredfold more paths.
The error does not depend on the dimension, which is why Monte Carlo is used for products with many underlyings.
Every Monte Carlo price comes with a standard error. A price without one cannot be compared with another.
The error above is the sampling error. If the paths are built from time steps there is also the discretisation error of SDE Discretisation: Euler & Milstein. For a model with an exact distribution, such as geometric Brownian motion, the terminal value can be sampled in one step and there is none. Stepping through 252 days for the same price costs 252 times the random numbers for no gain.
Worked example#
The example prices the benchmark call with 1,000 to 10 million paths and reports the estimate, the standard error and the error against Black-Scholes. It then repeats a 10,000-path run 2,000 times to test whether the 95% interval holds the true value 95% of the time, finds the paths needed for a target accuracy, and compares one-step sampling with daily stepping.
Python code
"""Basic Monte Carlo for the benchmark call: estimate, standard error, confidence interval and cost."""
import time
import numpy as np
from common import K, R, S0, SIGMA, T, bs_price
def mc_call(n, rng):
"""Price and standard error from n terminal values drawn exactly from the lognormal distribution."""
z = rng.standard_normal(n)
st = S0 * np.exp((R - 0.5 * SIGMA**2) * T + SIGMA * np.sqrt(T) * z)
pv = np.exp(-R * T) * np.maximum(st - K, 0.0)
return pv.mean(), pv.std(ddof=1) / np.sqrt(n)
if __name__ == "__main__":
rng = np.random.default_rng(1)
exact = bs_price()
print(f"Black-Scholes call {exact:.6f}\n")
print(f"{'Paths':>10} {'Estimate':>10} {'Std error':>10} {'Error':>9} {'95% interval':>22} {'Error x sqrt(N)':>16}")
for n in (1_000, 10_000, 100_000, 1_000_000, 10_000_000):
price, se = mc_call(n, rng)
lo, hi = price - 1.96 * se, price + 1.96 * se
print(f"{n:>10,} {price:10.5f} {se:10.5f} {price - exact:+9.5f} [{lo:8.4f}, {hi:8.4f}] {abs(price - exact) * np.sqrt(n):16.2f}")
# Does a 95% interval contain the true value 95% of the time?
runs, n = 2000, 10_000
hits = 0
for _ in range(runs):
price, se = mc_call(n, rng)
hits += abs(price - exact) <= 1.96 * se
print(f"\n{runs} repeated runs of {n:,} paths: the 95% interval held the true value {hits / runs:.1%} of the time")
# Paths needed for a target accuracy: the error falls with the square root of the number of paths.
_, se_1m = mc_call(1_000_000, rng)
sd_one = se_1m * np.sqrt(1_000_000)
for target in (0.01, 0.001, 0.0001):
print(f"Standard error {target}: about {(sd_one / target) ** 2:,.0f} paths")
# Cost of stepping through time when the terminal value can be sampled exactly.
n, steps = 200_000, 252
start = time.perf_counter()
mc_call(n, rng)
one_step = time.perf_counter() - start
start = time.perf_counter()
dt = T / steps
log_s = np.full(n, np.log(S0))
for _ in range(steps):
log_s += (R - 0.5 * SIGMA**2) * dt + SIGMA * np.sqrt(dt) * rng.standard_normal(n)
stepped = np.exp(-R * T) * np.maximum(np.exp(log_s) - K, 0).mean()
many_steps = time.perf_counter() - start
print(f"\n{n:,} paths, exact terminal draw: {one_step * 1e3:.0f}ms. {steps} daily steps: {many_steps * 1e3:.0f}ms "
f"({many_steps / one_step:.0f} times longer), price {stepped:.4f}")
The output is:
Black-Scholes call 9.413403
Paths Estimate Std error Error 95% interval Error x sqrt(N)
1,000 8.59831 0.42725 -0.81510 [ 7.7609, 9.4357] 25.78
10,000 9.29938 0.14015 -0.11402 [ 9.0247, 9.5741] 11.40
100,000 9.36024 0.04462 -0.05317 [ 9.2728, 9.4477] 16.81
1,000,000 9.39565 0.01409 -0.01775 [ 9.3680, 9.4233] 17.75
10,000,000 9.42258 0.00446 +0.00918 [ 9.4138, 9.4313] 29.03
2000 repeated runs of 10,000 paths: the 95% interval held the true value 95.3% of the time
Standard error 0.01: about 1,991,900 paths
Standard error 0.001: about 199,190,049 paths
Standard error 0.0001: about 19,919,004,908 paths
200,000 paths, exact terminal draw: 15ms. 252 daily steps: 1298ms (85 times longer), price 9.4439
Reading the output:
The standard error falls as expected. It goes from 0.43 at 1,000 paths to 0.0045 at 10 million, a factor of 96 for 10,000 times the paths, and the square root of 10,000 is 100.
The actual errors are ordinary draws from that distribution. They are between 0.8 and 2.1 standard errors. The error is not a smooth curve, and a single run can be two standard errors away.
The interval has the stated coverage. In 2,000 repeated runs the 95% interval contained the true price 95.3% of the time.
Accuracy is expensive. A standard error of one cent needs about two million paths, a tenth of a cent needs 200 million, and a hundredth of a cent needs 20 billion. A price quoted to four decimals from simulation needs variance reduction (Monte Carlo, Part 3: Variance Reduction & Quasi-Monte Carlo) or another method.
Stepping through time costs. The daily-step run took 85 times as long as the one-step draw and gave a price inside its standard error of the same value, 9.4439 against 9.4134, which is about 1 standard error.
Timings are indicative. They depend on the machine and on the load.
A valuation control view#
Always compare a Monte Carlo price with its standard error: a difference between the desk’s price and an independent price that is within two standard errors of the combined noise is not evidence of a model difference. A difference larger than that needs an explanation.
Set the number of paths from the accuracy that is needed: the tolerance of the control, the bid-offer and the reserve should decide it. A price whose standard error is larger than the reserve that is held against it is not reliable enough to support the reserve.
Fix the seed for the control run and report the standard error: the desk’s price and the control price should be reproducible, and the noise between two runs with different seeds should be known. See Random Numbers & Sampling.
Check convergence, not only the result: run the price at 10 times the paths and at half the steps. A price that moves by more than its standard error is not converged.
Know the cost of risk: each Greek by bumping is another full revaluation, and the noise in a bumped Greek is much larger than the noise in the price. See Monte Carlo, Part 4: Greeks.
Next, Monte Carlo, Part 2: Path-Dependent Options uses Monte Carlo on payoffs that depend on the whole path.