Merge pull request #453 from JohannesPfeifer/forward_looking_model_fix

Bugfixes and unit tests for stochastic purely forward-looking models
time-shift
Sébastien Villemot 2013-08-12 03:05:30 -07:00
commit 26acc2ec1e
4 changed files with 84 additions and 6 deletions

View File

@ -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, ...

View File

@ -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

View File

@ -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);

View File

@ -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);