Testsuite: reorganize for bock and bytecode, using a script for systematically testing options combinations

time-shift
Sébastien Villemot 2010-10-22 15:50:54 +02:00
parent 6ba0ff5415
commit 0c958f16e5
14 changed files with 37 additions and 273 deletions

2
tests/.gitignore vendored
View File

@ -10,6 +10,8 @@
*.dat
*_simul
/block_bytecode/ws
/block_bytecode/ls2003_tmp.mod
/partial_information/PItest3aHc0PCLsimModPiYrVarobsAll_PCL*
/partial_information/PItest3aHc0PCLsimModPiYrVarobsCNR_PCL*

View File

@ -1,7 +1,6 @@
DYNARE_ROOT = $(abs_top_srcdir)/matlab
# Under Octave we only test a subset of MOD files, because of missing features
OCTAVE_MODS = \
MODS = \
ramst.mod \
ramst_a.mod \
example1.mod \
@ -23,15 +22,7 @@ OCTAVE_MODS = \
steady_state_operator/use_dll.mod \
steady_state_operator/block.mod \
steady_state_operator/bytecode_test.mod \
block_bytecode/fs2000_simk.mod \
block_bytecode/fs2000_lu.mod \
block_bytecode/fs2000_bicgstab.mod \
block_bytecode/fs2000_optpath.mod \
block_bytecode/fs2000_bytecode.mod \
block_bytecode/fs2000_block_bytecode.mod \
block_bytecode/ramst.mod \
block_bytecode/ireland.mod \
block_bytecode/ls2003.mod \
block_bytecode/ramst_normcdf_and_friends.mod \
k_order_perturbation/fs2000k2a.mod \
k_order_perturbation/fs2000k2.mod \
@ -76,18 +67,16 @@ OCTAVE_MODS = \
external_function/example1_no_deriv_functions_provided.mod \
external_function/example1_no_deriv_functions_provided_dll.mod
MODS = $(OCTAVE_MODS) \
block_bytecode/fs2000_gmres.mod \
block_bytecode/ramst_a.mod
EXTRA_DIST = $(MODS) \
run_test_octave.m \
block_bytecode/run_block_bytecode_tests.m \
block_bytecode/run_ls2003.m \
block_bytecode/ls2003.mod \
fs2000/fsdat_simul.m \
test.m \
objectives \
ramst_initval_file_data.m \
homotopy/common.mod \
block_bytecode/fs2000_common.mod \
bvar_a_la_sims/bvar_sample.m
TARGETS = check-matlab
@ -98,13 +87,17 @@ endif
check-local: $(TARGETS)
check-octave: $(OCTAVE_MODS)
check-octave: $(MODS)
@set -e; \
for modfile in $(OCTAVE_MODS); do \
for modfile in $(MODS); do \
$(OCTAVE) --norc --silent --no-history run_test_octave.m $$modfile $(DYNARE_ROOT) $(PACKAGE_VERSION); \
done
.PHONY: check-octave
check-block-bytecode:
cd block_bytecode && $(OCTAVE) --norc --silent --no-history run_block_bytecode_tests.m $(DYNARE_ROOT) $(PACKAGE_VERSION)
.PHONY: check-block-bytecode
check-matlab: $(MODS)
# MATLAB stuff to be added here
.PHONY: check-matlab
@ -137,8 +130,7 @@ clean-local:
rm -f arima/data1.m arima/data2.m \
k_order_perturbation/*.jnl \
k_order_perturbation/*.mat \
block_bytecode/fs2000_simk.swp
k_order_perturbation/*.mat
rm -rf ramsey_objective
@ -149,3 +141,5 @@ clean-local:
rm -f dsge-var/datarabanal_hybrid.mat
rm -rf partial_information/PItest3aHc0PCLsimModPiYrVarobsAll_PCL* partial_information/PItest3aHc0PCLsimModPiYrVarobsCNR_PCL*
rm -rf block_bytecode/ws block_bytecode/ls2003_tmp*

View File

@ -1,8 +0,0 @@
// Tests option block + stack_solve_algo = 3 + solve_algo = 1
// Must be launched after fs2000_simk.mod
@#define block = 1
@#define bytecode = 0
@#define solve_algo = 1
@#define stack_solve_algo = 3
@#include "fs2000_common.mod"

View File

@ -1,8 +0,0 @@
// Tests option block+bytecode
// Must be launched after fs2000_simk.mod
@#define bytecode = 1
@#define block = 1
@#define solve_algo = 8
@#define stack_solve_algo = 5
@#include "fs2000_common.mod"

View File

@ -1,8 +0,0 @@
// Tests option bytecode without block
// Must be launched after fs2000_simk.mod
@#define bytecode = 1
@#define block = 0
@#define solve_algo = 8
@#define stack_solve_algo = 5
@#include "fs2000_common.mod"

View File

@ -1,95 +0,0 @@
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
@#if block && bytecode
model(block, bytecode);
@#else
@# if block && !bytecode
model(block);
@# else
@# if !block && bytecode
model(bytecode);
@# else
model;
@# endif
@# endif
@#endif
/*0*/ exp(gam+e_a) = dA ;
/*1*/ log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
/*2*/ -P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
/*3*/ l/n = W;
/*4*/ -(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
/*5*/ R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
/*6*/ 1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
/*7*/ c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
/*8*/ P*c = m;
/*9*/ m-1+d = l;
/*10*/ e = exp(e_a);
/*11*/ k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a)) = y ;
/*12*/ gy_obs = dA*y/y(-1);
/*13*/ gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
e_a=0;
e_m=0;
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
options_.maxit_=10;
steady(solve_algo = @{solve_algo});
@#if block
model_info;
@#endif
shocks;
var e_a;
periods 1;
values 0.16;
end;
simul(periods=200, stack_solve_algo = @{stack_solve_algo});
@#if block || bytecode
if ~exist('fs2000_simk_results.mat','file');
error('fs2000_simk must be run first');
end;
oo1 = load('fs2000_simk_results','oo_');
err = max(max(abs(oo_.endo_simul - oo1.oo_.endo_simul)))
disp(['Max error in simulation: ' num2str(err)])
if err > 1e-4
error('Error above the threshold')
end;
@#endif

