From cfb57feff5f3db9a57ee714387c2ceb719162ac8 Mon Sep 17 00:00:00 2001 From: Michel Juillard Date: Thu, 3 Nov 2011 11:14:37 +0100 Subject: [PATCH] correcting tests --- tests/Makefile.am | 1 + tests/kalman_filter_smoother/algo1.mod | 4 ++-- tests/kalman_filter_smoother/algo2.mod | 2 +- tests/kalman_filter_smoother/algo3.mod | 2 +- tests/kalman_filter_smoother/algo4.mod | 2 +- tests/kalman_filter_smoother/algoH2.mod | 23 ++++++++++++++++------- tests/kalman_filter_smoother/fs2000a.mod | 4 +--- 7 files changed, 23 insertions(+), 15 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index b74f909f7..b32ccc107 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -102,6 +102,7 @@ MODFILES = \ ms-sbvar/test_upper_cholesky_nc.mod \ ms-sbvar/test_ms_variances.mod \ ms-sbvar/test_ms_variances_repeated_runs.mod \ + kalman_filter_smoother/gen_data.mod \ kalman_filter_smoother/algo1.mod \ kalman_filter_smoother/algo2.mod \ kalman_filter_smoother/algo3.mod \ diff --git a/tests/kalman_filter_smoother/algo1.mod b/tests/kalman_filter_smoother/algo1.mod index 482240ba4..29e5b0203 100644 --- a/tests/kalman_filter_smoother/algo1.mod +++ b/tests/kalman_filter_smoother/algo1.mod @@ -32,7 +32,7 @@ end; varobs dw dx dy z; -estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo1_mode); +estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,filtered_vars); //checking smoother consistency X = oo_.SmoothedVariables; @@ -47,7 +47,7 @@ for t=2:200; end; if max(max(abs(err))) > 1e-10; error('Test fails') -endif; +end; d=load('data'); dat = [d.dw d.dx d.dy d.z]; diff --git a/tests/kalman_filter_smoother/algo2.mod b/tests/kalman_filter_smoother/algo2.mod index d589792cd..0c54b4cee 100644 --- a/tests/kalman_filter_smoother/algo2.mod +++ b/tests/kalman_filter_smoother/algo2.mod @@ -32,7 +32,7 @@ end; varobs dw dx dy z; -estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo1_mode,kalman_algo=2); +estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo1_mode,kalman_algo=2,filtered_vars); //checking smoother consistency X = oo_.SmoothedVariables; diff --git a/tests/kalman_filter_smoother/algo3.mod b/tests/kalman_filter_smoother/algo3.mod index 78fff75e8..22f1ed5b3 100644 --- a/tests/kalman_filter_smoother/algo3.mod +++ b/tests/kalman_filter_smoother/algo3.mod @@ -35,7 +35,7 @@ end; varobs w x y; -estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,diffuse_filter); +estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,diffuse_filter,filtered_vars); //checking smoother consistency X = oo_.SmoothedVariables; diff --git a/tests/kalman_filter_smoother/algo4.mod b/tests/kalman_filter_smoother/algo4.mod index 4e5276867..7ad9e208e 100644 --- a/tests/kalman_filter_smoother/algo4.mod +++ b/tests/kalman_filter_smoother/algo4.mod @@ -35,7 +35,7 @@ end; varobs w x y; -estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo3_mode,diffuse_filter,kalman_algo=4); +estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo3_mode,diffuse_filter,kalman_algo=4,filtered_vars); //checking smoother consistency X = oo_.SmoothedVariables; diff --git a/tests/kalman_filter_smoother/algoH2.mod b/tests/kalman_filter_smoother/algoH2.mod index 96b730810..70a7b1de0 100644 --- a/tests/kalman_filter_smoother/algoH2.mod +++ b/tests/kalman_filter_smoother/algoH2.mod @@ -35,7 +35,7 @@ end; varobs dw dx dy z; //estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,kalman_algo=2); -estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algoH1_mode,kalman_algo=2); +estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algoH1_mode,kalman_algo=2,filtered_vars); //checking smoother consistency X = oo_.SmoothedVariables; @@ -48,13 +48,17 @@ err = zeros(6,200); for t=2:200; err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)'; end; -disp(max(max(abs(err)))); +if max(max(abs(err))) > 1e-10; + error('Test fails'); +end; d=load('data'); dat = [d.dw d.dx d.dy d.z]; X = oo_.SmoothedMeasurementErrors; ME = [X.dw X.dx X.dy X.z]; -disp(max(max(abs(dat(1000:1199,:)-S(:,[2:4 1])-ME)))); +if max(max(abs(dat(1000:1199,:)-S(:,[2:4 1])-ME))) > 1e-10; + error('Test fails'); +end; o1 = load('algoH1_results'); obj_endo={'SmoothedVariables'; 'FilteredVariables'; 'UpdatedVariables'}; @@ -68,7 +72,9 @@ for i=1:nobj_endo; var2 = eval(['oo_.' obj_endo{i} '.' M_.endo_names(j,:)]); err_endo(:,j) = var1-var2; end; - disp(max(max(abs(err_endo)))); + if max(max(abs(err_endo))) > 1e-10; + error('Test fails'); + end; end; @@ -80,8 +86,11 @@ for i=1:nobj_exo; var2 = eval(['oo_.' obj_exo{i} '.' M_.exo_names(j,:)]); err_exo(:,j,i) = var1 - var2; end; - disp(max(max(abs(err_exo)))); + if max(max(abs(err_exo))) > 1e-10; + error('Test fails'); + end; end; -disp(max(max(max(abs(err_exo))))); -disp(max(max(abs(o1.oo_.SmoothedMeasurementErrors.z - oo_.SmoothedMeasurementErrors.z)))); \ No newline at end of file +if max(max(abs(o1.oo_.SmoothedMeasurementErrors.z - oo_.SmoothedMeasurementErrors.z))) > 1e-10; + error('Test fails'); +end; diff --git a/tests/kalman_filter_smoother/fs2000a.mod b/tests/kalman_filter_smoother/fs2000a.mod index d0bda7c48..a2c241e94 100644 --- a/tests/kalman_filter_smoother/fs2000a.mod +++ b/tests/kalman_filter_smoother/fs2000a.mod @@ -55,9 +55,7 @@ var e_a; stderr 0.014; var e_m; stderr 0.005; end; -unit_root_vars P_obs Y_obs; - -steady; +steady(nocheck); check;