Sub topic 9
Monte Carlo simulation and its limits
This chapter assumes you have read the earlier chapters on real versus nominal returns, sequence-of-returns risk, and deterministic projections. You should be comfortable with percentages, compound growth, and reading short Python programs. The code uses only the standard library.
Why a single projection is not enough
The deterministic projection from the previous chapter applies one return every year. A portfolio that earns 5% every year is easy to model, but no real market behaves that way. Two portfolios can both average 5% over 30 years and end in very different places. The one that suffers its losses early, while the retiree is withdrawing, can run out of money. The one that suffers them late can leave a large balance.
Monte Carlo simulation addresses this. Instead of one path, you generate thousands of random return paths and run the same withdrawal plan through each. You then count how many paths fund the plan to the end of the horizon. The share that does is usually called the success rate, and the share that does not is the failure rate, or probability of ruin.
The basic procedure
Each simulated retirement follows these steps:
- Start with a balance, a first-year spending amount, and a planning horizon in years.
- At the start of each year, withdraw spending. If the balance goes below zero, record a failure and stop.
- Draw a random nominal return for the year and apply it to the remaining balance.
- Raise next year's spending by inflation.
- If the loop reaches the horizon, record a success.
Repeat this many times, usually 1,000 to 10,000. The success rate is successes divided by trials.
A working simulation
The code below uses the same timing as the deterministic years_funded function. Spending comes out at the start of the year, the remainder grows, and spending then rises with inflation. The only change is that the return is drawn from a normal distribution instead of being fixed.
import random
def survives(balance, spending, mean_return, stdev, inflation, years, rng):
for _ in range(years):
balance -= spending
if balance < 0:
return False
annual_return = max(-1.0, rng.gauss(mean_return, stdev))
balance *= 1 + annual_return
spending *= 1 + inflation
return True
def success_rate(balance, spending, mean_return, stdev, inflation,
years, trials=10000, seed=42):
rng = random.Random(seed)
wins = sum(
survives(balance, spending, mean_return, stdev, inflation, years, rng)
for _ in range(trials)
)
return wins / trials
for stdev in (0.0, 0.08, 0.12, 0.16):
rate = success_rate(1000000, 40000, 0.05, stdev, 0.03, 30)
print(f"volatility {stdev:.2f}: success rate {rate:.1%}")Three details matter here:
- The seed.
random.Random(seed)makes the run repeatable. Without a fixed seed, the success rate changes slightly on each run because of sampling noise. - The
max(-1.0, ...)clamp. A return below -100% would be impossible, because you cannot lose more than everything. At these volatilities the clamp almost never triggers, but it keeps the model valid if you try larger values. - The zero-volatility row. With a standard deviation of zero, every trial is identical to the deterministic projection. That projection funds all 30 years, so this row prints 100.0%. This is a useful check that the simulation reduces to the earlier model.
The rows with volatility above zero should show success rates below 100%, and the rate should fall as volatility rises. The average return is the same in every row, so the drop comes from sequence risk alone. Bad early draws shrink the balance while withdrawals continue, and later good draws apply to a smaller balance.
Reading the output
A result such as "85% success" is easy to misread. Keep these points in mind.
It is a probability under the model, not a forecast. The figure means that 85% of paths generated by your assumptions survived. If the assumptions are wrong, the number is wrong, however precise it looks.
100% is not the goal, and it is not reachable. Pushing the rate toward 100% usually requires very low spending or very high savings. Many planners aim for a high but not perfect rate, and then decide in advance how they would adjust spending in the bad cases. The flexible spending chapter covers those rules.
Failure is not binary in practice. A trial that runs out of money at age 94 is counted the same as one that runs out at age 75. The success rate hides the size and timing of the shortfall. Better reports also show:
- the distribution of ending balances, such as the 10th, 50th, and 90th percentiles
- the typical age at which failing paths run out
- the balance at fixed checkpoints, such as year 10, to show how early the damage appears
Success rates move with small input changes. Moving the mean return from 5% to 4% or the spending from 40,000 to 44,000 can change the rate by many percentage points. Run the simulation across a range of inputs and look at the spread before trusting a single number.
Where the model comes from: key assumptions
Every Monte Carlo tool rests on a few modeling choices. Most of the limits come from these.
| Assumption | What the simple model does | Why it can mislead |
|---|---|---|
| Return distribution | Normal, with fixed mean and standard deviation | Real returns have fat tails, so extreme years happen more often than a normal curve predicts |
| Independence between years | Each year's return is drawn independently | Real markets show clustering of volatility and some long-run mean reversion |
| Constant inflation | One fixed rate, such as 3% | Inflation is random and correlated with returns. High-inflation periods have often coincided with poor bond and stock returns |
| Fixed horizon | 30 years for everyone | The true horizon is random and depends on health and sex. A couple needs a longer horizon than an individual |
| Fixed spending | Spending rises with inflation and never changes | Real retirees cut back after bad markets, and spending often drifts in real terms with age |
| No taxes or fees | Returns are applied gross | Taxes, fund costs, and advisory fees lower the effective return |
The inflation row deserves emphasis for this tutorial. If inflation is a fixed number in the simulation, it cannot show the worst case for a retiree. That case is a stretch of high inflation arriving together with weak real returns on both stocks and bonds. A better model draws inflation and returns together from a joint distribution, or replays historical periods in which both occurred.
Parametric versus historical simulation
There are two common ways to produce the return paths.
Parametric simulation draws returns from a fitted distribution, as in the code above. It can generate an unlimited number of paths and lets you test "what if returns are lower than the past." Its weakness is that the distribution is a simplification, and a poor choice of distribution understates tail risk.
Historical simulation uses actual sequences from the past, such as every 30-year window of real market data. It keeps real features such as clustering, fat tails, and the link between inflation and returns. Its weakness is that the number of independent windows is small. Windows that overlap share most of their data, so 100 years of history gives only a few truly separate 30-year periods. It also assumes the past range of outcomes covers the future range.
A middle option is bootstrapping, which resamples blocks of historical years and strings them together. Keeping blocks of several consecutive years preserves some of the clustering. Many careful analyses run both a parametric and a historical version and compare them.
Modeling longevity inside the simulation
The code above fixes the horizon at 30 years. A more realistic simulation draws the retirement length at random for each trial. You can sample an age at death from a mortality table and stop the trial at that age. This makes the success rate depend on both market risk and longevity risk.
For a couple, the horizon is the longer of the two lifespans. If the two lives are treated as independent, the chance that at least one is alive at a given age is one minus the chance that both are dead. This is the either_survives calculation from earlier in the tutorial. A simulation that uses a single person's lifespan for a couple will understate the length of the spending period.
If you model a single fixed horizon, choose it deliberately. A horizon to age 95 or beyond is common practice because the cost of planning too short is much higher than the cost of planning too long.
Common errors
- Treating the success rate as precise. A reported 83.4% suggests accuracy that the inputs cannot support. Round to the nearest few percent when you talk about it.
- Using too few trials. With 100 trials the success rate can shift by several points between runs. With 10,000 trials the sampling noise is small, though model error remains.
- Forgetting that arithmetic and geometric means differ. If you set the mean of each year's return to the long-run compound growth rate, you understate the average. Volatility drags the compound rate below the arithmetic mean. Decide which mean your input is, and use the arithmetic mean in the draw.
- Mixing real and nominal units. If spending is already in today's dollars, do not also raise it by inflation. Either simulate in nominal terms with inflation-adjusted spending, as above, or simulate in real terms with real returns and flat spending.
- Trusting one tool's default settings. Commercial planners differ in their return assumptions, horizon, and spending rules. Two tools can give 70% and 90% for the same plan. Check what each one assumes before comparing the numbers.
How Monte Carlo fits into the larger plan
Monte Carlo is a way to measure risk, not a way to remove it. It tells you how fragile a withdrawal plan is, and it lets you compare changes. You can add an annuity that covers part of spending, delay public pension claiming, hold inflation-linked bonds, or adopt a rule that cuts spending after bad years. Then you can rerun the simulation and see how much each change moves the success rate and the bad-case outcomes. The final chapter uses this approach to combine the tools.
Exercise
You run the simulation above with a normal return of mean 5% and standard deviation 12%, and it gives a success rate of 80%. You then set the standard deviation to 0 and keep everything else the same. What success rate do you expect, and what does the difference between the two results tell you?
Show answer
With zero volatility every trial produces the same 5% return, so every trial matches the deterministic projection. That projection funds all 30 years for a balance of 1,000,000 and spending of 40,000 rising at 3%, so the success rate is 100%. The 20-point gap between the two runs comes entirely from return volatility and the order in which returns arrive, which is sequence-of-returns risk. The average return was the same in both runs, so the average alone does not explain the failures.
Exercise
A planner runs a Monte Carlo simulation for a married couple using one person's life expectancy of 85 as a fixed horizon, and reports a 90% success rate. Name two reasons the true chance of success is probably lower, and one change to the model that would address them.
Show answer
First, a life expectancy is only the median age at death, so about half of people live past it. A fixed horizon at that age ignores the years in which the plan is most likely to fail. Second, for a couple the relevant horizon is the longer of two lifespans, and the chance that at least one partner reaches a given age is higher than the chance for either alone. Fixing the horizon at one person's life expectancy therefore understates the spending period. The change is to draw a random age at death for each partner in every trial and run the simulation until the second death, or at least to use a conservative fixed horizon such as age 95 or older.