From f4b613a54ed167ed7f6bf5e782a07d615d0707e5 Mon Sep 17 00:00:00 2001 From: Ferhat Mihoubi Date: Fri, 16 Apr 2010 18:04:57 +0200 Subject: [PATCH] Corrections in mod-files to test steady_state command and erf(), normcdf() and normpdf() functions --- .../ramst_normcdf_and_friends.mod | 8 +++---- tests/block_bytecode/ramst_steady_state.mod | 17 ++++++-------- tests/ramst_normcdf_and_friends.mod | 22 +++++++++---------- tests/ramst_steady_state.mod | 20 ++++++++--------- 4 files changed, 29 insertions(+), 38 deletions(-) diff --git a/tests/block_bytecode/ramst_normcdf_and_friends.mod b/tests/block_bytecode/ramst_normcdf_and_friends.mod index f69a683d4..7f29706ea 100644 --- a/tests/block_bytecode/ramst_normcdf_and_friends.mod +++ b/tests/block_bytecode/ramst_normcdf_and_friends.mod @@ -1,9 +1,9 @@ -// Tests the normcdf() function, in the static M-file, and in a dynamic C file +// Tests the normcdf(), normpdf() and erf() functions, in the static and the dynamic byecode file -var c k t u v w; +var c k t u v; varexo x; -parameters alph gam delt bet aa c_steady_state; +parameters alph gam delt bet aa; alph=0.5; gam=0.5; delt=0.02; @@ -16,7 +16,6 @@ c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam); t = normcdf(x, 2, 3); u = normpdf(x, 1, 0.5); v = erf(x); -w = steady_state(k); end; initval; @@ -26,7 +25,6 @@ c = aa*k^alph-delt*k; t = 0; u = 0; v = 0; -w = 0; end; steady(solve_algo=5); diff --git a/tests/block_bytecode/ramst_steady_state.mod b/tests/block_bytecode/ramst_steady_state.mod index ae01d1e2e..866b267ae 100644 --- a/tests/block_bytecode/ramst_steady_state.mod +++ b/tests/block_bytecode/ramst_steady_state.mod @@ -1,6 +1,6 @@ -// Tests the normcdf() function, in the static M-file, and in a dynamic C file +// Tests steady_state, in the static and dynamic bytecode file -var c k t u v w; +var c k w; varexo x; parameters alph gam delt bet aa c_steady_state; @@ -13,9 +13,6 @@ aa=0.5; model(bytecode, 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); -t = normcdf(x, 2, 3); -u = normpdf(x, 1, 0.5); -v = erf(x); w = steady_state(k); end; @@ -23,9 +20,6 @@ initval; x = 1; k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1)); c = aa*k^alph-delt*k; -t = 0; -u = 0; -v = 0; w = 0; end; @@ -41,7 +35,10 @@ end; simul(periods=20, stack_solve_algo=5); -if(abs(oo_.steady_state(2) - oo_.endo_simul(6,2)) > 1e-10) - error('Test failed in bytecode for steady_state') +if(abs(oo_.steady_state(2) - oo_.steady_state(3)) > 1e-10) + error('Test failed in the static bytecode file for steady_state') end +if(abs(oo_.steady_state(2) - oo_.endo_simul(3,2)) > 1e-10) + error('Test failed in the dynamic bytecode file for steady_state') +end diff --git a/tests/ramst_normcdf_and_friends.mod b/tests/ramst_normcdf_and_friends.mod index 9a106cfa1..67ce709c2 100644 --- a/tests/ramst_normcdf_and_friends.mod +++ b/tests/ramst_normcdf_and_friends.mod @@ -1,22 +1,21 @@ -// Tests the normcdf() function, in the static M-file, and in a dynamic C file +// Tests the normcdf(), normpdf() and erf() functions, in the static M-file, and in a dynamic C-file -var c k t u v w; +var c k t u v; varexo x; -parameters alph gam delt bet aa c_steady_state; +parameters alph gam delt bet aa; alph=0.5; gam=0.5; delt=0.02; bet=0.05; aa=0.5; -model; +model(use_dll); 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); t = normcdf(x, 2, 3); u = normpdf(x, 1, 0.5); v = erf(x); -w = steady_state(k); end; initval; @@ -26,7 +25,6 @@ c = aa*k^alph-delt*k; t = 0; u = 0; v = 0; -w = 0; end; steady; @@ -42,26 +40,26 @@ end; simul(periods=20); if(abs(oo_.steady_state(5) - erf(1)) > 1e-10) - error('Test failed in static bytecode for erf') + error('Test failed in static M-file for erf') end if (abs(oo_.endo_simul(5, 2) - erf(1.2)) > 1e-10) - error('Test failed in dynamic bytecode for erf') + error('Test failed in dynamic M-file for erf') end if(abs(oo_.steady_state(4) - normpdf(1, 1, 0.5)) > 1e-10) - error('Test failed in static bytecode for normpdf') + error('Test failed in static M-file for normpdf') end if (abs(oo_.endo_simul(4, 2) - normpdf(1.2, 1, 0.5)) > 1e-10) - error('Test failed in dynamic bytecode for normpdf') + error('Test failed in dynamic M-file for normpdf') end if (abs(oo_.steady_state(3) - normcdf(1, 2, 3)) > 1e-10) - error('Test failed in static bytecode for normcdf') + error('Test failed in static M-file for normcdf') end if (abs(oo_.endo_simul(3, 2) - normcdf(1.2, 2, 3)) > 1e-10) - error('Test failed in dynamic bytecode for normcdf') + error('Test failed in dynamic M-file for normcdf') end diff --git a/tests/ramst_steady_state.mod b/tests/ramst_steady_state.mod index 2010dd250..7be8ec083 100644 --- a/tests/ramst_steady_state.mod +++ b/tests/ramst_steady_state.mod @@ -1,6 +1,6 @@ -// Tests the normcdf() function, in the static M-file, and in a dynamic C file +// Tests the steady_state, in the static M-file, and in a dynamic C file -var c k t u v w; +var c k w; varexo x; parameters alph gam delt bet aa c_steady_state; @@ -13,9 +13,6 @@ aa=0.5; model; 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); -t = normcdf(x, 2, 3); -u = normpdf(x, 1, 0.5); -v = erf(x); w = steady_state(k); end; @@ -23,15 +20,12 @@ initval; x = 1; k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1)); c = aa*k^alph-delt*k; -t = 0; -u = 0; -v = 0; w = 0; end; steady; -//check; +check; shocks; var x; @@ -41,7 +35,11 @@ end; simul(periods=20); -if(abs(oo_.steady_state(2) - oo_.endo_simul(6,2)) > 1e-10) - error('Test failed in bytecode for steady_state') +if(abs(oo_.steady_state(2) - oo_.steady_state(3)) > 1e-10) + error('Test failed in static M-file for steady_state') +end + +if(abs(oo_.steady_state(2) - oo_.endo_simul(3,2)) > 1e-10) + error('Test failed in dynamic M-file for steady_state') end