Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • giovanma/dynare
  • giorgiomas/dynare
  • Vermandel/dynare
  • Dynare/dynare
  • normann/dynare
  • MichelJuillard/dynare
  • wmutschl/dynare
  • FerhatMihoubi/dynare
  • sebastien/dynare
  • lnsongxf/dynare
  • rattoma/dynare
  • CIMERS/dynare
  • FredericKarame/dynare
  • SumuduK/dynare
  • MinjeJeon/dynare
  • camilomrch/dynare
  • DoraK/dynare
  • avtishin/dynare
  • selma/dynare
  • claudio_olguin/dynare
  • jeffjiang07/dynare
  • EthanSystem/dynare
  • stepan-a/dynare
  • wjgatt/dynare
  • JohannesPfeifer/dynare
  • gboehl/dynare
  • chskcau/dynare-doc-fixes
27 results
Select Git revision
Loading items
Show changes
Showing
with 1297 additions and 31 deletions
/*
* The Hansen model following McCandless, George T. (2008): The ABCs of RBCs, Hardvard University Press, Chapter 6
*
* This mod-file tests the correctness of forecasting with exogenous deterministic variables.
* A forecast starting at the steady state in t=0, where the only shock is a perfectly
* anticipated shock in t=8, is equal to the IRF to a 7 period anticipated news shock.
* Note the timing difference due to the fact that in forecasting. the agent starts at the
* steady state at time 0 and has the first endogenous reaction period at t=1 so that the shock at
* t=8 is only 7 period anticipated
* This implementation was written by Johannes Pfeifer. Please note that the
* following copyright notice only applies to this Dynare implementation of the
* model.
*/
/*
* Copyright (C) 2014 Johannes Pfeifer
*
* This file is part of Dynare.
*
* Dynare 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.
*
* Dynare 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.
*
* You should have received a copy of the GNU General Public License
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
*/
var c r y h k a;
varexo eps_a_surp eps_a_antic;
varexo_det e_det;
parameters beta delta theta rho_a A_disutil;
beta = 0.99;
delta = 0.025;
theta = 0.36;
rho_a = 0.35;
A_disutil = 2;
model;
1/c = beta*((1/c(+1))*(r(+1) +(1-delta)));
(1-h)*(1-theta)*(y/h) = A_disutil*c;
c = y +(1-delta)*k(-1) - k;
y = a*k(-1)^(theta)*h^(1-theta);
r = theta*(y/k(-1));
log(a)=rho_a*log(a(-1))+eps_a_surp+eps_a_antic(-7)+e_det;
end;
steady_state_model;
a = 1;
h = (1+(A_disutil/(1-theta))*(1 - (beta*delta*theta)/(1-beta*(1-delta))))^(-1);
k = h*(theta*a/(1/beta -(1-delta)))^(1/(1-theta));
y = a*k^(theta)*h^(1-theta);
c = y-delta*k;
r = 1/beta - (1-delta);
end;
steady;
shocks;
var eps_a_surp; stderr 0;
var eps_a_antic; stderr 0.01;
var e_det;
periods 8;
values 0.01;
end;
stoch_simul(irf=40,nomoments, order=1);
% make_ex_;
forecast(periods=40);
figure
for ii=1:M_.orig_endo_nbr
subplot(3,3,ii)
var_name=deblank(M_.endo_names(ii,:));
var_index=strmatch(var_name,deblank(M_.endo_names),'exact');
plot(1:40,oo_.dr.ys(var_index)+oo_.irfs.([var_name,'_eps_a_antic']),'b',1:40,... %
oo_.forecast.Mean.(var_name),'r--')
title(var_name)
difference(ii,:)=oo_.dr.ys(var_index)+oo_.irfs.([var_name,'_eps_a_antic'])-oo_.forecast.Mean.(var_name)';
end
if max(max(abs(difference)))>1e-10
error('Forecasts with exogenous deterministic variable is wrong')
end
\ No newline at end of file
......@@ -72,4 +72,11 @@ varobs gp_obs gy_obs;
options_.solve_tolf = 1e-12;
estimation(order=1,datafile=fsdat_simul,nobs=192,mode_compute=8,loglinear,mh_replic=0);
estimation(order=1,datafile=fsdat_simul,nobs=192,mode_compute=8,loglinear,mh_replic=0,optim=(
'MaxIter',5000,
'TolFun',1e-4,
'TolX',1e-4,
'MaxFunEvals',5000,
'MaxFunEvalFactor',500,
'InitialSimplexSize',0.05
));
/* Checks that, for order = 2, k_order_solver = 0 (fs2000k2a)
and k_order_solver = 1 (this file) give the same results */
// See fs2000.mod in the examples/ directory for details on the model
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
......@@ -14,7 +13,7 @@ rho = 0.7;
psi = 0.787;
del = 0.02;
model (use_dll);
model;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
......@@ -32,13 +31,13 @@ gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
k = 6;
d = 0.85;
n = 0.19;
l = 0.86;
......@@ -55,6 +54,7 @@ end;
steady;
check;
estimated_params;
alp, beta_pdf, 0.356, 0.02;
......@@ -70,8 +70,6 @@ end;
varobs gp_obs gy_obs;
//estimation(datafile=fsdat,nobs=192,loglinear,mh_replic=2000,
// mode_compute=4,mh_nblocks=2,mh_drop=0.45,mh_jscale=0.65);
estimation(datafile=fsdat,nobs=192,mh_replic=2000,
mode_compute=4,mh_nblocks=2,mh_drop=0.45,mh_jscale=0.65);
options_.solve_tolf = 1e-12;
estimation(order=1,datafile=fsdat_simul,nobs=192,optim=('NumgradEpsilon',1e-6,'NumgradAlgorithm',3,'MaxIter',100,'InitialInverseHessian','eye(9)*.0001'),loglinear,mh_replic=0);
......@@ -64,7 +64,7 @@ steady;
stoch_simul(order=2,k_order_solver,irf=0);
if ~exist('fs2000k2_m_results.mat','file');
error('fs2000k2 must be run first');
error('fs2000k2_m must be run first');
end;
oo1 = load('fs2000k2_m_results','oo_');
......
/*
* Copyright (C) 2009-2012 Dynare Team
* Example 1 from F. Collard (2001): "Stochastic simulations with DYNARE:
* A practical guide" (see "guide.pdf" in the documentation directory).
*/
/*
* Copyright (C) 2001-2010 Dynare Team
*
* This file is part of Dynare.
*
......@@ -17,27 +22,47 @@
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
*/
///////////////////////////////////////////////////////////
// LogPriorDensity.cpp
// Implementation of the Class LogPriorDensity
// Created on: 10-Feb-2010 20:56:08
///////////////////////////////////////////////////////////
#include "LogPriorDensity.hh"
LogPriorDensity::~LogPriorDensity()
{
};
var y, c, k, a, h, b;
varexo e, u;
LogPriorDensity::LogPriorDensity(EstimatedParametersDescription &estParsDesc_arg) :
estParsDesc(estParsDesc_arg)
{
};
parameters beta, rho, alpha, delta, theta, psi, tau;
/**
* Return random number for prior fromits distribution
*/
void
LogPriorDensity::computeNewParams(Vector &ep)
{
alpha = 0.36;
rho = 0.95;
tau = 0.025;
beta = 0.99;
delta = 0.025;
psi = 0;
theta = 2.95;
phi = 0.1;
model;
exp(c)*theta*exp(h)^(1+psi)=(1-alpha)*exp(y);
exp(k) = beta*(((exp(b)*exp(c))/(exp(b(+1))*exp(c(+1))))
*(exp(b(+1))*alpha*exp(y(+1))+(1-delta)*exp(k)));
exp(y) = exp(a)*(exp(k(-1))^alpha)*(exp(h)^(1-alpha));
exp(k) = exp(b)*(exp(y)-exp(c))+(1-delta)*exp(k(-1));
a = rho*a(-1)+tau*b(-1) + e;
b = tau*a(-1)+rho*b(-1) + u;
end;
initval;
y = log(1.08068253095672);
c = log(0.80359242014163);
h = log(0.29175631001732);
k = log(11.08360443260358);
a = 0;
b = 0;
end;
resid(1);
shocks;
var e; stderr 0.009;
var u; stderr 0.009;
var e, u = phi*0.009*0.009;
end;
}
stoch_simul(order=1);
oo_exp=oo_;
save results_exp oo_exp
\ No newline at end of file
/*
* Example 1 from F. Collard (2001): "Stochastic simulations with DYNARE:
* A practical guide" (see "guide.pdf" in the documentation directory).
*/
/*
* Copyright (C) 2001-2010 Dynare Team
*
* This file is part of Dynare.
*
* Dynare 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.
*
* Dynare 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.
*
* You should have received a copy of the GNU General Public License
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
*/
var y, c, k, a, h, b;
varexo e, u;
parameters beta, rho, alpha, delta, theta, psi, tau;
alpha = 0.36;
rho = 0.95;
tau = 0.025;
beta = 0.99;
delta = 0.025;
psi = 0;
theta = 2.95;
phi = 0.1;
model;
c*theta*h^(1+psi)=(1-alpha)*y;
k = beta*(((b*c)/(b(+1)*c(+1)))
*(b(+1)*alpha*y(+1)+(1-delta)*k));
y = a*(k(-1)^alpha)*(h^(1-alpha));
k = b*(y-c)+(1-delta)*k(-1);
log(a) = rho*log(a(-1))+tau*log(b(-1)) + e;
log(b) = tau*log(a(-1))+rho*log(b(-1)) + u;
end;
initval;
y = 1.08068253095672;
c = 0.80359242014163;
h = 0.29175631001732;
k = 11.08360443260358;
a = 1;
b = 1;
end;
resid(1);
shocks;
var e; stderr 0.009;
var u; stderr 0.009;
var e, u = phi*0.009*0.009;
end;
stoch_simul(loglinear,order=1);
load results_exp;
if max(max(abs(oo_.dr.ghx-oo_exp.dr.ghx)))>1e-10
error('Option loglinear wrong, ghx not equal')
end
if max(max(abs(oo_.dr.ghu-oo_exp.dr.ghu)))>1e-10
error('Option loglinear wrong, ghu not equal')
end
if max(max(abs(oo_.irfs.y_e-oo_exp.irfs.y_e)))>1e-10
error('Option loglinear wrong, IRFs not equal')
end
if max(max(abs(oo_.irfs.y_u-oo_exp.irfs.y_u)))>1e-10
error('Option loglinear wrong, ghu not equal')
end
if max(max(abs(oo_.mean-oo_exp.mean)))>1e-10
error('Option loglinear wrong, mean not equal')
end
if max(max(abs(oo_.dr.ys-oo_exp.dr.ys)))>1e-10
error('Option loglinear wrong, ys not equal')
end
if max(max(abs(oo_.steady_state-oo_exp.steady_state)))>1e-10
error('Option loglinear wrong, steady_state not equal')
end
for ii=1:length(oo_.gamma_y)
if max(max(abs(oo_.gamma_y{ii,1}-oo_exp.gamma_y{ii,1})))>1e-10
error('Option loglinear wrong, moments not equal')
end
end
for ii=1:length(oo_.autocorr)
if max(max(abs(oo_.autocorr{1,ii}-oo_exp.autocorr{1,ii})))>1e-10
error('Option loglinear wrong, moments not equal')
end
end
stoch_simul(loglinear,order=1,periods=100000);
if abs(mean(y)-0.0776)>0.02
error('Simulations are wrong')
end
\ No newline at end of file
File added
//This mod-file tests the value of the objective function in the presence of non-stationary variables
Var
p_U_Hat
pi_U_Hat
r_Hat
r_Gap
r_Eff
realrate_U_Hat
realrate_U_Eff
realrate_U_Gap
c_U_Gap
c_U_Eff
c_U_Hat
g_U_Gap
g_U_Eff
g_U_Hat
y_U_Gap
y_U_Eff
y_U_Hat
l_U_Gap
l_U_Eff
l_U_Hat
a_U_Hat
p_A_Hat
pc_A_Hat
tt_A_Hat
tt_A_Gap
tt_A_Eff
pi_A_Hat
pic_A_Hat
c_A_Gap
c_A_Eff
c_A_Hat
g_A_Gap
g_A_Eff
g_A_Hat
realrate_A_Hat
l_A_Gap
l_A_Eff
l_A_Hat
muW_A_Hat
y_A_Gap
y_A_Eff
y_A_Hat
a_A_Hat
mc_A_Hat
tau_A_Hat
tau_A_Gap
tau_A_Eff
Kdebt_A
p_B_Hat
pc_B_Hat
tt_B_Hat
tt_B_Gap
tt_B_Eff
pi_B_Hat
pic_B_Hat
c_B_Gap
c_B_Eff
c_B_Hat
g_B_Gap
g_B_Eff
g_B_Hat
realrate_B_Hat
l_B_Gap
l_B_Eff
l_B_Hat
muW_B_Hat
y_B_Gap
y_B_Eff
y_B_Hat
a_B_Hat
mc_B_Hat
tau_B_Hat
tau_B_Gap
tau_B_Eff
Kdebt_B
;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%DECLARATION OF EXOGENOUS VARIABLES%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Varexo
eps_muW_A
eps_a_A
eps_muW_B
eps_a_B
;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%DECLARATION OF PARAMETERS%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
parameters
n
alpha
beta
rho
lambdaA
lambdaB
sigma
chi
psi
epsilon
muP
gamma
ell
phi_GY
phi_caps
theta_A
theta_B
phi_A
phi_B
%%%%%%
//Rule Parameters
ruleR_U_y
ruleR_U_pi
ruleR_U_debt
ruleG_A_y
ruleG_A_tt
ruleG_A_debt
ruleG_B_y
ruleG_B_tt
ruleG_B_debt
ruleT_A_y
ruleT_A_tt
ruleT_A_debt
ruleT_B_y
ruleT_B_tt
ruleT_B_debt
%%%%%%
rho_a_A
rho_a_B
rho_muW_A
rho_muW_B
rho_mp
r_SS
muW_SS
tau_A_SS
DebtOutput_A_SS
tau_B_SS
DebtOutput_B_SS
;
%%%%%%%%%%%%%%%%%%%%%%%%
%%SET PARAMETER VALUES%%
%%%%%%CALIBRATION%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
n = 0.5;
alpha = 0.4;
beta = 0.99 ;
rho = -log(beta);
lambdaA = 1-(1-n)*alpha;
lambdaB = 1-n*alpha;
sigma = 0.4;
chi = 3;
psi = 0.4;
epsilon = 11;
muP = 1/(epsilon - 1);
gamma = 4.5;
ell = 11;
phi_GY = 0.25;
phi_caps = alpha*(gamma-(1-alpha)*(-gamma+sigma));
theta_A = 0.75;
theta_B = 0.75;
phi_A = (1 - theta_A*beta)*(1 - theta_A)/(theta_A*(1 + epsilon*chi));
phi_B = (1 - theta_B*beta)*(1 - theta_B)/(theta_B*(1 + epsilon*chi));
//Rule Parameters
ruleR_U_y = 0.5;
ruleR_U_pi = 1.5;
ruleR_U_debt = 0;
ruleG_A_y = 0;
ruleG_A_tt = 0;
ruleG_A_debt = -0.05;
ruleG_B_y = ruleG_A_y;
ruleG_B_tt = 0;
ruleG_B_debt = ruleG_A_debt;
ruleT_A_y = 0;
ruleT_A_tt = 0;
ruleT_A_debt = 0.05;
ruleT_B_y = ruleT_A_y;
ruleT_B_tt = 0;
ruleT_B_debt = ruleT_A_debt;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rho_a_A = 0.85;
rho_a_B = 0.85;
rho_muW_A = 0;
rho_muW_B = 0;
rho_mp = 0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%% STEADY STATE VALUES %%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
muW_SS = 1/(ell - 1);
r_SS = log(1/beta);
DebtOutput_A_SS = 4*0.6;
DebtOutput_B_SS = 4*0.6;
tau_A_SS = phi_GY + r_SS*DebtOutput_A_SS;
tau_B_SS = phi_GY + r_SS*DebtOutput_B_SS;
model(linear);
p_U_Hat = n*p_A_Hat + (1-n)*p_B_Hat;
pi_U_Hat = n*pi_A_Hat + (1-n)*pi_B_Hat;
c_U_Gap = c_U_Gap(+1)- sigma*(r_Gap - pi_U_Hat(+1));
realrate_U_Gap = realrate_U_Hat - realrate_U_Eff;
realrate_U_Eff = ((1 + chi)/(1 + chi*(phi_GY*psi + (1 - phi_GY)*sigma)))*(a_U_Hat(+1) - a_U_Hat);
realrate_U_Hat = r_Hat - pi_U_Hat(+1);
r_Eff = ((1 + chi)/(1 + chi*(phi_GY*psi + (1 - phi_GY)*sigma)))*(a_U_Hat(+1) - a_U_Hat);
r_Hat = r_Gap + r_Eff;
// Interest rate rule
r_Gap = ruleR_U_y*y_U_Gap(-1) + ruleR_U_pi*pi_U_Hat(-1) + ruleR_U_debt*(n*Kdebt_A(-1) + (1-n)*Kdebt_B(-1));
c_U_Gap = n*c_A_Gap + (1-n)*c_B_Gap;
c_U_Eff = n*c_A_Eff + (1-n)*c_B_Eff;
c_U_Hat = n*c_A_Hat + (1-n)*c_B_Hat;
g_U_Gap = n*g_A_Gap + (1-n)*g_B_Gap;
g_U_Eff = n*g_A_Eff + (1-n)*g_B_Eff;
g_U_Hat = n*g_A_Hat + (1-n)*g_B_Hat;
y_U_Gap = n*y_A_Gap + (1-n)*y_B_Gap;
y_U_Eff = n*y_A_Eff + (1-n)*y_B_Eff;
y_U_Hat = n*y_A_Hat + (1-n)*y_B_Hat;
l_U_Gap = n*l_A_Gap + (1-n)*l_B_Gap;
l_U_Eff = n*l_A_Eff + (1-n)*l_B_Eff;
l_U_Hat = n*l_A_Hat + (1-n)*l_B_Hat;
a_U_Hat = n*a_A_Hat + (1-n)*a_B_Hat;
tt_A_Hat = (p_U_Hat - p_A_Hat)/(1-n);
pi_A_Hat = p_A_Hat - p_A_Hat(-1);
pic_A_Hat = pc_A_Hat - pc_A_Hat(-1);
pic_A_Hat = pi_A_Hat + (1-lambdaA)*(tt_A_Hat - tt_A_Hat(-1));
c_A_Eff = (((1 + chi)*sigma)/(1 + chi*(phi_GY*psi + (1 - phi_GY)*sigma)))*a_U_Hat + (((1 - alpha)*(1 + chi)*sigma)/(1 + chi*(phi_GY*psi + (1 - phi_GY)*(gamma + (sigma - gamma)*(1 - 2*alpha + alpha*alpha)))))*(a_A_Hat - a_U_Hat);
g_A_Eff = (((1 + chi)*psi)/(1 + chi*(phi_GY*psi + (1 - phi_GY)*sigma)))*a_U_Hat + (((1 + chi)*psi)/(1 + chi*(phi_GY*psi + (1 - phi_GY)*(gamma + (sigma - gamma)*(1 - 2*alpha + alpha*alpha)))))*(a_A_Hat - a_U_Hat);
y_A_Eff = (((1 + chi)*(phi_GY*psi + (1 - phi_GY)*sigma))/(1 + chi*(phi_GY*psi + (1 - phi_GY)*sigma)))*a_U_Hat + (((1 + chi)*(phi_GY*psi + (1 - phi_GY)*(gamma + (sigma - gamma)*(1 - 2*alpha + alpha*alpha))))/(1 + chi*(phi_GY*psi + (1 - phi_GY)*(gamma + (sigma - gamma)*(1 - 2*alpha + alpha*alpha)))))*(a_A_Hat - a_U_Hat);
l_A_Eff = y_A_Eff - a_A_Hat;
realrate_A_Hat = r_Hat - pic_A_Hat(+1);
tt_A_Gap = tt_A_Hat - tt_A_Eff;
tt_A_Eff = ((1 + chi)/(1 + chi*(phi_GY*psi + (1 - phi_GY)*(gamma + (sigma - gamma)*(1 - 2*alpha + alpha*alpha)))))*((a_A_Hat - a_U_Hat)/(1-n));
y_A_Gap = l_A_Gap;
pi_A_Hat = beta*pi_A_Hat(+1)+ phi_A*mc_A_Hat;
mc_A_Hat = tau_A_Gap/(1 - tau_A_SS) +(chi + 1/((1- phi_GY)*(phi_caps+sigma*(1-alpha))))* y_A_Gap - (phi_GY /((1- phi_GY)*(phi_caps+sigma*(1-alpha))))*g_A_Gap + (1/(sigma*(1- phi_GY))- 1/((1- phi_GY)*(phi_caps+sigma*(1-alpha))))* y_U_Gap - phi_GY *(1/(sigma*(1 - phi_GY)) - 1/((1- phi_GY)*(phi_caps+sigma*(1-alpha))))*g_U_Gap;
tau_A_Hat = tau_A_Gap + tau_A_Eff;
tau_A_Eff = - (1 - tau_A_SS)*muW_A_Hat;
y_A_Gap = (1- phi_GY)*c_U_Gap + (1 - phi_GY)*(sigma*(1 - alpha) + phi_caps)*(1-n)*tt_A_Gap + phi_GY*g_A_Gap;
Kdebt_A - ((1 + r_SS)/r_SS)*(tau_A_SS - phi_GY)*r_Hat= (1/beta)*(Kdebt_A(-1) - ((1 + r_SS)/r_SS)*(tau_A_SS - phi_GY)*pi_A_Hat + (phi_GY*g_A_Gap - tau_A_SS*y_A_Gap - tau_A_Gap)) + (1/beta)*(phi_GY*g_A_Eff - tau_A_SS*y_A_Eff + (1 - tau_A_SS)*muW_A_Hat) + (1/beta)*((1 + r_SS)/r_SS)*(tau_A_SS - phi_GY)*alpha*(1-n)*(tt_A_Gap(-1) -(1/(1 + r_SS))*tt_A_Gap) + (1/beta)*((1 + r_SS)/r_SS)*(tau_A_SS - phi_GY)*alpha*(1-n)*(tt_A_Eff(-1) -(1/(1 + r_SS))*tt_A_Eff);
//FISCAL RULES
g_A_Gap = ruleG_A_y*(y_A_Gap(-1) - y_U_Gap(-1)) + ruleG_A_tt*tt_A_Gap(-1) + ruleG_A_debt*Kdebt_A(-1);
tau_A_Gap = ruleT_A_y*(y_A_Gap(-1) - y_U_Gap(-1)) + ruleT_A_tt*tt_A_Gap(-1)+ ruleT_A_debt*Kdebt_A(-1);
c_A_Hat = c_A_Gap + c_A_Eff;
g_A_Hat = g_A_Gap + g_A_Eff;
y_A_Hat = y_A_Gap + y_A_Eff;
l_A_Hat = l_A_Gap + l_A_Eff;
tt_B_Hat = (p_U_Hat - p_B_Hat)/n;
pi_B_Hat = p_B_Hat - p_B_Hat(-1);
pic_B_Hat = pc_B_Hat - pc_B_Hat(-1);
pic_B_Hat = pi_B_Hat + (1-lambdaB)*(tt_B_Hat - tt_B_Hat(-1));
c_B_Eff = (((1 + chi)*sigma)/(1 + chi*(phi_GY*psi + (1 - phi_GY)*sigma)))*a_U_Hat + (((1 - alpha)*(1 + chi)*sigma)/(1 + chi*(phi_GY*psi + (1 - phi_GY)*(gamma + (sigma - gamma)*(1 - 2*alpha + alpha*alpha)))))*(a_B_Hat - a_U_Hat);
g_B_Eff = (((1 + chi)*psi)/(1 + chi*(phi_GY*psi + (1 - phi_GY)*sigma)))*a_U_Hat + (((1 + chi)*psi)/(1 + chi*(phi_GY*psi + (1 - phi_GY)*(gamma + (sigma - gamma)*(1 - 2*alpha + alpha*alpha)))))*(a_B_Hat - a_U_Hat);
y_B_Eff = (((1 + chi)*(phi_GY*psi + (1 - phi_GY)*sigma))/(1 + chi*(phi_GY*psi + (1 - phi_GY)*sigma)))*a_U_Hat + (((1 + chi)*(phi_GY*psi + (1 - phi_GY)*(gamma + (sigma - gamma)*(1 - 2*alpha + alpha*alpha))))/(1 + chi*(phi_GY*psi + (1 - phi_GY)*(gamma + (sigma - gamma)*(1 - 2*alpha + alpha*alpha)))))*(a_B_Hat - a_U_Hat);
l_B_Eff = y_B_Eff - a_B_Hat;
realrate_B_Hat = r_Hat - pic_B_Hat(+1);
c_A_Gap = c_B_Gap + sigma*(1 - alpha)*((1-n)*tt_A_Gap-n*(tt_B_Gap));
tt_B_Gap = tt_B_Hat - tt_B_Eff;
tt_B_Eff = ((1 + chi)/(1 + chi*(phi_GY*psi + (1 - phi_GY)*(gamma + (sigma - gamma)*(1 - 2*alpha + alpha*alpha)))))*((a_B_Hat - a_U_Hat)/n);
y_B_Gap = l_B_Gap; //l_B_Gap = y_B_Gap + z_B , up to a first order approximation z_B=0
pi_B_Hat = beta*pi_B_Hat(+1)+ phi_B*mc_B_Hat;
mc_B_Hat = tau_B_Gap/(1 - tau_B_SS) +(chi + 1/((1- phi_GY)*(phi_caps+sigma*(1-alpha))))* y_B_Gap - (phi_GY /((1- phi_GY)*(phi_caps+sigma*(1-alpha))))*g_B_Gap + (1/(sigma*(1- phi_GY))- 1/((1- phi_GY)*(phi_caps+sigma*(1-alpha))))* y_U_Gap - phi_GY *(1/(sigma*(1 - phi_GY)) - 1/((1- phi_GY)*(phi_caps+sigma*(1-alpha))))*g_U_Gap;
tau_B_Hat = tau_B_Gap + tau_B_Eff;
tau_B_Eff = - (1 - tau_B_SS)*muW_B_Hat;
y_B_Gap = (1- phi_GY)*c_U_Gap + (1 - phi_GY)*(sigma*(1 - alpha) + phi_caps)*n*tt_B_Gap + phi_GY*g_B_Gap;
Kdebt_B - ((1 + r_SS)/r_SS)*(tau_B_SS - phi_GY)*r_Hat= (1/beta)*(Kdebt_B(-1) - ((1 + r_SS)/r_SS)*(tau_B_SS - phi_GY)*pi_B_Hat + (phi_GY*g_B_Gap - tau_B_SS*y_B_Gap - tau_B_Gap)) + (1/beta)*(phi_GY*g_B_Eff - tau_B_SS*y_B_Eff + (1 - tau_B_SS)*muW_B_Hat) + (1/beta)*((1 + r_SS)/r_SS)*(tau_B_SS - phi_GY)*alpha*n*(tt_B_Gap(-1) -(1/(1 + r_SS))*tt_B_Gap) + (1/beta)*((1 + r_SS)/r_SS)*(tau_B_SS - phi_GY)*alpha*n*(tt_B_Eff(-1) -(1/(1 + r_SS))*tt_B_Eff);
//FISCAL RULES
g_B_Gap = ruleG_B_y*(y_B_Gap(-1) - y_U_Gap(-1)) + ruleG_B_tt*tt_B_Gap(-1) + ruleG_B_debt*Kdebt_B(-1); // function of domestic inflation since government spending is oriented only to domestic production
tau_B_Gap = ruleT_B_y*(y_B_Gap(-1) - y_U_Gap(-1)) + ruleT_B_tt*tt_B_Gap(-1) + ruleT_B_debt*Kdebt_B(-1); // function of domenstic inflation(!?)
c_B_Hat = c_B_Gap + c_B_Eff;
g_B_Hat = g_B_Gap + g_B_Eff;
y_B_Hat = y_B_Gap + y_B_Eff;
l_B_Hat = l_B_Gap + l_B_Eff;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%% Exogenous processes %%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a_A_Hat = rho_a_A* a_A_Hat(-1) + eps_a_A;
a_B_Hat = rho_a_B* a_B_Hat(-1) + eps_a_B;
muW_A_Hat = rho_muW_A*muW_A_Hat(-1) + eps_muW_A;
muW_B_Hat = rho_muW_B*muW_B_Hat(-1) + eps_muW_B;
end;
shocks;
var eps_a_B; stderr 1;
var eps_a_A; stderr 1;
var eps_muW_B; stderr 1;
var eps_muW_A; stderr 1;
end;
steady;
//check; //do not use this command under optimal policy!!!
//stoch_simul(order=1, irf=100);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Optimized Simple Rule (osr)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
optim_weights;
//for country A
pi_A_Hat (1/2)*n*(epsilon/phi_A);
c_A_Gap (1/2)*n*(1 - phi_GY)*(1/sigma + (1 - phi_GY)*chi);
g_A_Gap (1/2)*n*phi_GY*(1/psi + phi_GY*chi);
tt_A_Gap (1/2)*n*(1 - phi_GY)*(gamma*alpha*(alpha - 2) + 2*phi_caps + (1 - phi_GY)*(phi_caps^2)*chi)*((1-n)^2);
c_A_Gap, g_A_Gap (1/2)*(1/2)*n*2*phi_GY*(1 - phi_GY)*chi;
c_A_Gap, tt_A_Gap (1/2)*(1/2)*n*(1 - phi_GY)*(2*alpha + 2*(1 - phi_GY)*phi_caps*chi)*(1-n);
g_A_Gap, tt_A_Gap (1/2)*(1/2)*n*2*phi_GY*(1 - phi_GY)*phi_caps*chi*(1-n);
g_A_Gap, c_A_Gap (1/2)*(1/2)*n*2*phi_GY*(1 - phi_GY)*chi;
tt_A_Gap, c_A_Gap (1/2)*(1/2)*n*(1 - phi_GY)*(2*alpha + 2*(1 - phi_GY)*phi_caps*chi)*(1-n);
tt_A_Gap, g_A_Gap (1/2)*(1/2)*n*2*phi_GY*(1 - phi_GY)*phi_caps*chi*(1-n);
//now, the same for country B
pi_B_Hat (1/2)*(1-n)*(epsilon/phi_B);
c_B_Gap (1/2)*(1-n)*(1 - phi_GY)*(1/sigma + (1 - phi_GY)*chi);
g_B_Gap (1/2)*(1-n)*phi_GY*(1/psi + phi_GY*chi);
tt_B_Gap (1/2)*(1-n)*(1 - phi_GY)*(gamma*alpha*(alpha - 2) + 2*phi_caps + (1 - phi_GY)*(phi_caps^2)*chi)*(n^2);
c_B_Gap, g_B_Gap (1/2)*(1/2)*(1-n)*2*phi_GY*(1 - phi_GY)*chi;
c_B_Gap, tt_B_Gap (1/2)*(1/2)*(1-n)*(1 - phi_GY)*(2*alpha + 2*(1 - phi_GY)*phi_caps*chi)*n;
g_B_Gap, tt_B_Gap (1/2)*(1/2)*(1-n)*2*phi_GY*(1 - phi_GY)*phi_caps*chi*n;
g_B_Gap, c_B_Gap (1/2)*(1/2)*(1-n)*2*phi_GY*(1 - phi_GY)*chi;
tt_B_Gap, c_B_Gap (1/2)*(1/2)*(1-n)*(1 - phi_GY)*(2*alpha + 2*(1 - phi_GY)*phi_caps*chi)*n;
tt_B_Gap, g_B_Gap (1/2)*(1/2)*(1-n)*2*phi_GY*(1 - phi_GY)*phi_caps*chi*n;
end;
osr_params
ruleR_U_y
ruleR_U_pi
ruleR_U_debt
ruleG_A_y
ruleG_A_tt
ruleG_A_debt
ruleG_B_y
ruleG_B_tt
ruleG_B_debt
ruleT_A_y
ruleT_A_tt
ruleT_A_debt
ruleT_B_y
ruleT_B_tt
ruleT_B_debt
;
osr(irf=5,maxit=10000, nograph);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
asymptotic_loss=((1/2)*n*(epsilon/phi_A))...
*oo_.var(strmatch('pi_A_Hat',M_.endo_names,'exact'),strmatch('pi_A_Hat',M_.endo_names,'exact'))+...
((1/2)*n*(1 - phi_GY)*(1/sigma + (1 - phi_GY)*chi))...
*oo_.var(strmatch('c_A_Gap',M_.endo_names,'exact'),strmatch('c_A_Gap',M_.endo_names,'exact'))+...
((1/2)*n*phi_GY*(1/psi + phi_GY*chi))...
*oo_.var(strmatch('g_A_Gap',M_.endo_names,'exact'),strmatch('g_A_Gap',M_.endo_names,'exact'))+...
((1/2)*n*(1 - phi_GY)*(gamma*alpha*(alpha - 2) + 2*phi_caps + (1 - phi_GY)*(phi_caps^2)*chi)*((1-n)^2))...
*oo_.var(strmatch('tt_A_Gap',M_.endo_names,'exact'),strmatch('tt_A_Gap',M_.endo_names,'exact'))+...
((1/2)*(1/2)*n*2*phi_GY*(1 - phi_GY)*chi)...
*oo_.var(strmatch('c_A_Gap',M_.endo_names,'exact'),strmatch('g_A_Gap',M_.endo_names,'exact'))+...
((1/2)*(1/2)*n*(1 - phi_GY)*(2*alpha + 2*(1 - phi_GY)*phi_caps*chi)*(1-n))...
*oo_.var(strmatch('c_A_Gap',M_.endo_names,'exact'),strmatch('tt_A_Gap',M_.endo_names,'exact'))+...
((1/2)*(1/2)*n*2*phi_GY*(1 - phi_GY)*phi_caps*chi*(1-n))...
*oo_.var(strmatch('g_A_Gap',M_.endo_names,'exact'),strmatch('tt_A_Gap',M_.endo_names,'exact'))+...
((1/2)*(1/2)*n*2*phi_GY*(1 - phi_GY)*chi)...
*oo_.var(strmatch('g_A_Gap',M_.endo_names,'exact'),strmatch('c_A_Gap',M_.endo_names,'exact'))+...
((1/2)*(1/2)*n*(1 - phi_GY)*(2*alpha + 2*(1 - phi_GY)*phi_caps*chi)*(1-n))...
*oo_.var(strmatch('tt_A_Gap',M_.endo_names,'exact'),strmatch('c_A_Gap',M_.endo_names,'exact'))+...
((1/2)*(1/2)*n*2*phi_GY*(1 - phi_GY)*phi_caps*chi*(1-n))...
*oo_.var(strmatch('tt_A_Gap',M_.endo_names,'exact'),strmatch('g_A_Gap',M_.endo_names,'exact'))+...
((1/2)*(1-n)*(epsilon/phi_B))...
*oo_.var(strmatch('pi_B_Hat',M_.endo_names,'exact'),strmatch('pi_B_Hat',M_.endo_names,'exact'))+...
((1/2)*(1-n)*(1 - phi_GY)*(1/sigma + (1 - phi_GY)*chi))...
*oo_.var(strmatch('c_B_Gap',M_.endo_names,'exact'),strmatch('c_B_Gap',M_.endo_names,'exact'))+...
((1/2)*(1-n)*phi_GY*(1/psi + phi_GY*chi))...
*oo_.var(strmatch('g_B_Gap',M_.endo_names,'exact'),strmatch('g_B_Gap',M_.endo_names,'exact'))+...
((1/2)*(1-n)*(1 - phi_GY)*(gamma*alpha*(alpha - 2) + 2*phi_caps + (1 - phi_GY)*(phi_caps^2)*chi)*(n^2))...
*oo_.var(strmatch('tt_B_Gap',M_.endo_names,'exact'),strmatch('tt_B_Gap',M_.endo_names,'exact'))+...
((1/2)*(1/2)*(1-n)*2*phi_GY*(1 - phi_GY)*chi)...
*oo_.var(strmatch('c_B_Gap',M_.endo_names,'exact'),strmatch('g_B_Gap',M_.endo_names,'exact'))+...
((1/2)*(1/2)*(1-n)*(1 - phi_GY)*(2*alpha + 2*(1 - phi_GY)*phi_caps*chi)*n)...
*oo_.var(strmatch('c_B_Gap',M_.endo_names,'exact'),strmatch('tt_B_Gap',M_.endo_names,'exact'))+...
((1/2)*(1/2)*(1-n)*2*phi_GY*(1 - phi_GY)*phi_caps*chi*n)...
*oo_.var(strmatch('g_B_Gap',M_.endo_names,'exact'),strmatch('tt_B_Gap',M_.endo_names,'exact'))+...
((1/2)*(1/2)*(1-n)*2*phi_GY*(1 - phi_GY)*chi)...
*oo_.var(strmatch('g_B_Gap',M_.endo_names,'exact'),strmatch('c_B_Gap',M_.endo_names,'exact'))+...
((1/2)*(1/2)*(1-n)*(1 - phi_GY)*(2*alpha + 2*(1 - phi_GY)*phi_caps*chi)*n)...
*oo_.var(strmatch('tt_B_Gap',M_.endo_names,'exact'),strmatch('c_B_Gap',M_.endo_names,'exact'))+...
((1/2)*(1/2)*(1-n)*2*phi_GY*(1 - phi_GY)*phi_caps*chi*n)...
*oo_.var(strmatch('tt_B_Gap',M_.endo_names,'exact'),strmatch('g_B_Gap',M_.endo_names,'exact'));
if abs(asymptotic_loss-oo_.osr.objective_function)>1e-10
error('Objective Function with Non-stationary Variables is wrong')
end
\ No newline at end of file
// Example of optimal simple rule
var y inflation r dummy_var;
varexo y_ inf_;
parameters delta sigma alpha kappa gammax0 gammac0 gamma_y_ gamma_inf_;
delta = 0.44;
kappa = 0.18;
alpha = 0.48;
sigma = -0.06;
model(linear);
y = delta * y(-1) + (1-delta)*y(+1)+sigma *(r - inflation(+1)) + y_;
inflation = alpha * inflation(-1) + (1-alpha) * inflation(+1) + kappa*y + inf_;
dummy_var=0.9*dummy_var(-1)+0.01*y;
r = gammax0*y(-1)+gammac0*inflation(-1)+gamma_y_*y_+gamma_inf_*inf_;
end;
shocks;
var y_;
stderr 0.63;
var inf_;
stderr 0.4;
end;
options_.nograph=1;
options_.nocorr=1;
options_.osr.tolf=1e-20;
osr_params gammax0 gammac0 gamma_y_ gamma_inf_;
optim_weights;
inflation 1;
y 1;
dummy_var 1;
end;
gammax0 = 0.2;
gammac0 = 1.5;
gamma_y_ = 8;
gamma_inf_ = 3;
osr;
%compute objective function manually
objective=oo_.var(strmatch('y',M_.endo_names,'exact'),strmatch('y',M_.endo_names,'exact'))+oo_.var(strmatch('inflation',M_.endo_names,'exact'),strmatch('inflation',M_.endo_names,'exact'))+oo_.var(strmatch('dummy_var',M_.endo_names,'exact'),strmatch('dummy_var',M_.endo_names,'exact'));
if abs(oo_.osr.objective_function-objective)>1e-8
error('Objective Function is wrong')
end
%redo computation with covariance specified
optim_weights;
inflation 1;
y 1;
dummy_var 1;
y,inflation 0.5;
end;
osr;
%compute objective function manually
objective=oo_.var(strmatch('y',M_.endo_names,'exact'),strmatch('y',M_.endo_names,'exact'))+oo_.var(strmatch('inflation',M_.endo_names,'exact'),strmatch('inflation',M_.endo_names,'exact'))+oo_.var(strmatch('dummy_var',M_.endo_names,'exact'),strmatch('dummy_var',M_.endo_names,'exact'))+0.5*oo_.var(strmatch('y',M_.endo_names,'exact'),strmatch('inflation',M_.endo_names,'exact'));
if abs(oo_.osr.objective_function-objective)>1e-8
error('Objective Function is wrong')
end
gammax0=1.35533;
gammac0=1.39664;
gamma_y_=16.6667;
gamma_inf_=9.13199;
%redo computation with double weight on one covariance
optim_weights;
inflation 1;
y 1;
dummy_var 1;
y,inflation 1;
end;
osr;
%compute objective function manually
objective=oo_.var(strmatch('y',M_.endo_names,'exact'),strmatch('y',M_.endo_names,'exact'))+oo_.var(strmatch('inflation',M_.endo_names,'exact'),strmatch('inflation',M_.endo_names,'exact'))+oo_.var(strmatch('dummy_var',M_.endo_names,'exact'),strmatch('dummy_var',M_.endo_names,'exact'))+1*oo_.var(strmatch('y',M_.endo_names,'exact'),strmatch('inflation',M_.endo_names,'exact'));
if abs(oo_.osr.objective_function-objective)>1e-8
error('Objective Function is wrong')
end
oo_covar_single=oo_;
%redo computation with single weight on both covariances
optim_weights;
inflation 1;
y 1;
dummy_var 1;
y,inflation 0.5;
inflation,y 0.5;
end;
osr;
%compute objective function manually
objective=oo_.var(strmatch('y',M_.endo_names,'exact'),strmatch('y',M_.endo_names,'exact'))+oo_.var(strmatch('inflation',M_.endo_names,'exact'),strmatch('inflation',M_.endo_names,'exact'))+oo_.var(strmatch('dummy_var',M_.endo_names,'exact'),strmatch('dummy_var',M_.endo_names,'exact'))+0.5*oo_.var(strmatch('y',M_.endo_names,'exact'),strmatch('inflation',M_.endo_names,'exact'))+0.5*oo_.var(strmatch('inflation',M_.endo_names,'exact'),strmatch('y',M_.endo_names,'exact'));
if abs(oo_.osr.objective_function-objective)>1e-8
error('Objective Function is wrong')
end
if abs(oo_.osr.objective_function-oo_covar_single.osr.objective_function)>1e-8
error('Objective Function is wrong')
end
if max(abs(cell2mat(struct2cell(oo_.osr.optim_params))-cell2mat(struct2cell(oo_covar_single.osr.optim_params))))>1e-5
error('Parameters should be identical')
end
function rep = CountryTablePage(rep, countryAbbr, countryName, db_q, dc_q, trange, vline_after)
% Copyright (C) 2013 Dynare Team
function rep = CountryTablePage(rep, countryAbbr, countryName, db_q, dc_q, db_a, dc_a, trange, vline_after)
% Copyright (C) 2013-2014 Dynare Team
%
% This file is part of Dynare.
%
......@@ -42,8 +42,10 @@ otherThree = {'EA6','LA6','RC6'};
notForOtherThree = {'BLT_', 'UNR_', 'UNR_BAR_', 'UNR_GAP_'};
rep = rep.addTable('title', countryName, ...
'range', trange, ...
'vlineAfter', vline_after);
'range', {trange, dates('2012a'):dates('2014a')}, ...
'vlineAfter', {vline_after dates('2014q4')});
for i=1:length(seriesNames)
if any(strcmp(countryAbbr, otherThree)) && ...
......@@ -51,11 +53,16 @@ for i=1:length(seriesNames)
continue
end
db_q = db_q.tex_rename([seriesNames{i}{1} countryAbbr], seriesNames{i}{2});
rep = rep.addSeries('data', db_q{[seriesNames{i}{1} countryAbbr]});
rep = rep.addSeries('data', db_q{[seriesNames{i}{1} countryAbbr]}, ...
'tableDataRhs', db_a{[seriesNames{i}{1} countryAbbr]});
delta = db_q{[seriesNames{i}{1} countryAbbr]}-dc_q{[seriesNames{i}{1} countryAbbr]};
delta = delta.tex_rename('$\Delta$');
deltaa = db_a{[seriesNames{i}{1} countryAbbr]}-dc_a{[seriesNames{i}{1} countryAbbr]};
deltaa = delta.tex_rename('$\Delta$');
rep = rep.addSeries('data', delta, ...
'tableShowMarkers', true, ...
'tableAlignRight', true);
'tableAlignRight', true, ...
'tableDataRhs', deltaa);
end
end
function runDynareReport(dc_a, dc_q, db_a, db_q)
% Copyright (C) 2013 Dynare Team
% Copyright (C) 2013-2014 Dynare Team
%
% This file is part of Dynare.
%
......@@ -120,7 +120,8 @@ for i=1:length(shortNames)
rep = rep.addPage('title', 'Jan1 vs Jan2', ...
'titleFormat', '\large\bfseries');
rep = rep.addSection();
rep = CountryTablePage(rep, shortNames{i}, longNames{i}, db_q, dc_q, trange, dates('2012q2'));
rep = CountryTablePage(rep, shortNames{i}, longNames{i}, db_q, dc_q, ...
db_a, dc_a, trange, dates('2012q2'));
end
%% Residual Reports
......
top_test_dir = getenv('TOP_TEST_DIR');
addpath(top_test_dir);
addpath([top_test_dir filesep '..' filesep 'matlab']);
dynare_config([], 0);
% Test Dynare Version
if ~strcmp(dynare_version(), getenv('DYNARE_VERSION'))
error('Incorrect version of Dynare is being tested')
end
mlist = get_directory_description('../matlab');
failedtests = {};
counter = 0;
for i = 1:length(mlist)
f = [top_test_dir filesep mlist{i} ];
if is_unitary_test_available(f)
[check, info] = mtest(f);
for j = 1:size(info, 1)
counter = counter + 1;
if ~info{j,3}
failedtests{length(failedtests)+1} = [ mlist{i} '#' num2str(info{j,2}) ];
end
end
end
end
cd(getenv('TOP_TEST_DIR'));
if isoctave
fid = fopen('run_all_unitary_tests.o.trs', 'w+');
else
fid = fopen('run_all_unitary_tests.m.trs', 'w+');
end
if length(failedtests) > 0
fprintf(fid,':test-result: FAIL\n');
fprintf(fid,':number-tests: %d\n', counter);
fprintf(fid,':number-failed-tests: %d\n', length(failedtests));
fprintf(fid,':list-of-failed-tests: %s\n', failedtests{:});
else
fprintf(fid,':test-result: PASS\n');
fprintf(fid,':number-tests: %d\n', counter);
fprintf(fid,':number-failed-tests: 0\n');
end
fclose(fid);
exit
## Copyright (C) 2009-2012 Dynare Team
## Copyright (C) 2009-2014 Dynare Team
##
## This file is part of Dynare.
##
......@@ -31,9 +31,8 @@ if !strcmp(dynare_version(), getenv("DYNARE_VERSION"))
endif
## Ask gnuplot to create graphics in text mode
## Note that setenv() was introduced in Octave 3.0.2, for compatibility
## with MATLAB
putenv("GNUTERM", "dumb")
graphics_toolkit gnuplot;
setenv("GNUTERM", "dumb");
## Test MOD files listed in Makefile.am
name = getenv("FILESTEM");
......
var c, h, pi, w, R, r_e, y, gdp, gdp_hat, k, u, g, c_hat, w_hat, y_hat, h_hat;
varexo d, z, eta;
parameters alpha, beta, sigma, gamma, theta, ni, tau_w, phi_p, phi_y;
beta = 0.997;
sigma = 2;
gamma = 25;
theta = 7.67;
tau_w = 0.2;
ni = 0.28;
phi_p = 1.5;
phi_y = 0.125;
alpha = 0.064;
model;
// log-deviation of _ from its steady state value
gdp_hat=log(gdp)-log(steady_state(gdp));
c_hat=log(c)-log(steady_state(c));
w_hat=log(w)-log(steady_state(w));
y_hat=log(y)-log(steady_state(y));
h_hat=log(h)-log(steady_state(h));
// real interest rate
r_e=1/(beta*d(+1))-1;
//FOC labor
c^sigma*h^ni=w*(1-tau_w);
//Euler equation 1
1=beta*d(+1)*(1+R)/(1+pi(+1))*(c/c(+1))^sigma;
//Euler equation 2
0=1/(1-alpha)*(steady_state(w)/z)*h^alpha-1-gamma/theta*pi*(1+pi)+beta*d(+1)*(c/c(+1))^sigma * y(+1)/y*gamma/theta*pi(+1)*(1+pi(+1));
// Taylor rule with ZLB
R=max(0,r_e+phi_p*pi+phi_y*gdp_hat);
//output
y=z*h^(1-alpha);
//aggregate resource constraint
c=(1-k-eta)*y;
// resource cost of price adjustment
k=(gamma/2)*(pi^2);
//government purchases
g=eta*y;
// GDP
gdp=(1-k)*y;
//utility
u=(c^(1-sigma))/(1-sigma)-(h^(1+ni))/(1+ni);
end;
initval;
z=1;
d=1;
pi=0;
k=(gamma/2)*(pi^2);
r_e=1/(beta*d)-1;
eta=0.2;
h=1;
y=z*h;
g=eta*y;
c=(1-k-eta)*y;
w=z;
gdp=(1-k)*y;
R=r_e;
end;
steady;
check;
shocks;
//5% preference shock
var d;
periods 1:10;
values 1.05;
//technology shock
var z;
periods 1:10;
values 1.05;
end;
simul(periods=40,maxit=1000);
rplot gdp_hat;
rplot R;
if oo_.deterministic_simulation.status~=1
error('This model has solution');
end
\ No newline at end of file
var c, h, pi, w, R, r_e, y, gdp, gdp_hat, k, u, g, c_hat, w_hat, y_hat, h_hat;
varexo d, z, eta;
parameters alpha, beta, sigma, gamma, theta, ni, tau_w, phi_p, phi_y;
beta = 0.997;
sigma = 2;
gamma = 25;
theta = 7.67;
tau_w = 0.2;
ni = 0.28;
phi_p = 1.5;
phi_y = 0.125;
alpha = 0.064;
model;
// log-deviation of _ from its steady state value
gdp_hat=log(gdp)-log(steady_state(gdp));
c_hat=log(c)-log(steady_state(c));
w_hat=log(w)-log(steady_state(w));
y_hat=log(y)-log(steady_state(y));
h_hat=log(h)-log(steady_state(h));
// real interest rate
r_e=1/(beta*d(+1))-1;
//FOC labor
c^sigma*h^ni=steady_state(w)*(1-tau_w);
//Euler equation 1
1=beta*d(+1)*(1+R)/(1+pi(+1))*(c/c(+1))^sigma;
//Euler equation 2
0=1/(1-alpha)*(steady_state(w)/z)*h^alpha-1-gamma/theta*pi*(1+pi)+beta*d(+1)*(c/c(+1))^sigma * y(+1)/y*gamma/theta*pi(+1)*(1+pi(+1));
// Taylor rule with ZLB
R=max(0,r_e+phi_p*pi+phi_y*gdp_hat);
//output
y=z*h^(1-alpha);
//aggregate resource constraint
c=(1-k-eta)*y;
// resource cost of price adjustment
k=(gamma/2)*(pi^2);
//government purchases
g=eta*y;
// GDP
gdp=(1-k)*y;
//utility
u=(c^(1-sigma))/(1-sigma)-(h^(1+ni))/(1+ni);
end;
initval;
z=1;
d=1;
pi=0;
k=(gamma/2)*(pi^2);
r_e=1/(beta*d)-1;
eta=0.2;
h=1;
y=z*h;
g=eta*y;
c=(1-k-eta)*y;
w=z;
gdp=(1-k)*y;
R=r_e;
end;
steady;
check;
shocks;
//5% preference shock
var d;
periods 1:10;
values 1.05;
//technology shock
var z;
periods 1:10;
values 1.05;
end;
simul(periods=40,maxit=1000);
rplot gdp_hat;
rplot R;
if oo_.deterministic_simulation.status==1
error('This model has no solution');
end
\ No newline at end of file
......@@ -88,9 +88,9 @@ Section "MEX files for MATLAB 32-bit, version 7.3 to 7.4 (R2006b to R2007a)"
File ..\mex\matlab\win32-7.3-7.4\*.mexw32
SectionEnd
Section "MEX files for MATLAB 32-bit, version 7.5 to 8.2 (R2007b to R2013b)"
SetOutPath $INSTDIR\mex\matlab\win32-7.5-8.2
File ..\mex\matlab\win32-7.5-8.2\*.mexw32
Section "MEX files for MATLAB 32-bit, version 7.5 to 8.4 (R2007b to R2015a)"
SetOutPath $INSTDIR\mex\matlab\win32-7.5-8.5
File ..\mex\matlab\win32-7.5-8.5\*.mexw32
SectionEnd
Section "MEX files for MATLAB 64-bit, version 7.3 to 7.4 (R2006b to R2007a)"
......@@ -103,9 +103,9 @@ Section "MEX files for MATLAB 64-bit, version 7.5 to 7.7 (R2007b to R2008b)"
File ..\mex\matlab\win64-7.5-7.7\*.mexw64
SectionEnd
Section "MEX files for MATLAB 64-bit, version 7.8 to 8.2 (R2009a to R2013b)"
SetOutPath $INSTDIR\mex\matlab\win64-7.8-8.2
File ..\mex\matlab\win64-7.8-8.2\*.mexw64
Section "MEX files for MATLAB 64-bit, version 7.8 to 8.5 (R2009a to R2015a)"
SetOutPath $INSTDIR\mex\matlab\win64-7.8-8.5
File ..\mex\matlab\win64-7.8-8.5\*.mexw64
SectionEnd
SectionGroupEnd
......