Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add python/julia codes for solving NK Model in CLMM #53

Merged
merged 3 commits into from
Jul 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions NKModel_CLMM_Model.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# A stylized New Keynesian Model\n",
"\n",
"This notebook is part of a computational appendix that accompanies the paper.\n",
"\n",
"> MATLAB, Python, Julia: What to Choose in Economics? \n",
">> Coleman, Lyon, Maliar, and Maliar (2017)\n",
"\n",
"In this notebook we summarize the key equations for the stylized New Keynesian model we solved in the paper.\n",
"\n",
"For more information on the model itself see section 5 of \n",
"\n",
"> Maliar, L., & Maliar, S. (2015). Merging simulation and projection approaches to solve high-dimensional problems with an application to a new Keynesian model. Quantitative Economics, 15(7), 424. http://doi.org/10.1186/s13059-014-0424-0"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The model features Calvo-type price frictions and a\n",
"Taylor (1993) rule. The economy is populated by households, final-good\n",
"firms, intermediate-good firms, a monetary authority and government.\n",
"\n",
"In the equations below, the following variables appear:\n",
"\n",
"- $\\pi$: profit of intermediate good firms\n",
"- $S$, $F$: intermediate variables introduced to help notation below\n",
"- $C$: Consumption\n",
"- $G$: Level of government spending\n",
"- $Y$: Final goods production\n",
"- $L$: Labor supply\n",
"- $\\Delta$: measure of price dispersion across firms (also referred to as efficiency distortion)\n",
"- $Y_N$: Natural level of final goods production -- it is the level of $Y$ in the planner's solution, or the level of $Y$ in the model without distorting taxes.\n",
"- $\\bar{G}$: steady-state share of government spendint in output\n",
"- $R$: gross nominal interest rate\n",
"- $\\eta_u$: exogenous preference shock to utility\n",
"- $\\eta_L$: exogenous preference shock to labor dis-utility\n",
"- $\\eta_B$: exogenous premium on bond returns\n",
"- $\\eta_a$: log of productivity of intermediate goods firms\n",
"- $\\eta_G$: government spending shock\n",
"- $\\eta_R$: monetary shock to interest rate\n",
"\n",
"We also see the following parameters:\n",
"\n",
"- $\\beta$: discount factor\n",
"- $\\varepsilon$: Parameter in Dixit-Stiglitz aggregator over intermediate goods\n",
"- $\\theta$: Calvo-parameter -- a fraction (1-$\\theta$) of firms set prices optimally each period.\n",
"- $\\gamma$, $\\vartheta$: utility function parameters\n",
"- $\\pi^*$: target inflation\n",
"- $\\phi_y$, $\\phi_{\\pi}$, $\\mu$: Taylor rule parameters"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In our computation we will approximate $S_t$, $F_t$ and $C_t$ using a complete monomial of degree N. Given these three variables, we express the equilibrium conditions of the model in the following way:\n",
"\n",
"\\begin{eqnarray}\n",
"\\pi_{t} &=& \\left(\\frac{1-(1-\\theta)}{\\theta}\\left(\\frac{S_t}{F_t}\\right)^{1- \\varepsilon}\\right)^{\\frac{1}{\\varepsilon-1}} \\\\\n",
"\\Delta _{t} &=&\\left[ \\left( 1-\\theta \\right) \\left[ \\frac{1-\\theta \\pi\n",
"_{t}^{\\varepsilon -1}}{1-\\theta }\\right] ^{\\frac{\\varepsilon }{\\varepsilon -1%\n",
"}}+\\theta \\frac{\\pi _{t}^{\\varepsilon }}{\\Delta _{t-1}}\\right] ^{-1} \\\\\n",
"Y_t &=& \\frac{C_t}{1-\\frac{\\bar{G}}{\\exp\\left(\\eta_{G,t}\\right)}} \\\\\n",
"L_t &=& \\frac{Y_t }{\\exp\\left(\\eta_{a,t}\\right) \\Delta_t} \\\\\n",
"Y_{N,t} &=& \\left[ \\frac{\\exp \\left( \\eta _{a,t}\\right) ^{1+\\vartheta }\\left[1- \\frac{\\bar{G}}{\\exp \\left( \\eta _{G,t}\\right)} \\right] ^{-\\gamma}}{\\exp \\left( \\eta_{L,t}\\right) }\\right] ^{\\frac{1}{\\vartheta +\\gamma }}\\\\\n",
"R_{t} &=& \\max \\left\\{1, \\frac{\\pi^*}{\\beta} \\left(R_{t-1} \\frac{\\beta}{\\pi^*} \\right)^{\\mu} \\left(\\left(\\frac{\\pi_t}{\\pi^*}\\right)^{\\phi_{\\pi}} \\left(\\frac{Y_t}{Y_{N,t}} \\right)^{\\phi_y} \\right)^{1-\\mu}\\exp\\left(\\eta_{R,t}\\right) \\right\\}.\n",
"\\end{eqnarray}\n",
"\n",
"The Euler equations are given by\n",
"\n",
"\\begin{eqnarray}\n",
"S_{t} &=&\\frac{\\exp \\left( \\eta _{u,t}+\\eta _{L,t}\\right) }{\\left[ \\exp\n",
"\\left( \\eta _{a,t}\\right) \\right] ^{\\vartheta +1}}\\frac{\\left(\n",
"G_{t}^{-1}C_{t}\\right) ^{1+\\vartheta }}{\\left( \\Delta _{t}\\right)\n",
"^{\\vartheta }}+\\beta \\theta E_{t}\\left \\{ \\pi _{t+1}^{\\varepsilon\n",
"}S_{t+1}\\right \\} \\\\\n",
"F_{t} &=&\\exp \\left( \\eta _{u,t}\\right) C_{t}^{1-\\gamma }G_{t}^{-1}+\\beta\n",
"\\theta E_{t}\\left \\{ \\pi _{t+1}^{\\varepsilon -1}F_{t+1}\\right \\} \\\\\n",
"C_{t}^{-\\gamma } &=&\\beta \\frac{\\exp \\left( \\eta _{B,t}\\right) }{\\exp \\left(\n",
"\\eta _{u,t}\\right) }R_{t}E_{t}\\left[ \\frac{C_{t+1}^{-\\gamma }\\exp \\left(\n",
"\\eta _{u,t+1}\\right) }{\\pi _{t+1}}\\right]\n",
"\\end{eqnarray}"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Loading