A budget constraint limits consumption and investment by defining how wealth evolves: next-period wealth equals current wealth minus consumption, multiplied by investment returns. The formulation supports numerical optimization of discounted consumption utility over asset allocation and spending decisions. section 6.3.2
Spending and investment over time
With initial wealth of 1,000,000 over ten periods, the model chooses stock allocation and consumption percentage at each wealth–time state. Consumption reduces investable wealth before stock and bond returns apply; labor income can be added to the constraint. section 6.3.2
Listing 6.8 DP solution for the spending example
nA = 11
nC = 40
V = np.zeros((nW, T+1))
A = np.zeros((nW, T))
C = np.zeros((nW, T)) #1
EV = np.zeros((nA, nC))
W_midpts = compute_midpoints(W)
gamma = 0.95 #2
CRRA = 3 #3
def utility(c): #4
if (CRRA == 1):
util = log(c)
else:
util = (c**(1-CRRA))/(1-CRRA)
return util
for j in range(nW):
V[j, T] = utility(W[j,T]) #5
for t in range(T-1, -1, -1):
for j in range(nW):
for a in range(nA):
for c in range(nC):
cons = (c+1)/(1.5*nC)*W[j,t] #6
W_tplus1_dist = compute_transition_probs(W[j,t]-cons, t, #7
a W_midpts)
EV[a,c] = np.dot(W_tplus1_dist, utility(cons)+gamma*V[:,t+1]) #8
V[j,t] = EV.max()
A[j,t], C[j,t] = np.unravel_index(EV.argmax(), EV.shape) #9
The implementation enumerates wealth states, asset allocations, and forty consumption levels, then selects actions using dynamic programming and utility values. section 6.3.2
