Monetary Economics: Chapter 7

Preliminaries


In [1]:
# This line configures matplotlib to show figures embedded in the notebook, 
# instead of opening a new window for each figure. More about that later. 
# If you are using an old version of IPython, try using '%pylab inline' instead.
%matplotlib inline

from pysolve.model import Model
from pysolve.utils import is_close,round_solution

import matplotlib.pyplot as plt

Model BMWK


In [2]:
def create_bmwk_model():
    model = Model()

    model.set_var_default(0)
    model.var('AF', desc='Amortization funds')
    model.var('Cd', desc='Consumption goods demand by households')
    model.var('Cs', desc='Consumption goods supply')
    model.var('DA', desc='Depreciation allowance')
    model.var('K', desc='Stock of capital')
    model.var('Kt', desc='Target stock of capital')
    model.var('Ld', desc='Demand for bank loans')
    model.var('Ls', desc='Supply of bank loans')
    model.var('Id', desc='Demand for investment goods')
    model.var('Is', desc='Supply of investment goods')
    model.var('Mh', desc='Bank deposits held by households')
    model.var('Ms', desc='Supply of bank deposits')
    model.var('Nd', desc='Demand for labor')
    model.var('Ns', desc='Supply of labor')
    model.var('Rl', desc='Rate of interest on bank loans')
    model.var('Rm', desc='Rate of interest on bank deposits')
    model.var('W', desc='Wage rate')
    model.var('WBd', desc='Wage bill - demand')
    model.var('WBs', desc='Wage bill - supply')
    model.var('Y', desc='Income = GDP')
    model.var('YD', desc='Disposable income of households')
    
    model.set_param_default(0)
    model.param('alpha0', desc='Exogenous component in consumption')
    model.param('alpha1r', desc='Propensity to consume out of interest income')
    model.param('alpha1w', desc='Propensity to consume out of wage income')
    model.param('alpha2', desc='Propensity to consume out of wealth')
    model.param('delta', desc='Depreciation rate')
    model.param('gamma', desc='Speed of adjustment of capital to its target value')
    model.param('kappa', desc='Capital-output ratio')

    model.param('PR', desc='Labor productivity')
    model.param('Rlbar', desc='Rate of interest on bank loans, set exogenously')

    # Basic behavioural equations
    model.add('Cs = Cd')
    model.add('Is  = Id')
    model.add('Ns = Nd')
    model.add('Ls - Ls(-1) = Ld - Ld(-1)')
    model.add('Y = Cs + Is')
    model.add('WBd = Y - Rl(-1)*Ld(-1) - AF')
    model.add('AF = delta * K(-1)')
    model.add('Ld - Ld(-1) = Id - AF')
    
    # Transactions of households
    model.add('YD = WBs + Rm(-1)*Mh(-1)')
    model.add('Mh - Mh(-1) = YD - Cd')
    
    # Transactions of the banks
    model.add('Ms - Ms(-1) = Ls - Ls(-1)')
    model.add('Rm = Rl')
    
    # The wage bill
    model.add('WBs = W * Ns')
    model.add('Nd = Y / PR')
    model.add('W = WBd / Nd')
    
    # Household behavior
    model.add('Cd = alpha0 + alpha1w*WBs + alpha1r*Rm(-1)*Mh(-1) + alpha2*Mh(-1)')
    
    # The investment beahavior
    model.add('K - K(-1) = Id - DA')
    model.add('DA = delta * K(-1)')
    model.add('Kt = kappa * Y(-1)')
    model.add('Id = gamma * (Kt - K(-1)) + DA')
    
    # The behaviour of banks
    model.add('Rl = Rlbar')    

    return model

bmwk_parameters = {'alpha0': 25,
                   'alpha1r': 0.5,
                   'alpha1w': 0.75,
                   'alpha2': 0.1,
                   'delta': 0.1,
                   'gamma': 0.15,
                   'kappa': 1}
bmwk_exogenous = {'PR': 1,
                  'Rlbar': 0.04}
bmwk_variables = {'Mh': 185.2,
                  'Ms': 185.2,
                  'Ld': 185.2,
                  'Ls': 185.2,
                  'K': 185.2,
                  'Y': 185.2,
                  'Rl': 0.04,
                  'Rm' : 0.04,
                  'W': 0.86,
                  'Cd': 1}

Scenario: Model BMWK, increase in the interest rate on loans


In [3]:
interest = create_bmwk_model()
interest.set_values(bmwk_parameters)
interest.set_values(bmwk_exogenous)
interest.set_values(bmwk_variables)

# run to convergence
# Give the system more time to reach a steady state
for _ in xrange(15):
    interest.solve(iterations=200, threshold=1e-5)

# shock the system
interest.set_values({'Rlbar': 0.05})

for _ in xrange(40):
    interest.solve(iterations=100, threshold=1e-5)
Figure 7.8

In [4]:
caption = '''
    Figure 7.8  Evolution of Gross Domestic Income $(Y)_{t}$, following an
    increase in the interest rate, in model BMWK'''
data = [s['Y'] for s in interest.solutions[5:]]

fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 1.1, 1.1])
axes.tick_params(top='off', right='off')
axes.spines['top'].set_visible(False)
axes.spines['right'].set_visible(False)
axes.set_ylim(180, 186)

axes.plot(data, linestyle='-', color='b')
# add labels
plt.text(20, 182, 'National income')
         
fig.text(0.1, -.05, caption);



In [ ]: