Lessons / Monte Carlo / Part 3 · Paths and options

Paths, options, and correlated inputs

Parts 1 and 2 assumed away the two hardest features of real problems: time, and dependence. This part removes both. A scenario stops being a handful of numbers and becomes a trajectory; inputs stop pretending they don't know each other. Everything gets certified against an answer we already know before it is aimed at one we don't.

What changes when time enters

In Part 2 a scenario was a growth rate, a margin, a multiple. Many real problems refuse to be summarised that way: an option's payoff can depend on the average price over a year, or on whether a barrier was ever touched; a patient's outcome depends on a disease path; a queue's performance depends on its entire arrival history. The random object is now a function of time, and one scenario is a path - a vector of values at many time points.

The good news you already own: Part 1 proved the Monte Carlo error rate contains no dimension. A path sampled at 252 daily points is a 252-dimensional random vector, and the estimator does not care. So nothing here is new statistics - it is new model-building: how to construct paths whose randomness has the right structure. It arrives in three steps.

  • The random walk. Start at zero and add an independent shock each period. Two properties define everything that follows: increments are independent - tomorrow's surprise doesn't remember today's - and the variance of the position grows linearly in time, so the typical displacement grows like the square root of t. You have met that square root before wearing a different costume: it is the same one from the standard error, and honestly so, because a random walk is a running sum of independent draws.
  • Brownian motion. Let the period shrink to zero while holding variance-per-unit-time fixed and the walk becomes continuous. For simulation you need exactly one fact: over any interval, the increment is normal with variance equal to the interval's length, independent of everything before. On a grid, a Brownian path is just the cumulative sum of independent normal draws - the random walk again, with no apology needed.
  • Geometric Brownian motion. Prices can't go negative, and shocks are naturally proportional - the stock moved 2%, never 2 dollars regardless of level. That is Part 2's lognormal country, so model the log of the price as a random walk with drift. The payoff is that the resulting equation has an exact solution, and the exact solution is the simulation recipe.
$$S(t+\Delta) = S(t)\cdot \exp\Big(\big(\mu - \tfrac{\sigma^2}{2}\big)\Delta + \sigma\sqrt{\Delta}\,Z\Big), \qquad Z \sim N(0,1)$$

So a path is: generate a row of independent normals, turn each into a log-increment with that formula, take the cumulative sum, exponentiate. Rows are worlds, columns are time - the exact array discipline from Part 2's DCF, now with 252 columns instead of 5.

The minus sigma squared over two is a load-bearing wall

Every beginner looks at that formula and asks the same question: what is that correction doing there, and can I drop it? You can, and your asset will then earn about 3.2% a year out of thin air at 25% volatility. Nothing will crash. The paths will look completely plausible.

Here is the cleanest way to hold it, and it is Part 2's lesson returning with a vengeance. For a lognormal variable the mean of the exponential exceeds the exponential of the mean, because exponentiating is convex and the upside of a symmetric shock outweighs its downside once you exponentiate. That is Jensen. It is always Jensen. So if you want your simulated price to have expected growth rate mu - which is what “drift mu” means - you must set the drift of the log to mu minus half sigma squared, precisely so that the convexity bonus restores it.

Drop the correction and every step gains an unearned factor; over a year of daily steps those factors compound to about 1.0317 at 25% volatility - the phantom 3.2%. The bug is vicious precisely because nothing breaks: the bias hides inside the drift, where only a check against theory will ever find it. Which is why the check against theory is not optional.

The same fact wearing its finance costume: a stock with 25% volatility whose log-return averages zero loses nothing on average in price terms - but its median path decays. Volatility drags the median down by half sigma squared per year even as the mean stays flat, because the mean is held up by a shrinking minority of huge paths. That is “volatility drag” in retirement planning and the “variance tax” in trading folklore. All the same term.

Exact schemes versus Euler - know which luxury you have

Geometric Brownian motion is a luxury model: that one-step formula is exact at any step size, so if you only need the terminal price you can jump straight there in a single step. You discretise time only when the payoff looks at intermediate dates.

Most stochastic models are not so lucky - interest-rate models, stochastic volatility, anything nonlinear - and there you fall back on the Euler scheme, the first-order approximation. Euler carries discretisation bias that vanishes only as the step shrinks: applied to GBM, where we can see the truth, the simulated mean crawls from 108.02 at one step per year to 108.35 at 252 steps against a true 108.33.

