alpha_h/(1-alpha_y)*100 import matplotlib.pyplot as plt import numpy as np %matplotlib inline N = 200 alpha_y = 0.9 alpha_h = 0.5 C = np.zeros(N) # consumption Y = np.zeros(N) # income H_h = np.zeros(N) # private wealth C[0] = 0 Y[0] = 0 H_h[0] = 100 for t in range(1, N): # calculate consumer spending C[t] = alpha_y*Y[t-1] + alpha_h*H_h[t-1] # calculate total income (consumer spending plus constant government spending) Y[t] = alpha_h/(1-alpha_y)*H_h[t-1] H_h[t] = H_h[t-1] +(1-alpha_y)*Y[t] - alpha_h*H_h[t-1] fig = plt.figure(figsize=(12, 8)) consumption_plot = fig.add_subplot(131, xlim=(0, N), ylim=(0, np.max(C)*1.1)) consumption_plot.plot(range(N), C, lw=3) consumption_plot.grid() # label axes plt.xlabel('time') plt.ylabel('consumption') income_plot = fig.add_subplot(132, xlim=(0, N), ylim=(0, np.max(Y)*1.1)) income_plot.plot(range(N), Y, lw=3) income_plot.grid() # label axes plt.xlabel('time') plt.ylabel('income') debt_plot = fig.add_subplot(133, xlim=(0, N), ylim=(0,np.max(H_h)*1.5)) debt_plot.plot(range(N), H_h, lw=3) debt_plot.grid() # label axes plt.xlabel('time') plt.ylabel('government debt') # space subplots neatly plt.tight_layout() N = 200 alpha_y = np.zeros(N) alpha_y[0:(N/2)] =0.9 alpha_y[(N/2):-1] =0.85 alpha_h = 0.5 C = np.zeros(N) # consumption Y = np.zeros(N) # income H_h = np.zeros(N) # private wealth C[0] = 0 Y[0] = 0 H_h[0] = 100 for t in range(1, N): # calculate consumer spending C[t] = alpha_y[t]*Y[t-1] + alpha_h*H_h[t-1] # calculate total income (consumer spending plus constant government spending) Y[t] = alpha_h/(1-alpha_y[t])*H_h[t-1] H_h[t] = H_h[t-1] +(1-alpha_y[t])*Y[t] - alpha_h*H_h[t-1] alpha_y = np.zeros(N) alpha_y[0:(N/2)] =0.9 alpha_y[(N/2):-1] =0.8 alpha_y N = 200 alpha_y = 0.9 alpha_h = 0.5 C = np.zeros(N) # nominal consumption c = np.zeros(N) # real consumption Y = np.zeros(N) # nominal income H_h = np.zeros(N) # private wealth sigma_T = 0.5 chi = 0.5 beta = 0.5 y = np.zeros(N) # real production s_e = np.zeros(N) # expected sales s = np.zeros(N) # realised real sales inv = np.zeros(N) # real value of inventories inv_e = np.zeros(N) # expected inventories inv_T = np.zeros(N) # targeted inventories pr = 1 # productivity E = np.zeros(N) # employment WB = np.zeros(N) # wage bill UC = np.zeros(N) # unit cost INV = np.zeros(N) # nominal value of inventories S = np.zeros(N) # realised nominal sales p = np.zeros(N) # price level NHUC = np.zeros(N) # normal historical unit cost C[0] = 0 Y[0] = 0 H_h[0] = 100 for t in range(1, N): # calculate consumer spending C[t] = alpha_y*Y[t-1] + alpha_h*H_h[t-1] # calculate total income (consumer spending plus constant government spending) Y[t] = alpha_h/(1-alpha_y)*H_h[t-1] H_h[t] = H_h[t-1] +(1-alpha_y)*Y[t] - alpha_h*H_h[t-1]