correcting bug in extended path and added a test
parent
692708859e
commit
62b1ed7923
|
@ -70,7 +70,8 @@ end
|
|||
options_.minimal_solving_period = options_.ep.periods;
|
||||
|
||||
% Get indices of variables with non zero steady state
|
||||
idx = find(abs(oo_.steady_state)>0);
|
||||
idx = find(abs(oo_.steady_state)>1e-6);
|
||||
indx = find(abs(oo_.steady_state)<=1e-6);
|
||||
|
||||
% Initialize the exogenous variables.
|
||||
make_ex_;
|
||||
|
@ -228,7 +229,16 @@ while (t<sample_size)
|
|||
end
|
||||
end
|
||||
% Test if periods is big enough.
|
||||
if ~increase_periods && max(max(abs(tmp(idx,end-options_.ep.lp:end)./tmp(idx,end-options_.ep.lp-1:end-1)-1)))<options_.dynatol.x
|
||||
delta = 0;
|
||||
if ~isempty(idx)
|
||||
delta = max(max(abs(tmp(idx,end-options_.ep.lp:end)./tmp(idx, ...
|
||||
end-options_.ep.lp-1:end-1)-1)));
|
||||
end;
|
||||
if ~isempty(indx)
|
||||
delta = max(delta,max(max(abs(tmp(indx,end-options_.ep.lp: ...
|
||||
end)-tmp(indx,end-options_.ep.lp-1:end-1)))));
|
||||
end
|
||||
if ~increase_periods && delta < options_.dynatol.x
|
||||
break
|
||||
else
|
||||
options_.periods = options_.periods + options_.ep.step;
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
var y pie r;
|
||||
varexo e_y e_pie;
|
||||
|
||||
parameters delta sigma alpha kappa gamma1 gamma2;
|
||||
|
||||
delta = 0.44;
|
||||
kappa = 0.18;
|
||||
alpha = 0.48;
|
||||
sigma = -0.06;
|
||||
|
||||
gamma1 = 1.5;
|
||||
gamma2 = 0.5;
|
||||
|
||||
model(block,bytecode,cutoff=0);
|
||||
y = delta * y(-1) + (1-delta)*y(+1)+sigma *(r - pie(+1)) + e_y;
|
||||
pie = alpha * pie(-1) + (1-alpha) * pie(+1) + kappa*y + e_pie;
|
||||
r = gamma1*pie+gamma2*y;
|
||||
end;
|
||||
|
||||
shocks;
|
||||
var e_y;
|
||||
stderr 0.63;
|
||||
var e_pie;
|
||||
stderr 0.4;
|
||||
end;
|
||||
|
||||
steady;
|
||||
|
||||
options_.maxit_ = 100;
|
||||
options_.ep.verbosity = 0;
|
||||
options_.ep.stochastic.status = 0;
|
||||
options_.console_mode = 0;
|
||||
|
||||
ts = extended_path([],1000);
|
||||
|
||||
options_.ep.stochastic.status = 1;
|
||||
sts = extended_path([],1000);
|
||||
|
||||
if max(max(abs(ts-sts))) > 1e-14
|
||||
error('extended path algorithm fails in ./tests/ep/linear.mod')
|
||||
end
|
Loading…
Reference in New Issue