View File

@ -1,8 +0,0 @@
// Tests option block + stack_solve_algo = 2 + solve_algo = 3
// Must be launched after fs2000_simk.mod
@#define block = 1
@#define bytecode = 0
@#define solve_algo = 2
@#define stack_solve_algo = 2
@#include "fs2000_common.mod"

View File

@ -1,8 +0,0 @@
// Tests option block + stack_solve_algo = 1 + solve_algo = 2
// Must be launched after fs2000_simk.mod
@#define block = 1
@#define bytecode = 0
@#define solve_algo = 2
@#define stack_solve_algo = 0
@#include "fs2000_common.mod"

View File

@ -1,8 +0,0 @@
// Tests option block + stack_solve_algo = 4 + solve_algo = 4
// Must be launched after fs2000_simk.mod
@#define block = 1
@#define bytecode = 0
@#define solve_algo = 4
@#define stack_solve_algo = 4
@#include "fs2000_common.mod"

View File

@ -1,5 +0,0 @@
@#define block = 0
@#define bytecode = 0
@#define solve_algo = 2
@#define stack_solve_algo = 0
@#include "fs2000_common.mod"

View File

@ -16,8 +16,19 @@ rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
@#if !block && !bytecode
model;
@#else
@# if block && !bytecode
model(block, cutoff=0);
@# else
@# if !block && bytecode
model(bytecode);
@# else
model(block, bytecode, cutoff=0);
@# endif
@# endif
@#endif
y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
@ -53,10 +64,15 @@ var e_pies = 1.89;
end;
options_.maxit_=100;
steady(solve_algo = 5);
steady(solve_algo = @{solve_algo});
@#if block
model_info;
//check;
@#endif
@#if !block && !bytecode
check;
@#endif
shocks;
var e_q;
@ -64,10 +80,11 @@ periods 1;
values 0.5;
end;
simul(periods=20, markowitz=0, stack_solve_algo = 5);
simul(periods=20, markowitz=0, stack_solve_algo = @{stack_solve_algo});
/*
rplot vv;
rplot ww;
rplot A;
rplot pie;
*/

View File

@ -1,27 +0,0 @@
var dx dy x y;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model(block);
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
x = x(-1)+dx;
y = y(-1)+dy;
end;
shocks;
var e_x; stderr 0.01;
var e_y; stderr 0.01;
end;
steady;
//check;
model_info;
simul(periods=50);
/*stoch_simul(order=1,periods=1000,irf=0,nomoments);
datatomfile('data1',[]);
*/

View File

@ -1,37 +0,0 @@
options_.maxit_ = 100;
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, bytecode);
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k;
end;
steady(solve_algo = 5);
//check;
model_info;
shocks;
var x;
periods 1;
values 1.02;
end;
simul(periods = 200, stack_solve_algo = 5, markowitz = 2);
rplot c;
rplot k;

View File

@ -1,37 +0,0 @@
// check shocks on several periods
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);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k +1 ;
end;
steady;
//check;
shocks;
var x;
periods 1 2 3 4;
values 1.1 1.2 1.3 1.4;
end;
simul(periods=200, stack_solve_algo = 2);
rplot c;
rplot k;