The professional takeaway is a taxonomy, not a formula. With an exact scheme your only error is statistical - it shrinks like the square root of N and your error bar reports it honestly. With Euler you carry a second, invisible error that no error bar mentions, and you must manage it separately: halve the step, watch the answer move. Confusing the two is a classic production incident - teams double N forever, wondering why the answer converges confidently to the wrong number.

The certification ritual: three one-line tests every path simulator passes first

Before any path simulator touches a real payoff it passes three tests. The mean test: the simulated expected terminal price equals the theoretical one within the error bar. The martingale test: under the pricing measure below, the discounted price must average exactly the starting price - a correct simulator returns 100.02 give or take 0.05, and the dropped-correction bug returns 103.19, failing loudly. The variance test: the variance of the log terminal price equals sigma squared times T.

Three lines of assertions that would have caught the majority of path-simulation bugs ever shipped. Notice they cost nothing and run in a second - and notice that the bug we just discussed is invisible to every other kind of inspection.

Option pricing: the workflow your colleagues actually meant

When a valuation team says “we'll price the option by Monte Carlo with GBM”, they mean four lines. Simulate N terminal prices under GBM with the drift set to the risk-free rate - not the stock's real expected return. Compute the payoff in each world. Average. Discount at the risk-free rate.

Three of those four are Part 1's engine verbatim: a price expressed as a discounted expectation, estimated by an average, error bar attached. The entire novelty is the strange instruction in the first one.

Why the drift becomes the risk-free rate, in honest plain language. Part 2 met the puzzle already: when valuing risky cash flows, riskiness has to be priced somewhere - there we kept the scenarios realistic and priced risk in the discount rate. Option pricing resolves the same tension in the opposite, cleverer direction: distort the scenarios, simplify the discounting.

The deep fact is that an option's payoff can be replicated by a continuously rebalanced portfolio of the stock and cash. Two assets with identical payoffs in every state must have identical prices - otherwise free money - so the option's price is the cost of the replicating portfolio. And here is the punchline: when you grind through that replication argument, the stock's actual expected return cancels out of the answer entirely. It has to, because the hedge neutralises the stock's direction, so how strongly the stock trends cannot matter. Only the starting price, the strike, the horizon, the rate and the volatility survive.

Since the real drift doesn't appear in the answer, we are free to compute the answer in whichever fictional world makes the computation easiest - and the easiest is the one where every asset drifts at the risk-free rate, because there, pricing collapses to a discounted expected payoff, which is exactly a Monte Carlo average. That world is called the risk-neutral measure.

Be very clear about what it is not. Nobody claims investors are indifferent to risk, and risk-neutral paths are not forecasts - the simulated distribution is deliberately wrong as a prediction, since its mean grows at the risk-free rate rather than the stock's. It is a pricing device, justified by replication, that happens to have the shape of an expectation and is therefore Monte-Carlo-able. Keep the two modes separated in your head and in your codebase: real-world drift for risk management and “what might happen” questions, risk-neutral drift for pricing only. Feeding a value-at-risk question risk-neutral paths, or a pricing question real-world paths, is a category error with money attached - and both happen in practice.

Certify it against Black-Scholes

The European call has a closed-form price, which makes it the perfect certification target: we never need Monte Carlo for it, and that is exactly why we start there. The blue band is the simulation's estimate give or take two standard errors; the black line is the exact answer. A pass isn't “the numbers look close” - it is the disagreement measured in units of the standard error, with the criterion stated in advance.

standard errors away from the exact answer

Two things to try. Drag the paths up and watch the band narrow around the exact line at the familiar square-root rate - the error bar is honest, and it contains the truth. Then tick the bug: the price jumps and the band stays exactly as narrow as before. That is the whole point. A tight error bar tells you the simulation is precise, never that it is right.

Greeks, and the quiet star of the whole guide

A price alone is half a deliverable; desks live on sensitivities. Delta - how the price moves when the stock moves - is the obvious one, and the obvious estimator is a finite difference: price at a slightly higher spot, price at a slightly lower one, subtract, divide by the gap. Here Monte Carlo lays a trap that teaches a beautiful lesson.

Use independent random draws for the two bumped prices and each carries its own noise; the difference of two noisy numbers divided by a small gap amplifies that noise catastrophically. Measured: delta = 0.5112 give or take 0.0226 - a 4%-wide error bar on a quantity of size 0.52, which is garbage for hedging.

Now the fix, which costs exactly zero extra computation: use the same normal draws for both bumps. Common random numbers. Each scenario's noise now appears in both prices and cancels in the subtraction; what survives is precisely the systematic effect of the bump. Result: 0.5195 give or take 0.0012, against a true Black-Scholes delta of 0.5199 - a measured variance reduction of 349 times. Same estimator, same N, one line about seed discipline, two and a half decimal digits purchased for free.

