Commit 26acc2ec authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Merge pull request #453 from JohannesPfeifer/forward_looking_model_fix

Bugfixes and unit tests for stochastic purely forward-looking models
parents 139670e1 07a05d55
......@@ -54,7 +54,7 @@ if ~options_.k_order_solver || (options_.k_order_solver && options_.pruning) %if
end
if options_.k_order_solver && ~options_.pruning % Call dynare++ routines.
ex_ = [zeros(1,exo_nbr); ex_];
ex_ = [zeros(M_.maximum_lag,M_.exo_nbr); ex_];
switch options_.order
case 1
[err, y_] = dynare_simul_(1,M_.nstatic,M_.npred,M_.nboth,M_.nfwrd,exo_nbr, ...
......
......@@ -126,11 +126,16 @@ if options_.order == 2 || options_.hp_filter == 0
aa = ghx(iky,:);
bb = ghu(iky,:);
if options_.order == 2 % mean correction for 2nd order
Ex = (dr.ghs2(ikx)+dr.ghxx(ikx,:)*vx(:)+dr.ghuu(ikx,:)*M_.Sigma_e(:))/2;
Ex = (eye(n0)-AS(ikx,:))\Ex;
Gamma_y{nar+3} = NaN*ones(nvar, 1);
Gamma_y{nar+3}(stationary_vars) = AS(iky,:)*Ex+(dr.ghs2(iky)+dr.ghxx(iky,:)*vx(:)+...
dr.ghuu(iky,:)*M_.Sigma_e(:))/2;
if ~isempty(ikx)
Ex = (dr.ghs2(ikx)+dr.ghxx(ikx,:)*vx(:)+dr.ghuu(ikx,:)*M_.Sigma_e(:))/2;
Ex = (eye(n0)-AS(ikx,:))\Ex;
Gamma_y{nar+3} = NaN*ones(nvar, 1);
Gamma_y{nar+3}(stationary_vars) = AS(iky,:)*Ex+(dr.ghs2(iky)+dr.ghxx(iky,:)*vx(:)+...
dr.ghuu(iky,:)*M_.Sigma_e(:))/2;
else %no static and no predetermined
Gamma_y{nar+3} = NaN*ones(nvar, 1);
Gamma_y{nar+3}(stationary_vars) = (dr.ghs2(iky)+ dr.ghuu(iky,:)*M_.Sigma_e(:))/2;
end
end
end
if options_.hp_filter == 0
......
var a;
varexo epsil ;
parameters betta;
betta = 0.97;
model;
a = betta*a(+1)+epsil;
end;
initval;
a=0;
end;
steady;
shocks;
var epsil; stderr .2;
end;
steady;
check;
stoch_simul(periods=0, irf=30, order=1);
stoch_simul(periods=2000, irf=30, order=1);
stoch_simul(periods=0, irf=30, order=2);
stoch_simul(periods=2000, irf=30, order=2);
stoch_simul(periods=0, irf=30, order=3);
stoch_simul(periods=2000, irf=30, order=3);
stoch_simul(periods=0, irf=30, order=1,hp_filter=1600);
stoch_simul(periods=2000, irf=30, order=1,hp_filter=1600);
stoch_simul(periods=0, irf=30, order=2,hp_filter=1600);
stoch_simul(periods=2000, irf=30, order=2,hp_filter=1600);
stoch_simul(periods=0, irf=30, order=3,hp_filter=1600);
stoch_simul(periods=2000, irf=30, order=3,hp_filter=1600);
var a b;
varexo epsil ;
parameters betta;
betta = 0.97;
model;
a = betta*a(+1)+epsil;
b = a;
end;
initval;
a=0;
end;
steady;
shocks;
var epsil; stderr .2;
end;
steady;
check;
stoch_simul(periods=0, irf=30, order=1);
stoch_simul(periods=2000, irf=30, order=1);
stoch_simul(periods=0, irf=30, order=2);
stoch_simul(periods=2000, irf=30, order=2);
stoch_simul(periods=0, irf=30, order=3);
stoch_simul(periods=2000, irf=30, order=3);
stoch_simul(periods=0, irf=30, order=1,hp_filter=1600);
stoch_simul(periods=2000, irf=30, order=1,hp_filter=1600);
stoch_simul(periods=0, irf=30, order=2,hp_filter=1600);
stoch_simul(periods=2000, irf=30, order=2,hp_filter=1600);
stoch_simul(periods=0, irf=30, order=3,hp_filter=1600);
stoch_simul(periods=2000, irf=30, order=3,hp_filter=1600);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment