File: Partial_ramsey.mod

package info (click to toggle)
dynare 7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 79,248 kB
  • sloc: cpp: 82,011; ansic: 28,583; objc: 12,573; yacc: 5,105; pascal: 2,374; lex: 1,502; python: 1,118; sh: 1,116; makefile: 605; lisp: 162; xml: 18
file content (177 lines) | stat: -rw-r--r-- 5,708 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
/*
 * This file implements the optimal monetary policy under commitment exercise
 * in Jordi GalĂ­ (2008): Monetary Policy, Inflation, and the Business Cycle,
 * Princeton University Press, Chapter 5.1.2
 *
 * It demonstrates how to use the ramsey_model command of Dynare.
 *
 * Notes:
 *      - all model variables are expressed in deviations from steady state, i.e.
 *        in contrast to to the chapter, both the nominal interest rate and
 *        natural output are not in log-levels, but rather mean 0
 *
 * This implementation was written by Johannes Pfeifer. In case you spot mistakes,
 * email me at jpfeifer@gmx.de
 *
 * Please note that the following copyright notice only applies to this Dynare
 * implementation of the model.
 */

/*
 * Copyright 2015-2024 Johannes Pfeifer
 *
 * This is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * It is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * For a copy of the GNU General Public License,
 * see <https://www.gnu.org/licenses/>.
 */


var pi ${\pi}$ (long_name='inflation')
    y_gap ${tilde y}$ (long_name='output gap')
    y_nat ${y^{nat}}$ (long_name='natural output')
    y ${y}$ (long_name='output')
    r_e  ${r^{e}}$ (long_name='efficient interest rate')
    y_e  ${y^{nat}}$ (long_name='efficient output')
    x ${x}$ (long_name='welfare-relevant output gap')
    r_nat ${r^{nat}}$ (long_name='natural interest rate')
    r_real ${r^r}$ (long_name='real interest rate')
    i ${i}$ (long_name='nominal interest rate')
    n ${n}$ (long_name='hours worked')
    m_growth_ann ${\Delta m}$ (long_name='money growth')
    u ${u}$ (long_name='AR(1) cost push shock process')
    a  ${a}$ (long_name='AR(1) technology shock process')
    r_real_ann ${r^{r,ann}}$ (long_name='annualized real interest rate')
    i_ann ${i^{ann}}$ (long_name='annualized nominal interest rate')
    r_nat_ann ${r^{nat,ann}}$ (long_name='annualized natural interest rate')
    pi_ann ${\pi^{ann}}$ (long_name='annualized inflation rate')
    p ${p}$ (long_name='price level')
    ;

varexo eps_a ${\varepsilon_a}$   (long_name='technology shock')
       eps_u ${\varepsilon_u}$   (long_name='monetary policy shock');

parameters alppha ${\alppha}$ (long_name='capital share')
    betta ${\beta}$ (long_name='discount factor')
    rho_a ${\rho_a}$ (long_name='autocorrelation technology shock')
    rho_u ${\rho_{u}}$ (long_name='autocorrelation cost push shock')
    siggma ${\sigma}$ (long_name='log utility')
    phi ${\phi}$ (long_name='unitary Frisch elasticity')
    phi_y ${\phi_{y}}$ (long_name='output feedback Taylor Rule')
    eta ${\eta}$ (long_name='semi-elasticity of money demand')
    epsilon ${\epsilon}$ (long_name='demand elasticity')
    theta ${\theta}$ (long_name='Calvo parameter')
    ;
%----------------------------------------------------------------
% Parametrization, p. 52
%----------------------------------------------------------------
siggma = 1;
phi=1;
phi_y  = .5/4;
theta=2/3;
rho_u = 0;
rho_a  = 0.9;
betta = 0.99;
eta  =4;
alppha=1/3;
epsilon=6;



%----------------------------------------------------------------
% First Order Conditions
%----------------------------------------------------------------

model(linear);
//Composite parameters
#Omega=(1-alppha)/(1-alppha+alppha*epsilon);  //defined on page 47
#psi_n_ya=(1+phi)/(siggma*(1-alppha)+phi+alppha); //defined on page 48
#lambda=(1-theta)*(1-betta*theta)/theta*Omega; //defined on page 47
#kappa=lambda*(siggma+(phi+alppha)/(1-alppha));  //defined on page 49
#alpha_x=kappa/epsilon; //defined on page 96
#phi_pi=(1-rho_u)*kappa*siggma/(alpha_x)+rho_u; //defined on page 101

//1. Definition efficient interest rate, below equation (4)
r_e=siggma*(y_e(+1)-y_e);

//2. Definition efficient output
y_e=psi_n_ya*a;

//3. Definition linking various output gaps, bottom page 96
y_gap=x+(y_e-y_nat);

//4. New Keynesian Phillips Curve eq. (2)
pi=betta*pi(+1)+kappa*x + u;

//5. Dynamic IS Curve eq. (4)
x=-1/siggma*(i-pi(+1)-r_e)+x(+1);

//6. Definition natural rate of interest eq. (23)
r_nat=siggma*psi_n_ya*(a(+1)-a);

//7. Definition real interest rate
r_real=i-pi(+1);

//8. Natural output
y_nat=phi*a;

//9. Definition output gap
y_gap=y-y_nat;

//10. cost push shock, equation (3)
u=rho_u*u(-1)+eps_u;

//11. TFP shock
a=rho_a*a(-1)+eps_a;

//12. Production function (eq. 13)
y=a+(1-alppha)*n;

//13. Money growth (derived from eq. (4))
m_growth_ann=4*(y-y(-1)-eta*(i-i(-1))+pi);

//14. Annualized nominal interest rate
i_ann=4*i;

//15. Annualized real interest rate
r_real_ann=4*r_real;

//16. Annualized natural interest rate
r_nat_ann=4*r_nat;

//17. Annualized inflation
pi_ann=4*pi;

//18. Definition price level
pi=p-p(-1);

//19. Interest Rate Rule that implements optimal solution, eq. (10)
% i=r_e+phi_pi*pi;
end;

%----------------------------------------------------------------
%  define shock variances
%---------------------------------------------------------------

shocks;
var eps_u = 1;
var eps_a = 1;
end;

//planner objective using alpha_x expressed as function of deep parameters
planner_objective pi^2 +(((1-theta)*(1-betta*theta)/theta*((1-alppha)/(1-alppha+alppha*epsilon)))*(siggma+(phi+alppha)/(1-alppha)))/epsilon*y_gap^2;

ramsey_model(instruments=(i),planner_discount=betta);

varobs pi x y u a;
stoch_simul(order=1,irf=13,partial_information) x pi u;

check;