A wealth path is a chronological sequence of portfolio wealth values representing one simulated financial trajectory. In a Monte Carlo model, a two-dimensional array stores many paths: each row is a simulation and each column is a year, beginning with initial wealth. section 5.5
Retirement simulation
With $1.2 million initially, annual spending of $60,000, 2% inflation, and normally distributed portfolio returns averaging 6% with 12% standard deviation, each path updates wealth after spending and investment returns. Thirty-year paths reveal whether the retiree reaches bankruptcy; the illustrated simulation estimates a 48.09% bankruptcy probability. section 5.5
Listing 5.4 Simulating paths of wealth
np.random.seed(123)
num_years = 30
num_sims = 10000
mean = 0.06
stdev = 0.12
spending_0 = 60000
W0 = 1200000
inflation = 0.02
ret = np.random.normal(loc=mean, scale=stdev, size=(num_sims, num_years+1))
W = np.empty(shape=[num_sims, num_years+1])
W[:,:] = np.NaN
W[:,0] = W0 #1
count_bankrupt = 0 #2
for sim in range(num_sims):
spending = spending_0
for year in range(1, num_years+1):
# Check whether you run out of money
next_period_wealth = (W[sim, year-1] - spending) * (1 + ret[sim, year]) #3
if next_period_wealth < 0:
count_bankrupt += 1
break
else:
W[sim, year] = next_period_wealth
spending = spending * (1 + inflation) #4
plt.xlabel('Year')
plt.ylabel('Wealth')
plt.plot(W[0:10,:].T); #5
Inspect the complete Python implementation for generating wealth paths, detecting bankruptcy, and plotting sample trajectories. section 5.5
Wealth paths also determine how an allocation policy should respond over time. A dynamic-programming solution evaluates good, medium, and bad paths, showing that optimal stock exposure can decline as wealth advances toward a goal or rise when wealth falls behind. section 6.2.1
