| 1 |
/* |
| 2 |
* This file replicates the IRFs of the small open economy model described in |
| 3 |
* Jesús Fernández-Villaverde, Pablo Guerrón-Quintana, |
| 4 |
* Juan F. Rubio-Ramírez, and Martin Uribe (2011): "Risk Matters", |
| 5 |
* American Economic Review 101 (October 2011): 2530–2561. |
| 6 |
* |
| 7 |
* This implementation was written by Benjamin Born and Johannes Pfeifer. Please |
| 8 |
* note that the following copyright notice only applies to this Dynare |
| 9 |
* implementation of the |
| 10 |
* model. |
| 11 |
*/ |
| 12 |
|
| 13 |
/* |
| 14 |
* Copyright © 2013 Dynare Team |
| 15 |
* |
| 16 |
* This file is part of Dynare. |
| 17 |
* |
| 18 |
* Dynare is free software: you can redistribute it and/or modify |
| 19 |
* it under the terms of the GNU General Public License as published by |
| 20 |
* the Free Software Foundation, either version 3 of the License, or |
| 21 |
* (at your option) any later version. |
| 22 |
* |
| 23 |
* Dynare is distributed in the hope that it will be useful, |
| 24 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 25 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 26 |
* GNU General Public License for more details. |
| 27 |
* |
| 28 |
* You should have received a copy of the GNU General Public License |
| 29 |
* along with Dynare. If not, see <https://www.gnu.org/licenses/>. |
| 30 |
*/ |
| 31 |
|
| 32 |
var sigma_r sigma_tb eps_r eps_tb X D K lambda C H Y I phi r; |
| 33 |
varexo u_sigma_r u_sigma_tb u_r u_tb u_x ; |
| 34 |
predetermined_variables K D; |
| 35 |
|
| 36 |
parameters r_bar rho_eps_r sigma_r_bar rho_sigma_r eta_r |
| 37 |
rho_eps_tb sigma_tb_bar rho_sigma_tb eta_tb |
| 38 |
delta alppha nu rho_x betta |
| 39 |
Phi phipar sigma_x D_bar omega eta; |
| 40 |
|
| 41 |
// Calibration from Table 3 |
| 42 |
rho_eps_r=0.97; |
| 43 |
sigma_r_bar=-5.71; |
| 44 |
rho_sigma_r=0.94; |
| 45 |
eta_r=0.46; |
| 46 |
|
| 47 |
// Calibration from Table 4 |
| 48 |
rho_eps_tb=0.95; |
| 49 |
sigma_tb_bar=-8.06; %8.05 in paper, but 8.06 in code |
| 50 |
rho_sigma_tb=0.94; |
| 51 |
eta_tb=0.13; |
| 52 |
nu=5; %inverse of the elasticity of intertemporal substitution |
| 53 |
eta=1000; %elasticity of labor to wages |
| 54 |
delta=0.014; %depreciation |
| 55 |
alppha = 0.32; % capital income share |
| 56 |
rho_x=0.95; %autocorrelation TFP |
| 57 |
|
| 58 |
|
| 59 |
// Calibration from Table 6 // |
| 60 |
r_bar=log(0.02); |
| 61 |
betta = 1/(1+exp(r_bar)); %discount factor |
| 62 |
Phi=0.001; %debt elasticity |
| 63 |
D_bar= 4; % steady state debt |
| 64 |
phipar=95; % capital adjustment costs |
| 65 |
sigma_x=log(0.015); |
| 66 |
|
| 67 |
omega=1; |
| 68 |
|
| 69 |
model; |
| 70 |
(exp(C))^-nu=exp(lambda); |
| 71 |
exp(lambda)/(1+exp(r))=exp(lambda)*Phi*((D(+1))-D_bar)+betta*exp(lambda(+1)); |
| 72 |
-exp(phi)+betta*((1-delta)*exp(phi(+1))+alppha*exp(Y(+1))/exp(K(+1))*exp(lambda(+1)))=0; |
| 73 |
omega*exp(H)^eta=(1-alppha)*exp(Y)/exp(H)*exp(lambda); |
| 74 |
exp(phi)*(1-phipar/2*((exp(I)-exp(I(-1)))/exp(I(-1)))^2-phipar*exp(I)/exp(I(-1))*((exp(I)-exp(I(-1)))/exp(I(-1))))+betta*exp(phi(+1))*phipar*(exp(I(+1))/exp(I))^2*((exp(I(+1))-exp(I))/exp(I))=exp(lambda); |
| 75 |
|
| 76 |
exp(Y)=exp(K)^alppha*(exp(X)*exp(H))^(1-alppha); |
| 77 |
X=rho_x*X(-1)+exp(sigma_x)*u_x; |
| 78 |
exp(K(+1))=(1-delta)*exp(K)+(1-phipar/2*(exp(I)/exp(I(-1))-1)^2)*exp(I); |
| 79 |
exp(Y)-exp(C)-exp(I)=(D)-(D(+1))/(1+exp(r))+Phi/2*((D(+1))-D_bar)^2; |
| 80 |
exp(r)=exp(r_bar)+eps_tb+eps_r; |
| 81 |
eps_tb=rho_eps_tb*eps_tb(-1)+exp(sigma_tb)*u_tb; |
| 82 |
sigma_tb=(1-rho_sigma_tb)*sigma_tb_bar+rho_sigma_tb*sigma_tb(-1)+eta_tb*u_sigma_tb; |
| 83 |
eps_r=rho_eps_r*eps_r(-1)+exp(sigma_r)*u_r; |
| 84 |
sigma_r=(1-rho_sigma_r)*sigma_r_bar+rho_sigma_r*sigma_r(-1)+eta_r*u_sigma_r; |
| 85 |
end; |
| 86 |
|
| 87 |
initval; |
| 88 |
sigma_tb=sigma_tb_bar; |
| 89 |
sigma_r=sigma_r_bar; |
| 90 |
eps_r=0; |
| 91 |
eps_tb=0; |
| 92 |
D=D_bar; |
| 93 |
|
| 94 |
% steady states taken from Mathematica code |
| 95 |
C=0.8779486025329908; |
| 96 |
K=3.293280327636415; |
| 97 |
lambda=-4.389743012664954; |
| 98 |
H=-0.0037203652717462993; |
| 99 |
phi=-4.389743012664954; |
| 100 |
I=-0.9754176217303792; |
| 101 |
Y=1.0513198564588924; |
| 102 |
r=r_bar; |
| 103 |
end; |
| 104 |
|
| 105 |
shocks; |
| 106 |
var u_x; stderr 1; |
| 107 |
var u_r; stderr 1; |
| 108 |
var u_tb; stderr 1; |
| 109 |
var u_sigma_tb; stderr 1; |
| 110 |
var u_sigma_r; stderr 1; |
| 111 |
end; |
| 112 |
|
| 113 |
resid; |
| 114 |
|
| 115 |
options_.solve_tolf=1E-12; |
| 116 |
steady(solve_algo=3); |
| 117 |
|
| 118 |
check; |
| 119 |
stoch_simul(order=3,pruning,irf=0,nofunctions,contemporaneous_correlation,TeX) C I Y H r D K lambda phi; |
| 120 |
|
| 121 |
comparison_policy_functions_dynare_mathematica; |