1function dcompare(s1)
2
3% Copyright (C) 2001-2017 Dynare Team
4%
5% This file is part of Dynare.
6%
7% Dynare is free software: you can redistribute it and/or modify
8% it under the terms of the GNU General Public License as published by
9% the Free Software Foundation, either version 3 of the License, or
10% (at your option) any later version.
11%
12% Dynare is distributed in the hope that it will be useful,
13% but WITHOUT ANY WARRANTY; without even the implied warranty of
14% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15% GNU General Public License for more details.
16%
17% You should have received a copy of the GNU General Public License
18% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
19
20global options_ nvx nvy x y lag1
21
22ftest(s1,0) ;
23
24i = [lag1(1):size(x,2)-lag1(2)+1]' ;
25
26if size(options_.smpl,1) == 1
27    error(['DSAMPLE not specified.']) ;
28end
29
30if options_.smpl(3) > 0
31    if options_.smpl(3) == 2
32        if options_.smpl(1)<0 || options_.smpl(2)>size(x,2)-lag1(2)
33            error ('Wrong sample.') ;
34        end
35        i = [options_.smpl(1)+lag1(1):options_.smpl(2)+lag1(1)]' ;
36    elseif options_.smpl(3) == 1
37        if options_.smpl(1)>size(x,2)-lag1(2)
38            error ('Wrong sample.') ;
39        end
40        i = [lag1(1):options_.smpl(1)+lag1(1)]' ;
41    end
42end
43
44j = bseastr(nvx,nvy) ;
45
46if stop
47    return ;
48end
49
50z = mean(mean(abs(x(j,i)-y(j,i)))) ;
51
52disp (['The mean absolute difference between set ' s1(1,:) 'and set ' s1(2,:)]) ;
53disp (['is : ' num2str(z)]) ;
54return ;
55