Sub topic 14
Stress-testing the assumptions
This chapter assumes you can read the Python functions nest_egg and monthly_saving from the earlier chapters. It also assumes you know the inputs they take: spending, inflation, other income, withdrawal rate, return, years and current balance. Here you stop treating those inputs as facts. You will vary them on purpose and see which ones move the monthly target the most.
Why one number is not enough
Your monthly saving target is the output of a chain of guesses. Inflation over 30 years is a guess. So is the return on your investments, and so is the withdrawal rate that will be safe in your retirement. The formula gives an exact answer, but only for the exact inputs you typed in.
Stress-testing means running the same calculation with different inputs. It answers two questions:
- Which assumptions change the answer the most?
- How much extra saving buys safety if the assumptions turn out wrong?
This turns "I need $2,416 a month" into "I need about $2,400 a month. If returns disappoint, I may need $3,500."
Set a baseline
Every test needs a reference point. Use a simple, plausible case and keep it fixed:
- Spending today: $40,000 per year, with no other income.
- Years to retirement: 30.
- Inflation: 3% per year.
- Withdrawal rate: 4%.
- Nominal return: 6% per year, compounded monthly.
- Current balance: $0.
With these inputs the nest egg is about $2,427,000 in future dollars. The monthly saving, paid at the end of each month, is about $2,416.
Change one input at a time
The cleanest method is to change one input, hold the others at baseline, and record the new monthly target. This isolates the effect of each assumption. The script below defines the two core functions again so that it runs on its own.
def nest_egg(annual_spend_today, years, inflation, other_income_today=0.0, withdrawal_rate=0.04):
"""Nest egg needed at retirement, in future dollars."""
need_today = max(annual_spend_today - other_income_today, 0.0)
need_future = need_today * (1 + inflation) ** years
return need_future / withdrawal_rate
def monthly_saving(target, years, annual_return, current_balance=0.0):
"""Level monthly contribution, paid at the end of each month, that reaches target."""
n = years * 12
r = annual_return / 12
balance_future = current_balance * (1 + r) ** n
gap = max(target - balance_future, 0.0)
if r == 0:
return gap / n
return gap * r / ((1 + r) ** n - 1)
BASE = {
"spend": 40_000,
"years": 30,
"inflation": 0.03,
"withdrawal": 0.04,
"ret": 0.06,
"balance": 0.0,
}
def target_monthly(p):
egg = nest_egg(p["spend"], p["years"], p["inflation"], withdrawal_rate=p["withdrawal"])
return monthly_saving(egg, p["years"], p["ret"], p["balance"])
tests = [
("Baseline", {}),
("Return 4%", {"ret": 0.04}),
("Return 8%", {"ret": 0.08}),
("Inflation 4%", {"inflation": 0.04}),
("Withdrawal 3.5%", {"withdrawal": 0.035}),
("Spending +20%", {"spend": 48_000}),
]
base_value = target_monthly(BASE)
print(f"{'Scenario':<18}{'Monthly':>10}{'Change':>10}")
for name, change in tests:
value = target_monthly({**BASE, **change})
print(f"{name:<18}{value:>10,.0f}{value / base_value - 1:>+10.0%}")The script uses a dictionary merge, {**BASE, **change}. It copies the baseline and overwrites only the keys in change, so each scenario touches one input.
Reading the results
Running the script gives roughly these monthly targets for the scenarios above:
| Scenario | Monthly target (approx.) | Change from baseline |
|---|---|---|
| Baseline | $2,416 | none |
| Return 4% | $3,497 | about +45% |
| Return 8% | $1,629 | about −33% |
| Inflation 4% | $3,229 | about +34% |
| Withdrawal rate 3.5% | $2,762 | about +14% |
| Spending +20% | $2,899 | +20% |
Three patterns appear.
Return and inflation dominate. A two-point change in return moves the target by a third to a half. A one-point change in inflation moves it by a third. Both act over 30 years, so a small yearly difference compounds into a large final difference.
The effect is not symmetric. Lowering the return by two points raises the target by about $1,080. Raising it by two points lowers it by about $790. Because of compounding, bad outcomes hurt more than good outcomes help. A plan that only works at the optimistic return has little margin.
Spending scales linearly. Spending 20% more means saving 20% more. The formula multiplies spending straight through, so there is no hidden leverage. This makes spending the assumption you can influence most directly.
Inflation and return move together
Inflation and nominal return are not independent. Higher inflation tends to come with higher nominal returns, because interest rates and asset prices adjust over time. If you raise inflation to 4% but leave the return at 6%, you are testing a harsh scenario in which investors fail to keep up with rising prices.
A cleaner way to view this is the real return, which is the return after inflation. It is roughly the nominal return minus inflation. The baseline has a real return of about 3%. You can test pairs instead of single inputs:
- 6% return with 3% inflation: real return about 3%.
- 7% return with 4% inflation: real return about 3%. The monthly target is higher than the baseline because the future-dollar nest egg is larger, but not as high as the 4%-inflation-only test above.
- 5% return with 4% inflation: real return about 1%. This is a stagflation-style stress test and is the most punishing combination.
Test the plan, not only the target
The scenarios above ask "what must I save?" There is a second question: "I already decided to save $2,416. What happens if returns are lower?" The next script answers it by simulating the baseline contribution at several returns and comparing the result with the target.
def simulate(monthly, years, annual_return, balance=0.0, annual_raise=0.0):
"""Month-by-month balance with end-of-month contributions that rise once a year."""
r = annual_return / 12
for month in range(years * 12):
if month > 0 and month % 12 == 0:
monthly *= 1 + annual_raise
balance = balance * (1 + r) + monthly
return balance
egg = nest_egg(40_000, 30, 0.03)
plan = monthly_saving(egg, 30, 0.06)
print(f"Target nest egg: {egg:,.0f}")
for ret in (0.03, 0.04, 0.05, 0.06, 0.07):
final = simulate(plan, 30, ret)
print(f"Return {ret:.0%}: balance {final:>12,.0f} ({final / egg:.0%} of target)")At a 4% return the same contribution reaches only about 69% of the target. Read this as a funding ratio, which is the share of the goal your plan reaches. A ratio near 100% means the plan survives that scenario. A ratio of 70% tells you how large the shortfall is, and you can respond to it in three ways:
- Save more, using the higher monthly target from the table.
- Retire later, which adds years of contributions and growth and shortens the withdrawal period.
- Spend less in retirement, which lowers the nest egg directly.
Withdrawal rate: a choice, not a measurement
The 4% rule is a rule of thumb from historical studies of US portfolios over about 30-year retirements. It is not a law. A lower rate gives more safety and a larger required nest egg.
The nest egg is the future-dollar spending divided by the rate. So the required nest egg scales with the inverse of the rate. Moving from 4% to 3.5% multiplies it by 4 / 3.5, about 1.14. Moving from 4% to 3% multiplies it by 1.33. Early retirement with a 40-year horizon is a common reason to choose a lower rate.
Choosing a safety margin
You need a decision rule for what to do with the results. These are three common approaches:
- Plan on the conservative case. Use the low-return scenario as your savings target. You will probably end up with more than you need, which is a safer error than ending up with less.
- Plan on the baseline and review often. Save the baseline amount and recheck every year. Adjust when real results drift. This works if you have time to correct.
- Plan on the baseline with a buffer. Add a fixed percentage, such as 10%, to the monthly target.
The right choice depends on how flexible you are. If you can work longer or cut spending, a baseline plan with regular reviews is reasonable. If you cannot, plan on the conservative case.
Common errors
- Testing only the favorable direction. If you only try higher returns, you learn nothing about risk.
- Changing several inputs at once without saying so. Then you cannot tell which change caused the result.
- Mixing nominal and real values. If you use a real return, do not also inflate the contributions or spending a second time.
- Treating the stress test as a forecast. The scenarios show a range. They do not assign probabilities.
- Ignoring sequence risk. The simulation uses a constant return every year. Real returns vary, and a bad stretch just before retirement does more damage than the same average spread evenly. A fixed-return test cannot show this, so keep a margin beyond what it suggests.
Exercise
Using the baseline (spend $40,000, 30 years, 3% inflation, 4% withdrawal, no balance), you save the baseline monthly amount computed at a 6% return. Without running code, which is the larger risk to the plan: the actual return being 2 points lower, or 2 points higher? Which function from this chapter would you call to measure the shortfall, and what ratio would you report?
Show answer
The lower return is the larger risk. Compounding makes the loss from a lower return bigger than the gain from an equally higher one. The table shows the target rising by about 45% at 4% but falling by about 33% at 8%. To measure it, call simulate(plan, 30, 0.04), where plan is the baseline monthly saving, and divide the result by the target nest egg from nest_egg. That ratio is the funding ratio, about 69% in this case.