Mathematics for Finance
Simulation
When the formulas run out, let the computer play out thousands of possible futures and count what happens. That's Monte Carlo simulation. Its cousin, the bootstrap, does the same with your own data.
Will the money last?
Example, with made-up numbers. You invest $100,000 for 20 years. Each year's log return averages 6% with a standard deviation of 15%. And you plan to take out $5,000 at the end of every year. What's the chance you end with less than $200,000? With the withdrawals, there's no neat formula.
The idea
Monte Carlo simulation answers it by brute force:
- Model one year: draw a random return from the distribution you believe in.
- Play out one path: 20 years of draws, applying your rules (the withdrawals) each year.
- Repeat thousands of times.
- Count: the middle outcome, the bad 5%, the chance of falling short.
30 of the simulated paths, no withdrawals. The thick line is the middle outcome. The band holds 90% of outcomes.
Quick check
You run 10,000 simulated paths and 1,800 of them end below your target. What's your estimate of the chance of falling short?
Worked example: 10,000 paths
| No withdrawals | |
| Middle outcome (median) | $331,000 |
| Bad 5% ends below | $110,000 |
| Chance of ending below $200,000 | 22.6% |
| With $5,000 taken out each year | |
| Middle outcome | $136,000 |
| Chance of ending below $200,000 | 64% |
| Chance of running out of money | 6.3% |
Check: without withdrawals the price is lognormal, and the exact answers are a $332,000 median and a 22.5% chance of falling short. The simulation lands within a few tenths of a percent. The withdrawals have no such formula, which is where simulation earns its keep.
The bootstrap: simulating from your own data
Monte Carlo needs you to pick a distribution, such as the normal. The bootstrap skips that. Take your 60 actual monthly returns. Draw 60 of them at random, with replacement, so some months repeat and some drop out. Work out the average. Do it 10,000 times. The spread of those averages estimates the standard error, and the middle 95% of them gives a confidence interval, with no bell-curve assumption. It's handy for awkward numbers, like the Sharpe ratio or a worst drawdown, that have no simple standard error formula.
Try it yourself
Run your own retirement simulation.
| Middle outcome | |
| Bad 5% ends below | |
| Chance of ending below the target | |
| Chance of running out of money |
Common mistakes
Three slips beginners make.
- Garbage in, garbage out. A simulation is only as good as its model. Normal returns miss fat tails, so the bad outcomes may be worse than shown.
- Too few runs. With 100 paths, a 5% chance could show as 2% or 9%. The error shrinks like 1 ÷ √(number of runs), so use thousands.
- False precision. "22.6%" sounds exact, but small changes to the average return move it a lot. Try a few assumptions, not just one.
Remember
- Monte Carlo: model one step, play out a path, repeat thousands of times, then count.
- It handles rules no formula can, like withdrawals, but it's only as good as its assumptions.
- The bootstrap resamples your own data, with replacement, to measure how much an estimate could vary.
Check yourself
Three questions. Try them without scrolling up.
1. What makes the bootstrap different from a standard Monte Carlo simulation?
2. Why run 10,000 paths rather than 10?
3. A simulation assumes normal yearly returns. What's its biggest weakness for planning?
Section practice · optional
Inference
9 mixed problems from lessons 19 to 22 · about 12 minutes
The problems aren't labeled with a lesson, so part of the work is choosing the right tool. Work each one on paper, then open the answer.
Yearly returns have a standard deviation of 12%. What's the standard error of a 16-year average?
Show answer
Samples and standard error12 ÷ √16 = 12 ÷ 4 = 3%.That 16-year average is 7%. What's a rough range for the true average?
Show answer
Samples and standard error7 ± 2 × 3: about 1% to 13%. Sixteen years still leaves a wide range.How many years would cut that standard error from 3% to 1%?
Show answer
Samples and standard errorA third of the error needs 3² = 9 times the data: 16 × 9 = 144 years.25 months average 0.5% with a standard deviation of 2%. The 95% critical value for 24 degrees of freedom is 2.064. Find the confidence interval. Does it rule out zero?
Show answer
Confidence intervalsStandard error 2 ÷ 5 = 0.4. Margin 2.064 × 0.4 = 0.83. Interval −0.33% to 1.33%. It includes zero, so no.36 months average 1.5% with a standard deviation of 6%. Find the t-statistic against zero. Is it significant at 5%?
Show answer
Hypothesis testsStandard error 6 ÷ 6 = 1. t = 1.5 ÷ 1 = 1.5. Below about 2 (p ≈ 14%), so not significant.A researcher tests 100 trading rules, none with a real edge, at a 5% cut-off. How many should look significant?
Show answer
Hypothesis testsAbout 5, all by luck. Picking the best of them is data mining.With a million trades, a strategy's edge of 0.001% per trade is significant, with p = 0.04. Should you care?
Show answer
Hypothesis testsProbably not. Huge samples make tiny effects significant. Trading costs would swamp 0.001%. Significant isn't the same as important.Out of 5,000 simulated retirement paths, 600 run out of money. What's the estimated chance of running out?
Show answer
Simulation600 ÷ 5,000 = 12%.Describe how to bootstrap a standard error for the average of 60 monthly returns.
Show answer
SimulationDraw 60 returns with replacement from the 60 you have, and take the average. Repeat thousands of times. The standard deviation of those averages is the bootstrap standard error.
More Statistics on the way
This completes the core path. Try the section practice above while the next topics are written.