{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Sudden Stop Model\n", "\n", "In this notebook we replicate the baseline model exposed in \n", "\n", "`From Sudden Stops to Fisherian Deflation, Quantitative Theory and Policy` by __Anton Korinek and Enrique G. Mendoza__\n", "\n", "The file `sudden_stop.yaml` which is printed below, describes the model, and must be included in the same directory as this notebook." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## importing necessary functions" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from matplotlib import pyplot as plt\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from dolo import *\n", "from dolo.algos import time_iteration\n", "from dolo.algos import plot_decision_rule, simulate" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## writing the model" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "'/home/pablo/Mobilhome/econforge/dolo/examples/notebooks'" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pwd" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", "
1\n",
" 2\n",
" 3\n",
" 4\n",
" 5\n",
" 6\n",
" 7\n",
" 8\n",
" 9\n",
"10\n",
"11\n",
"12\n",
"13\n",
"14\n",
"15\n",
"16\n",
"17\n",
"18\n",
"19\n",
"20\n",
"21\n",
"22\n",
"23\n",
"24\n",
"25\n",
"26\n",
"27\n",
"28\n",
"29\n",
"30\n",
"31\n",
"32\n",
"33\n",
"34\n",
"35\n",
"36\n",
"37\n",
"38\n",
"39\n",
"40\n",
"41\n",
"42\n",
"43\n",
"44\n",
"45\n",
"46\n",
"47\n",
"48\n",
"49\n",
"50\n",
"51\n",
"52\n",
"53\n",
"54\n",
"55\n",
"56\n",
"57\n",
"58\n",
"59\n",
"60\n",
"61\n",
"62\n",
"63\n",
"64 | # This file adapts the model described in\n", "# "From Sudden Stops to Fisherian Deflation, Quantitative Theory and Policy"\n", "# by Anton Korinek and Enrique G. Mendoza\n", "\n", "name: Sudden Stop (General)\n", "\n", "symbols:\n", "\n", " exogenous: [y]\n", " states: [l]\n", " controls: [b, lam]\n", " values: [V, Vc]\n", " parameters: [beta, R, sigma, a, mu, kappa, delta_y, pi, lam_inf]\n", "\n", "\n", "definitions:\n", " c: 1 + y + l*R - b\n", "\n", "equations:\n", "\n", " transition:\n", " - l = b(-1)\n", "\n", " arbitrage:\n", " - lam = b/c\n", " - 1 - beta*(c(1)/c)^(-sigma)*R | lam_inf <= lam <= inf\n", "\n", " value:\n", " - V = c^(1.0-sigma)/(1.0-sigma) + beta*V(1)\n", " - Vc = c^(1.0-sigma)/(1.0-sigma)\n", "\n", "calibration:\n", "\n", " beta: 0.95\n", " R: 1.03\n", " sigma: 2.0\n", " a: 1/3\n", " mu: 0.8\n", " kappa: 1.3\n", " delta_y: 0.03\n", " pi: 0.05\n", " lam_inf: -0.2\n", " y: 1.0\n", " c: 1.0 + y\n", " b: 0.0\n", " l: 0.0\n", " lam: 0.0\n", "\n", " V: c^(1.0-sigma)/(1.0-sigma)/(1.0-beta)\n", " Vc: c^(1.0-sigma)/(1.0-sigma)\n", "\n", "\n", "exogenous: !MarkovChain\n", " values: [[ 1.0-delta_y ], # bad state\n", " [ 1.0 ]] # good state\n", " transitions: [[ 0.5, 1-0.5 ], # probabilities [p(L|L), p(H|L)]\n", " [ 0.5, 0.5 ]] # probabilities [p(L|H), p(H|H)]\n", "\n", "domain:\n", " l: [-1, 1]\n", "\n", "options:\n", " grid: !Cartesian\n", " orders: [10]\n", " |
| Model | \n", "|
| name | \n", "Sudden Stop (General) | \n", "
| type | \n", "dtcc | \n", "
| filename | \n", "../models/sudden_stop.yaml | \n", "
| Type | Equation | Residual |
| transition | $l_{t} = b_{t-1}$ | 0.000 |
| arbitrage | $\\lambda_{t} = \\frac{b_{t}}{c_{t}}$ | 0.000 |
| $1 - \\beta \\; \\left(\\frac{c_{t+1}}{c_{t}}\\right)^{- \\sigma} \\; R$ | 0.0215 | |
| value | $V_{t} = \\frac{c_{t}^{1.0 - \\sigma}}{1.0 - \\sigma} + \\beta \\; V_{t+1}$ | |
| $Vc_{t} = \\frac{c_{t}^{1.0 - \\sigma}}{1.0 - \\sigma}$ | ||
| controls_lb | $- inf$ | |
| $\\lambda_{inf}$ | ||
| controls_ub | $inf$ | |
| $inf$ | ||
| definitions | $c_{t} = 1 + y_{t} + l_{t} \\; R - b_{t}$ |