Added integration test.

Test that the extended path and stoch_simul (with order equal to 1)
algorithms return the same paths for the endogenous variables if the
RE model is linear.
time-shift
Stéphane Adjemian(Charybdis) 2016-03-31 14:18:01 +02:00 committed by Stéphane Adjemian (Charybdis)
parent 4926b6c6ff
commit 6dcfd1c072
3 changed files with 49 additions and 1 deletions

View File

@ -213,7 +213,8 @@ MODFILES = \
ep/rbc.mod \
ep/rbc2.mod \
ep/rbcii.mod \
ep/linearmodel.mod \
ep/linearmodel0.mod \
ep/linearmodel1.mod \
deterministic_simulations/purely_forward/ar1.mod \
deterministic_simulations/purely_forward/nk.mod \
deterministic_simulations/purely_backward/ar1.mod \

44
tests/ep/linearmodel0.mod Normal file
View File

@ -0,0 +1,44 @@
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(use_dll);
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;
stoch_simul(order=1,periods=200, irf=0, nomoments);
oo = oo_;
options_.simul.maxit = 100;
options_.ep.verbosity = 0;
options_.ep.stochastic.status = 0;
options_.ep.order = 0;
options_.ep.nnodes = 0;
options_.console_mode = 0;
ts = extended_path([], 200, oo_.exo_simul, options_, M_, oo_);
if max(max(abs(transpose(ts.data(2:end,:))-oo.endo_simul))) > 1e-6
error('extended path algorithm fails in ./tests/ep/linearmodel.mod')
end

View File

@ -33,14 +33,17 @@ options_.ep.order = 0;
options_.ep.nnodes = 0;
options_.console_mode = 0;
// Extended path simulation
ts = extended_path([], 10, [], options_, M_, oo_);
// Stochastic extended path simulation
options_.ep.stochastic.status = 1;
options_.ep.IntegrationAlgorithm='Tensor-Gaussian-Quadrature';
options_.ep.order = 1;
options_.ep.nnodes = 3;
sts = extended_path([], 10, [], options_, M_, oo_);
// The generated paths should be identical (because the model is linear)
if max(max(abs(ts.data-sts.data))) > 1e-12
error('extended path algorithm fails in ./tests/ep/linearmodel.mod')
end