From f27852d1ec8bd513b6047a8dc36e5e323f855518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Thu, 26 Nov 2020 15:48:57 +0100 Subject: [PATCH] Add test for mshocks block --- tests/Makefile.am | 1 + tests/ramst_mshocks.mod | 44 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 tests/ramst_mshocks.mod diff --git a/tests/Makefile.am b/tests/Makefile.am index 297de6211..e2bd84cae 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -63,6 +63,7 @@ MODFILES = \ ramst.mod \ ramst_a.mod \ ramst_static_tag.mod \ + ramst_mshocks.mod \ on-the-fly/ex1.mod \ on-the-fly/ex2.mod \ on-the-fly/ex3.mod \ diff --git a/tests/ramst_mshocks.mod b/tests/ramst_mshocks.mod new file mode 100644 index 000000000..186dbcb97 --- /dev/null +++ b/tests/ramst_mshocks.mod @@ -0,0 +1,44 @@ +// Test mshocks block + +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; +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 = 2; +k = ((delt+bet)/(1.0*aa*x*alph))^(1/(alph-1)); +c = aa*x*k^alph-delt*k; +end; + +steady; + +check; + +mshocks; +var x; +periods 1 2:3; +values 1.2 0.8; +end; + +perfect_foresight_setup(periods=200); +perfect_foresight_solver; + +rplot c; +rplot k; + +if ~all(oo_.exo_simul(M_.maximum_lag+(1:3)) == [ 2.4; 1.6; 1.6]) ... + || ~all(oo_.exo_simul(M_.maximum_lag+(4:200)) == 2) + error("mshocks not correctly applied") +end