#!/usr/bin/env python # coding: utf-8 # # Monetary Economics: Chapter 4 # ### 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. get_ipython().run_line_magic('matplotlib', 'inline') import matplotlib.pyplot as plt from pysolve.model import Model from pysolve.utils import is_close,round_solution # ### Model PC # In[2]: def create_pc_model(): model = Model() model.set_var_default(0) model.var('Bcb', desc='Government bills held by the Central Bank') model.var('Bh', desc='Government bills held by households') model.var('Bs', desc='Government bills supplied by the government') model.var('C', desc='Consumption goods') model.var('Hh', desc='Cash held by households') model.var('Hs', desc='Cash supplied by the central bank') model.var('R', desc='Interest rate on government bills') model.var('T', desc='Taxes') model.var('V', desc='Household wealth') model.var('Y', desc='Income = GDP') model.var('YD', desc='Disposable income of households') model.param('alpha1', desc='Propensity to consume out of income', default=0.6) model.param('alpha2', desc='Propensity to consume out of wealth', default=0.4) model.param('lambda0', desc='Parameter in asset demand function', default=0.635) model.param('lambda1', desc='Parameter in asset demand function', default=5.0) model.param('lambda2', desc='Parameter in asset demand function', default=0.01) model.param('theta', desc='Tax rate', default=0.2) model.param('G', desc='Government goods', default=20.) model.param('Rbar', desc='Interest rate as policy instrument') model.add('Y = C + G') # 4.1 model.add('YD = Y - T + R(-1)*Bh(-1)') # 4.2 model.add('T = theta*(Y + R(-1)*Bh(-1))') #4.3, theta < 1 model.add('V = V(-1) + (YD - C)') # 4.4 model.add('C = alpha1*YD + alpha2*V(-1)') # 4.5, 0