Pause on why, because this is Part 1's deepest thread paying off. The variance of a difference equals the sum of the variances minus twice the covariance - so making the two terms positively correlated shrinks the variance of their difference. Common random numbers are the deliberate engineering of that covariance. It is the same principle you already used informally when comparing strategy A against B on the same seed, and the same principle Part 4's antithetic variates will invert, using negative correlation to shrink a sum instead. Correlation, which the next section treats as a modelling hazard, is also the professional's favourite tool.
Where Monte Carlo actually earns its salary, and two honest boundary markers

Everything so far, Black-Scholes could have done without us. Now change one word in the contract: the call pays on the average price over 52 weekly observations - an arithmetic Asian option, beloved by corporates precisely because averaging suppresses manipulation and noise. The price is now a genuinely 52-dimensional integral with no closed form, and Part 1 told you what happens to grid methods in dimension 52. For Monte Carlo it is four lines: simulate weekly paths, average each row, payoff, discount, mean. Measured: 4.3514 give or take 0.0363 at 200,000 paths. That error bar is a little wide for a real desk - which is not a problem but a setup, because this exact option is Part 4's patient, where a control variate shrinks it to about a thousandth at the same N.

Two boundary markers. American options - exercisable at any time - add an optimal-stopping decision to every path, and naive Monte Carlo cannot handle “decide optimally at each moment” because a path does not know the conditional value of continuing. The industry standard fix, Longstaff-Schwartz, estimates that continuation value by regressing future payoffs on current state across paths. Know the name and the shape of the idea. And model risk outranks everything in this section: real markets have fatter tails and stochastic volatility, which is why desks calibrate fancier processes - simulated with the same workflow you just certified. The workflow is permanent; GBM is merely its training wheels.

Correlated inputs: sin 4 comes due

Part 2's fourth deadly sin - independence by default, silently - was allowed at entry level with a confession attached. This is where the confession stops being enough, and one table explains why. Take an equal-weight portfolio of ten assets, each with the same 20% volatility, and vary only how correlated they are:

Pairwise correlationPortfolio volatilityA bad-year loss (P5)
0.06.3%−10.4%
0.312.2%−20.0%
0.616.0%−26.3%
0.919.1%−31.3%

At zero correlation, diversification works exactly as theory promises - the portfolio volatility is the single-asset volatility divided by the square root of ten, which is another free certification. At 0.6 - an unremarkable correlation for equities in a stressed market - the bad-year loss is two and a half times worse than the independent model claims. Every marginal distribution in both models is identical. The entire difference is dependence.

Correlation is not a refinement of a risk model. In any aggregation problem - portfolios, project cost roll-ups, system reliability with common-cause failures - correlation is the risk model, and it lives exactly where you care most: in the tails.

Turn the correlation dial

Ten assets, each with exactly the same 20% volatility no matter where the dial sits. Only their dependence changes. Watch what that alone does to the left tail - the part of the distribution that pays your losses.

the bad year: worst 5% of outcomes start here

Nothing about any individual asset changed between the two ends of that dial. Every one of them still has a 20% volatility and the same bell-shaped distribution. Only the wiring between them moved - and the bad year got three times worse.

Cholesky, copulas, and the 2008 lesson

So we need to generate correlated inputs. For the multivariate normal case there is a complete, exact, three-line answer, and it is worth understanding rather than merely calling.

The goal: given a target correlation matrix, produce vectors with that covariance out of the independent normals your generator supplies. Any linear map applied to independent normals produces a covariance equal to the map times its own transpose. So the task reduces to factoring the target matrix into a factor and its transpose - and choosing that factor lower-triangular makes the factorisation unique, cheap and interpretable. That is the Cholesky decomposition, and it is one library call.

L = np.linalg.cholesky(C) # C = L @ L.T, L lower-triangular
X = Z @ L.T # rows of Z: iid normals -> rows of X: correlated

The interpretation is the valuable part. Each row of that factor is a mixing recipe: variable k is built from the first k independent noise sources, with weights chosen so its covariances with the earlier variables come out exactly right and its total variance stays at one. Variable 1 is pure factor 1; variable 2 is some parts factor 1 plus enough fresh factor 2 to top up the variance; and so on. Cholesky is a factor model in disguise - each variable equals loadings on common factors plus its own idiosyncratic noise - which is exactly how practitioners think about dependence even when they never say the word.

Field notes, because each has ended someone's afternoon

The target matrix must be a genuine covariance matrix - positive semi-definite - and correlation matrices assembled by hand from pairwise expert guesses frequently are not. Cholesky then throws an error, which is the good outcome; the fix is projecting to the nearest valid matrix. Estimated correlations from short histories are noisy and unstable, which is why shrinkage estimators exist. And correlations are famously regime-dependent: the value you estimated in calm markets is not the one that shows up in the crash - a modelling wound no generator can heal, but a perfect segue.

Copulas: dependence with any marginals

Cholesky solves the normal case. But Part 2 taught you that real inputs are lognormal, triangular, empirical - and you still need them correlated. Enter the copula, which is nothing more mysterious than Part 2's percentile machine run in both directions. Generate correlated normals with Cholesky. Squash each coordinate through its own normal CDF to get correlated uniforms - any variable through its own CDF becomes uniform, and the dependence survives the squashing. Then push each uniform through whatever inverse CDF you want for that input.

Marginals and dependence are now fully decoupled: you can hand each input its honest distribution and still wire the inputs together. That object is the Gaussian copula, and this three-step recipe is how sin 4 actually gets fixed in production cost and valuation models.

Now the caveat that carries a decade of financial history. The Gaussian copula has a provable property called zero tail dependence: as events get more extreme, Gaussian-linked variables become asymptotically independent - in that world simultaneous crashes of many names are essentially impossible, no matter how high you set the correlation. Swap the common shock from normal to a heavy-tailed one and you get the t-copula, in which extremes cluster. With identical marginals and an identical correlation of 0.6, the probability that two assets are simultaneously in their worst 5% is 0.25% if independent, 1.54% under the Gaussian copula, and 2.13% under a t-copula - a 40% difference in joint-crash probability from a modelling choice most spreadsheets never surface. The Gaussian copula was the industry-standard machine for pricing CDOs before 2008. The “formula that killed Wall Street” journalism oversimplifies a many-caused crisis, but the technical core is real and is exactly that number: a dependence model structurally incapable of joint extremes, pricing securities whose entire risk was joint extremes.

The transferable lesson costs one sentence: correlation is one number, dependence is a whole function, and the difference between them lives in the tails - which is where you get paid or destroyed.

Now go and run it

Part 3 opens the pro notebook, and every number quoted above is its actual output - seeds fixed, so you will reproduce them to the digit. Section 1 builds the path simulator and runs the three certification tests including the martingale check that catches the dropped-correction bug. Section 2 is the option workflow, the Black-Scholes certification, common random numbers and the Asian option. Section 3 is Cholesky, the portfolio, and the Gaussian-versus-t copula scatter.

What's next

  • Part 4 - beating the square-root law. Every halving of the error bar quadruples the bill - unless you stop buying runs and start shrinking the variance. Antithetic and control variates (the Asian option's error bar collapses by a factor of 35), importance sampling that turns a hopeless one-in-a-million estimate routine, quasi-Monte Carlo, and the bridge to MCMC.

New here? Part 1 builds the engine, Part 2 the recipe and two projects, and the series hub lists all four.

Frequently asked

Why does geometric Brownian motion subtract half the variance from the drift?

Because exponentiating is convex, so the mean of the exponential exceeds the exponential of the mean. If you want the simulated price to grow at rate mu, the drift of the log must be mu minus half sigma squared, precisely so the convexity bonus restores it. Drop the correction and every step gains unearned return - about 3.2% a year at 25% volatility - and nothing crashes.

Why is the drift set to the risk-free rate when pricing options?

Because an option can be replicated by a portfolio of the stock and cash, and when you work through the replication the stock's real expected return cancels out of the price entirely. Since it doesn't appear in the answer, you may compute the answer in whichever fictional world is easiest - and the easiest is the one where everything drifts at the risk-free rate. Risk-neutral paths are a pricing device, not a forecast.

What are common random numbers?

Reusing the same draws across two scenarios you intend to compare, so their shared noise cancels in the difference. Because the variance of a difference falls as the two terms become positively correlated, common random numbers can cut the variance of a finite-difference Greek by hundreds of times at no extra cost - measured here at 349 times.

What is the Cholesky decomposition used for in simulation?

It turns independent normal draws into correlated ones. Any linear map applied to independent normals produces a covariance equal to the map times its transpose, so hitting a target correlation reduces to factoring that matrix into a lower-triangular factor and its transpose. Each row of the factor reads as a mixing recipe, which makes Cholesky a factor model in disguise.

Certifying a method against a known answer before trusting it is the habit this whole series is really teaching. Stat Exam Pro drills the same instinct on exam questions, with worked answers.

Get it on iPhone