Debian Codegraph @

tests/lmmcp/SMOPEC.mod

raw
1 /*
2 * This file implements a small open economy with impatient agents, i.e. beta<1/(1+r),
3 * but subject to a borrowing constraint d<2. The problem is set up as a
4 * mixed complementarity problem (MCP), requiring a setup of the form:
5 * LB =X => F(X)>0,
6 * LB<=X<=UB => F(X)=0,
7 * X =UB => F(X)<0.
8 * Thus, if d=2, the associated complementary Euler equation needs to return a
9 * negative residual. Economically, if the borrowing constraint binds, consumption
10 * today is lower than the unrestricted Euler equation
11 *
12 * 1/c=beta*(1+r_bar)*1/c(+1)
13 *
14 * would require and marginal utility on the left would be higher. Dynare by
15 * default computes the residual of an equation LHS=RHS as residual=LHS-RHS. For the
16 * above equation this would imply
17 *
18 * residual=1/c-beta*(1+r_bar)*1/c(+1)
19 *
20 * and therefore would return a positive residual, while a negative one is required.
21 * The equation must therefore be entered as
22 * beta*(1+r_bar)*1/c(+1)-1/c=0;
23 * which returns a negative residual when the upper bound is binding.
24 *
25 * This implementation was written by Johannes Pfeifer. If you spot any mistakes,
26 * email me at [email protected].
27 * Please note that the following copyright notice only applies to this Dynare
28 * implementation of the model.
29 */
30
31 /*
32 * Copyright © 2022 Johannes Pfeifer
33 *
34 * This is free software: you can redistribute it and/or modify
35 * it under the terms of the GNU General Public License as published by
36 * the Free Software Foundation, either version 3 of the License, or
37 * (at your option) any later version.
38 *
39 * It is distributed in the hope that it will be useful,
40 * but WITHOUT ANY WARRANTY; without even the implied warranty of
41 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42 * GNU General Public License for more details.
43 *
44 * For a copy of the GNU General Public License,
45 * see <http://www.gnu.org/licenses/>.
46 */
47
48 var c d y;
49
50 parameters r_bar ${\bar r}$
51 beta;
52
53 r_bar = 0.04; %world interest rate
54 beta=0.9;
55 d_bar=2;
56
57 model;
58 [name='Evolution of debt']
59 y + d= c + (1+r_bar)*d(-1);
60 [name='Endowment']
61 y = 1;
62 [name='Euler equation']
63 beta*(1+r_bar)*1/c(+1)-1/c=0 ⟂ d<2;
64 end;
65
66 initval;
67 d=d_bar;
68 y=1;
69 c=y-r_bar*d;
70 end;
71 resid;
72 steady(solve_algo=10);
73 resid;