QTA 13: Simulation and Bootstrapping
Risk managers reach for simulation whenever the quantity they want cannot be written down in closed form. Three familiar uses give the flavour: valuing the expected payoff of an option, measuring the downside risk inside a portfolio, and checking how accurate an estimator is on samples of realistic size.
A Monte Carlo simulation, also called a Monte Carlo experiment, is a numerical route to the expected value of a random variable. Random values come from an assumed data generating process, normally shortened to DGP. A function is applied to them, and what comes back is one realisation from the unknown distribution of the transformed variable. That pair of steps runs many times over, and the statistic wanted, say what a call option should cost, is approximated from the simulated values. Repetition buys accuracy, since replications can be pushed up until any required precision is reached.
Where bootstrapping fits
Bootstrapping is the other member of the family, and its name borrows the impossible image of somebody lifting themselves off the ground by pulling on their own footwear. A bootstrap leans on the sample in hand to imitate the distribution that produced it, drawing fresh samples out of the original data set. Every new sample ends up closely related to the data without being a copy of them.
The two methods share a purpose: the expected value of some function, usually a complicated one, with computer generated values standing in for algebra that cannot be done. What separates them is where the simulated data come from. Monte Carlo asks the user to write down a full DGP. A bootstrap skips that and builds the simulated data set straight out of the observed sample, which decides which method is safer when a model is hard to justify.
Every simulation begins by generating random values from an assumed distribution, and here the language runs ahead of the reality. Numbers produced by a computer are not random. They come out of deterministic functions, built so the output is hard to predict and looks random to most statistical tests. Values of that kind are pseudo-random numbers, and the machinery behind them is a pseudo-random number generator, or PRNG.
A PRNG has to start somewhere, and its starting point is the seed value, which fixes the internal state of the generator. Run the same generator twice from one seed and the identical sequence comes back, without exception. That sounds like a defect and is in fact among the most useful properties the machinery has.
Two uses for reproducible output
The first is replication across experiments. Because a sequence can be recreated on demand, rival models or competing estimators can be compared on identical simulated data, which strips out the noise that would otherwise pollute the comparison. The same feature lets a result be reproduced years later, which matters for regulatory compliance.
The second is coordination across machines. Large portfolios holding thousands of instruments are driven by a common set of fundamental factors, and a distributed risk calculation must feed every machine the same simulated factor values, otherwise the joint behaviour of the instruments falls apart. A common seed across a cluster keeps those factors aligned.
One practical point matters before any distribution can be simulated. Generators return standard uniforms, meaning draws from Uniform(0,1), so those have to be converted into draws from whatever distribution the DGP names.
Suppose an experiment calls for data from a heavy-tailed distribution, for instance a generalized Student’s t with six degrees of freedom. The textbook definition of that variable is a ratio.
The definition cannot be applied as it stands, because the generator supplies uniform values and nothing else. A general result rescues the situation. Any variable X with cumulative distribution function FX has the property that FX(X) is uniform. Read backwards, that gives the tool used in practice: push a uniform through the inverse cumulative distribution function and a draw from the target comes out.
Four independent uniforms therefore become four independent draws from the generalized Student’s t. Each simulated value sits on the horizontal axis at the point whose cumulative probability equals the uniform behind it, so reading across to the curve and dropping down performs the whole transformation.
The same construction handles a discrete random variable, which also has a cumulative distribution function. That function climbs in steps, and a uniform landing inside one step returns the outcome attached to it.
A simulated draw from a N(1,5) distribution comes out at 1.2, produced by the inverse transform route.
Once values can be produced from the assumed distribution, an experiment follows five steps whatever is being approximated.
- Draw a data set according to the assumed DGP.
- Evaluate the function or statistic of interest on that data set.
- Repeat the first two steps until b replications exist.
- Estimate the quantity wanted from the b stored values.
- Measure accuracy with the standard error, and raise b if it is not small enough.
Replications and sample size are different counts
Two counts turn up in every experiment and they are easy to confuse. The letter b counts replications, meaning how many times the whole exercise repeats, while n counts the observations inside one simulated sample. In the simplest case each replication yields a single data point. Elsewhere it generates a series of n observations, and the statistic is computed on that series. Either way the b stored values are independent by construction.
Estimating a mean then amounts to averaging them.
Since that average runs over independent and identically distributed variables, the Law of Large Numbers applies and the approximation settles on the true value as replications grow.
The Central Limit Theorem covers the same average, which is what makes the accuracy of a simulation measurable rather than a matter of judgement.
Plenty of moments are analytically tractable: the mean and variance of a normal variable can simply be written down. Tractability runs out quickly though, mainly for variables built out of complex dynamic models and for expectations of complicated nonlinear functions.
Accuracy is governed by the variance of the simulated expectation, being the variance of the transformed variable over the replication count. That numerator is unknown and gets estimated from the simulated values.
Quantiles as well as means
The same output supports quantiles. Rank the b draws in ascending order and take position b multiplied by alpha: that empirical quantile estimates the true one. Value-at-risk asks for the lower quantiles of a return distribution, with alpha typically 0.1%, 1%, 5% or 10%.
Finite sample properties of an estimator
Most inference here rests on asymptotic arguments from the Law of Large Numbers and the Central Limit Theorem, which describe behaviour as a sample grows without bound. Real samples are finite, and the approximation can be poor when n is small. An experiment tabulates the finite sample distribution of an estimator instead: draw a sample, estimate the parameter, repeat b times, and bias, variance and quantiles all follow from the b estimates.
| n | Mean of sample means | Standard deviation of sample means |
|---|---|---|
| 10 | 0.985 | 0.917 |
| 50 | 1.017 | 0.428 |
| 250 | 1.001 | 0.185 |
| 1,250 | 1.005 | 0.087 |
Source: each row holds b = 1,000 replications of a sample mean, drawn from a normal variable whose mean is 1.
The table approximates the mean of a normal variable with a true mean of 1 and a standard deviation of 3, drawing 1,000 samples at each sample size.
The standard error of a simulated expectation is the standard deviation of the simulated values over the square root of b, so it shrinks in proportion to one over the square root of the replication count. That rate holds for any moment approximated this way, and it survives a wildly nonlinear function, because the draws stay independent.
Pricing a European call option shows the arithmetic in a setting worth caring about. The option pays the greater of zero and the terminal stock price less the strike, so the payoff bends at the strike and its expectation cannot be recovered from the expected stock price. A model for the terminal price is needed, and the standard choice makes the log stock price normally distributed.
Run that experiment on a two-year European call struck at the level of the underlying index, letting the replication count climb in multiples of four, and every fourfold rise in b roughly halves the error: 71.23 falls to 30.19, then to 15.39, and by 12,800 replications it stands at 3.64. Precision bought this way is expensive. At 12,800 replications the price comes out at 275.62, so a two-sided 95% confidence interval reaching 1.96 standard errors either side still spans about USD 14, roughly 5% of the option value.
An initial run of 100 replications puts the fair value of an option at USD 47, and the standard deviation of those simulated values is USD 12.30.
Raising b is the obvious route and often the wrong one, since a complex simulation can be slow. Two alternatives sharpen accuracy at a fixed replication count: antithetic variates and control variates.
The variance of a total formed by adding random variables is the summed variances plus twice every distinct pairwise covariance. Independent replications zero those covariances out, while negative ones make the total vary less than independence allows. That is the opening antithetic variates exploit.
They are a second set of values built to correlate negatively with the values already drawn, arriving in pairs from a single uniform: if the first is U, its partner is 1 minus U. Sending both through the inverse CDF carries that negative correlation into the target distribution, and only b divided by 2 uniforms fill b simulated values.
One condition governs whether the technique delivers. Negative correlation has to survive the function being applied, which is guaranteed only when that function is monotonic in the draw. A payoff that turns around converts negatively correlated inputs into positively correlated outputs, and the standard error then rises. The method fills the probability distribution more evenly, at a cost well below running more replications.
Ten draws from a standard normal value an option paying the greater of zero and the draw less a strike of 0.5. Each antithetic partner is the negative of its draw.
| Draw | N(0,1) value | Payoff | Antithetic value | Antithetic payoff |
|---|---|---|---|---|
| 1 | -0.65 | 0 | 0.65 | 0.15 |
| 2 | -0.12 | 0 | 0.12 | 0 |
| 3 | 0.92 | 0.42 | -0.92 | 0 |
| 4 | 1.28 | 0.78 | -1.28 | 0 |
| 5 | 0.63 | 0.13 | -0.63 | 0 |
| 6 | -1.98 | 0 | 1.98 | 1.48 |
| 7 | 0.22 | 0 | -0.22 | 0 |
| 8 | 0.4 | 0 | -0.4 | 0 |
| 9 | 0.86 | 0.36 | -0.86 | 0 |
| 10 | 1.74 | 1.24 | -1.74 | 0 |
Source: the ten standard normal values come from the chapter; the payoff columns are computed here.
Return to the two-year call. Its value is a nonlinear function of the simulated normal draws, so pairing a draw with its negative gives a correlation between the resulting option prices of only -43 percent. That puts the reduction in the standard error at approximately 25 percent, worth about 78 percent more independent replications.
Control variates attack the same problem from another angle. Any simulated value splits into the quantity being approximated plus a mean zero disturbance. A control variate is a second variable, computed on the same draw, whose own expected value is zero but which correlates with that disturbance. Adding it cannot bias the approximation, and the correlation lets part of the error cancel.
A good control variate has two properties. It should be cheap to build from the draw already in hand, since a slow one wastes computation that would have bought more replications, and it should correlate strongly with the function whose expectation is wanted, because that correlation determines how much error cancels. The weight comes from a regression of the simulated values on the control variate.
Valuing a call option with a put option as the control
The call option experiment supplies a natural candidate. A European put on the same underlying, with matching strike and maturity, is driven by the same simulated terminal prices, so valuing it alongside the call costs nothing extra. It pays the greater of zero and the strike less the terminal price and has a closed-form value, which makes a mean zero variable easy to build: simulate the put payoff and subtract the analytical Black-Scholes-Merton price.
One experiment runs on the variable under study and on a second whose properties are already known, using the same draws for both. Sampling error then contaminates the known problem much as it contaminates the unknown one, so comparing the simulated answer against the analytical one calibrates away part of the error. Here the simulated call and put prices correlate at -44 percent.
| b | Price | Independent | Antithetic | Control variate | Both |
|---|---|---|---|---|---|
| 50 | 301.50 | 71.23 | 65.46 | 64.10 | 58.38 |
| 800 | 276.21 | 15.39 | 11.43 | 13.71 | 10.21 |
| 12,800 | 275.62 | 3.64 | 2.75 | 3.21 | 2.43 |
| 204,800 | 278.64 | 0.93 | 0.70 | 0.83 | 0.62 |
| 3,276,800 | 279.15 | 0.23 | 0.17 | 0.21 | 0.15 |
Source: the price column uses independent draws. The remaining columns give the standard error under each of the four schemes.
Reading across any row shows both effects. At 12,800 replications the error falls from 3.64 under independent draws to 2.75 with antithetic variables and to 3.21 with the control variate, while the two together reach 2.43. Used jointly they cut the standard error by about 33 percent against independent sampling, equivalent to roughly 125 percent more independent replications. The two are complementary.
Both approaches use observed data, but at different points. A simulation uses it only to calibrate, meaning to pin down key model parameters such as the mean and standard deviation of the S&P 500, which then need an assumed distribution for the standardised returns before the DGP is complete. A bootstrap goes at the data directly, modelling nothing and assuming no distribution, and the only thing it simulates is which observations get chosen.
One fact makes the method work. Whatever distribution a bootstrap wants to sample from is the one that generated the data already in hand, and although nobody knows what it is, the observations themselves resemble it in a probabilistic sense. That is the advantage over Monte Carlo: no DGP has to be specified, so no DGP can be misspecified.
How the iid bootstrap builds a sample
Two classes of bootstrap are used in risk management, and the simpler is the iid bootstrap. For a sample of size m from a data set holding n observations, generate m integers at random from 1 through n, drawing with replacement, and use them as indices to pick which observed values go in. The result is a bootstrap sample.
Take five observations drawn from a set of twenty. The first bootstrap sample might use observations 3, 6, 2, 5 and 10, and the second 6, 3, 2, 18 and 15, so the two partly overlap. A later sample might use 8, 12, 8, 2 and 5, repeating observation 8. Repeats are not a flaw in the procedure. They are the procedure.
Five bootstrap samples are drawn, each of size five, from an original sample of twenty observations.
The iid bootstrap suits observations that are independent through time, which is defensible in places. Take the S&P 500 during 2005 or during 2017, both calm years with low volatility: the distribution of daily returns looks much the same in January as in December, so picking days at random does no damage. Financial data are more often dependent through time, and resampling single days destroys the structure that matters.
The circular block bootstrap, usually shortened to CBB, is the simplest repair. Rather than drawing one observation at a time, it draws blocks of q consecutive observations with replacement, and whatever dependence lives inside a block travels into the bootstrap sample untouched.
The word circular describes what happens at the end of the data. With 100 observations and a block size of 10 there are 100 blocks, not 91. The first 91 hold ten consecutive observations each, and the last nine wrap around, as though observation one followed observation 100, so the block starting at observation 92 finishes with observations 1 through 9.
Blocks are drawn with replacement until the sample is long enough, and if they overshoot the last observations are discarded: with a block size of ten and a target sample of 75, eight blocks are selected and the final five observations dropped. The block length q has to be long enough to capture the dependence and short enough to leave a decent number of distinct blocks, and the usual rule of thumb sets it at the square root of the sample size.
Bootstrapping a value-at-risk estimate
In the leading application, market risk, the p-value-at-risk is the loss level the portfolio exceeds with probability 1 less p over a stated horizon.
A one-year figure for the S&P 500 needs many simulated copies of a trading year, which is 252 days, drawn from returns running from 1969 until 2018. Each replication sums 252 bootstrapped daily log returns into an annual return, and the estimate is the empirical quantile at position 1 less p multiplied by b. Only one replication in a thousand falls below the 0.1% quantile, so an extreme quantile needs a very large count.
The two bootstraps disagree instructively. The CBB returns larger value-at-risk figures deep in the tail and smaller ones at the 5% and 10% quantiles. Volatility clustering explains it: assets pass through stretches where volatility runs persistently above its long-run average, as in 2002 or 2008, and stretches where it runs below, as in 2005 or 2017. An iid bootstrap picks days from the whole history, so a simulated year comes out too balanced to be realistic, while the CBB keeps a high or low volatility stretch intact. The two densities cross close to the 2% quantile, and of the most extreme 1% of simulated annual returns just 36 percent came from the iid bootstrap.
Two situations make a bootstrap unreliable, and both reduce to one assumption: that the present resembles the past.
The first is a current state unlike the normal state. A bootstrap draws on the whole data set, a virtue when conditions are stable and a problem when they are not. Many assets reached record levels of volatility during the financial crisis of 2008, and a bootstrap estimating value-at-risk in October 2008 would have drawn most of its observations from calmer years.
The second is structural change, where the present is genuinely different rather than merely more turbulent. Consider the interest rate on short-term United States government debt, which sat near zero from late 2008 until 2015, held there by market conditions and by interventions from the Federal Reserve. No amount of resampling from earlier history could produce samples with rates near zero for an extended stretch, because such a period had never occurred.
Using a bootstrap therefore means understanding the dependence in the observed data and picking a method that reproduces it. Where the resampling scheme fails, statistics built from the samples miss the sampling variation present in the data, and the intervals they produce mislead.
What simulation gives up in exchange
Monte Carlo carries its own weaknesses, and the largest is specifying the DGP. If the assumed process describes the data poorly, the approximated moment is unreliable however many replications run, and misspecification enters through the distributions chosen, the dynamics assumed, and imprecise parameter estimates. Poor models produce wrong answers with impressive precision.
Computational cost is the second drawback. A single run of a simple DGP takes almost no time, but a study running many experiments, say to trace how an option price responds to each parameter in turn, gets slow enough to constrain what an analyst can explore, and that limits how much testing the specification receives. Where an analytical expression exists it should be preferred.
A final limitation is shared. Neither method produces outcomes unlike those in the data behind it, which goes by the name of the Black Swan problem. A bootstrap is the more exposed, since a bootstrap sample cannot contain a value that never occurred, while a well chosen statistical model can allow future losses larger than any realised, provided its tails permit it.
| Monte Carlo simulation | Bootstrapping | |
|---|---|---|
| Source of simulated data | A full DGP set by the user | Resampling of the observed data |
| Main failure mode | A misspecified distribution | A past unlike the present |
| Outcomes beyond the sample | Possible where the tails allow | Impossible by construction |
Underneath the differences the procedure is identical: build a sample, compute the statistic, repeat until b replications exist, and estimate the quantity from those values. A simulation is only as good as its DGP, and a bootstrap only as good as its resampling scheme.