Unverified Commit 1c0d1409 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Fix the use of [static]/[dynamic] equations with the “block” option

parent fdf5bfbb
......@@ -309,7 +309,19 @@ if M.static_and_dynamic_models_differ
if options.bytecode
[r, ~]= bytecode('dynamic','evaluate', z, zx, params, ys, 1);
elseif options.block
[r, oo.dr] = feval([M.fname '.dynamic'], z', zx, params, ys, M.maximum_lag+1, oo.dr);
T=NaN(M.block_structure.dyn_tmp_nbr, 1);
for i = 1:length(M.block_structure.block)
[rr, yy, T, g] = feval([M.fname '.dynamic'], i, ...
dynvars_from_endo_simul(z, M.maximum_lag+1, M), ...
zx, params, ys, T, M.maximum_lag+1, false);
if M.block_structure.block(i).Simulation_Type == 1 || ... % evaluateForward
M.block_structure.block(i).Simulation_Type == 2 % evaluateBackward
vidx = M.block_structure.block(i).variable;
rr = yy(M.lead_lag_incidence(M.maximum_endo_lag+1, vidx)) - oo.steady_state(vidx);
end
idx = M.block_structure.block(i).equation;
r(idx) = rr;
end
else
iyv = M.lead_lag_incidence';
iyr0 = find(iyv(:));
......
......@@ -63,6 +63,7 @@ MODFILES = \
ramst.mod \
ramst_a.mod \
ramst_static_tag.mod \
ramst_static_tag_block.mod \
ramst_mshocks.mod \
on-the-fly/ex1.mod \
on-the-fly/ex2.mod \
......
// Test the [static]/[dynamic] tags, in the context of a block decomposed model
var c k;
varexo x;
parameters alph gam delt bet aa;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
aa=0.5;
model(block);
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
[dynamic] c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
[static] k = ((delt+bet)/(x*aa*alph))^(1/(alph-1));
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k;
end;
steady;
check;
shocks;
var x;
periods 1;
values 1.2;
end;
simul(periods=200);
rplot c;
rplot k;
Supports Markdown
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