Merge pull request #453 from JohannesPfeifer/forward_looking_model_fix
Bugfixes and unit tests for stochastic purely forward-looking modelstime-shift
commit
26acc2ec1e
|
@ -54,7 +54,7 @@ if ~options_.k_order_solver || (options_.k_order_solver && options_.pruning) %if
|
||||||
end
|
end
|
||||||
|
|
||||||
if options_.k_order_solver && ~options_.pruning % Call dynare++ routines.
|
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
|
switch options_.order
|
||||||
case 1
|
case 1
|
||||||
[err, y_] = dynare_simul_(1,M_.nstatic,M_.npred,M_.nboth,M_.nfwrd,exo_nbr, ...
|
[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,:);
|
aa = ghx(iky,:);
|
||||||
bb = ghu(iky,:);
|
bb = ghu(iky,:);
|
||||||
if options_.order == 2 % mean correction for 2nd order
|
if options_.order == 2 % mean correction for 2nd order
|
||||||
|
if ~isempty(ikx)
|
||||||
Ex = (dr.ghs2(ikx)+dr.ghxx(ikx,:)*vx(:)+dr.ghuu(ikx,:)*M_.Sigma_e(:))/2;
|
Ex = (dr.ghs2(ikx)+dr.ghxx(ikx,:)*vx(:)+dr.ghuu(ikx,:)*M_.Sigma_e(:))/2;
|
||||||
Ex = (eye(n0)-AS(ikx,:))\Ex;
|
Ex = (eye(n0)-AS(ikx,:))\Ex;
|
||||||
Gamma_y{nar+3} = NaN*ones(nvar, 1);
|
Gamma_y{nar+3} = NaN*ones(nvar, 1);
|
||||||
Gamma_y{nar+3}(stationary_vars) = AS(iky,:)*Ex+(dr.ghs2(iky)+dr.ghxx(iky,:)*vx(:)+...
|
Gamma_y{nar+3}(stationary_vars) = AS(iky,:)*Ex+(dr.ghs2(iky)+dr.ghxx(iky,:)*vx(:)+...
|
||||||
dr.ghuu(iky,:)*M_.Sigma_e(:))/2;
|
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
|
||||||
end
|
end
|
||||||
if options_.hp_filter == 0
|
if options_.hp_filter == 0
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
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);
|
Loading…
Reference in New Issue