From 5b1ebc821c869bf088673c23b993e81fb2e9dd6d Mon Sep 17 00:00:00 2001 From: Michel Juillard Date: Wed, 10 Mar 2010 08:40:52 +0100 Subject: [PATCH] SWZ: adding new tests and identification/exclusions.m --- matlab/swz/identification/exclusions.m | 22 ++++++++++++++++++++++ tests/swz/test_exclusions.mod | 20 ++++++++++++++++++++ tests/swz/test_lower_cholesky.mod | 15 +++++++++++++++ tests/swz/test_lower_cholesky_a.mod | 18 ++++++++++++++++++ tests/swz/test_ms.mod | 15 +++++++++++++++ tests/swz/test_ms_variances.mod | 22 ++++++++++++++++++++++ 6 files changed, 112 insertions(+) create mode 100644 matlab/swz/identification/exclusions.m create mode 100644 tests/swz/test_exclusions.mod create mode 100644 tests/swz/test_lower_cholesky.mod create mode 100644 tests/swz/test_lower_cholesky_a.mod create mode 100644 tests/swz/test_ms.mod create mode 100644 tests/swz/test_ms_variances.mod diff --git a/matlab/swz/identification/exclusions.m b/matlab/swz/identification/exclusions.m new file mode 100644 index 000000000..a184e5a4f --- /dev/null +++ b/matlab/swz/identification/exclusions.m @@ -0,0 +1,22 @@ +function [Ui,Vi,n0,np,ixmC0Pres] = exclusions(nvar,nexo,options_ms) + +indxC0Pres = options_ms.cross_restrictions; +nlags = options_ms.nlags; + +Qi = options_ms.Qi; +Ri1 = options_ms.Ri; + +k = nlags*nvar+1; + +Ri = zeros(k,k,nvar); +sR = size(Ri1); +Ri(1:sR(1),1:sR(2),1:sR(3)) = Ri1; + +for n=1:nvar + Ui{n} = null(Qi(:,:,n)); + Vi{n} = null(Ri(:,:,n)); + n0(n) = size(Ui{n},2); + np(n) = size(Vi{n},2); +end + +ixmC0Pres = NaN; \ No newline at end of file diff --git a/tests/swz/test_exclusions.mod b/tests/swz/test_exclusions.mod new file mode 100644 index 000000000..f876c420a --- /dev/null +++ b/tests/swz/test_exclusions.mod @@ -0,0 +1,20 @@ +// same as test_lower_cholesky.mod, but using exclusion syntax +addpath '../../matlab/swz'; +var R Pie Y; + +model; +Y = 0; +Pie = 0; +R = 0; +end; + +varobs Y Pie R; + +svar_identification; +exclusion lag 0; +equation 1, Pie, Y; +equation 2, Y; +end; + +sbvar(datafile = data,freq=4,initial_year=1959,final_year=2005,nlags=4); + diff --git a/tests/swz/test_lower_cholesky.mod b/tests/swz/test_lower_cholesky.mod new file mode 100644 index 000000000..e16f109e3 --- /dev/null +++ b/tests/swz/test_lower_cholesky.mod @@ -0,0 +1,15 @@ +// same as test_upper_cholesky.mod, but with reordered variables. Results must be the same. +addpath '../../matlab/swz'; +var R Pie Y; + +model; +Y = 0; +Pie = 0; +R = 0; +end; + +varobs Y Pie R; + + +sbvar(datafile = data,freq=4,initial_year=1959,final_year=2005,nlags=4,restriction_fname=lower_cholesky); + diff --git a/tests/swz/test_lower_cholesky_a.mod b/tests/swz/test_lower_cholesky_a.mod new file mode 100644 index 000000000..6ee9b7afa --- /dev/null +++ b/tests/swz/test_lower_cholesky_a.mod @@ -0,0 +1,18 @@ +// same as test_upper_cholesky.mod, but with reordered variables. Results must be the same. +addpath '../../matlab/swz'; +var R Pie Y; + +model; +Y = 0; +Pie = 0; +R = 0; +end; + +varobs Y Pie R; + +svar_identification; +lower_cholesky; +end; + +sbvar(datafile = data,freq=4,initial_year=1959,final_year=2005,nlags=4); + diff --git a/tests/swz/test_ms.mod b/tests/swz/test_ms.mod new file mode 100644 index 000000000..e16f109e3 --- /dev/null +++ b/tests/swz/test_ms.mod @@ -0,0 +1,15 @@ +// same as test_upper_cholesky.mod, but with reordered variables. Results must be the same. +addpath '../../matlab/swz'; +var R Pie Y; + +model; +Y = 0; +Pie = 0; +R = 0; +end; + +varobs Y Pie R; + + +sbvar(datafile = data,freq=4,initial_year=1959,final_year=2005,nlags=4,restriction_fname=lower_cholesky); + diff --git a/tests/swz/test_ms_variances.mod b/tests/swz/test_ms_variances.mod new file mode 100644 index 000000000..dbc6a5fbd --- /dev/null +++ b/tests/swz/test_ms_variances.mod @@ -0,0 +1,22 @@ +// same as test_upper_cholesky.mod, but with reordered variables. Results must be the same. +addpath '../../matlab/swz'; +var R Pie Y; + +model; +Y = 0; +Pie = 0; +R = 0; +end; + +varobs Y Pie R; + +svar_identification; +lower_cholesky; +end; + +markov_switching(chain=1,number_of_states=2,duration=2.5); + +svar(variances, chain=1); + +ms_sbvar(datafile = data,freq=4,initial_year=1959,final_year=2005,nlags=4,draws_nbr_modified_harmonic_mean=10000); +