1function q = backcast(o, p, diff) % --*-- Unitary tests --*-- 2 3% Chains two dseries objects. 4% 5% INPUTS 6% - o [dseries] 7% - p [dseries] 8% 9% OUTPUTS 10% - q [dseries] 11% 12% REMARKS 13% The two dseries objects must have common frequency and the same number of variables. Also the 14% two samples must overlap. 15 16% Copyright © 2019-2020 Dynare Team 17% 18% This file is part of Dynare. 19% 20% Dynare is free software: you can redistribute it and/or modify 21% it under the terms of the GNU General Public License as published by 22% the Free Software Foundation, either version 3 of the License, or 23% (at your option) any later version. 24% 25% Dynare is distributed in the hope that it will be useful, 26% but WITHOUT ANY WARRANTY; without even the implied warranty of 27% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28% GNU General Public License for more details. 29% 30% You should have received a copy of the GNU General Public License 31% along with Dynare. If not, see <http://www.gnu.org/licenses/>. 32 33q = copy(o); 34 35if nargin>2 36 q.backcast_(p, diff); 37else 38 q.backcast_(p); 39end 40 41return 42 43%@test:1 44 y = ones(10,1); 45 for i=2:10 46 y(i) = 1.1*y(i-1); 47 end 48 49 ds = dseries(y(6:10), '1990Q1', 'toto'); 50 ts = dseries(y(1:6), '1988Q4', 'popeye'); 51 52 try 53 ds = backcast(ds, ts); 54 t(1) = true; 55 catch 56 t(1) = false; 57 end 58 59 if t(1) 60 t(2) = dassert(ds.freq,4); 61 t(3) = dassert(ds.init.freq,4); 62 t(4) = dassert(ds.init.time,[1988, 4]); 63 t(5) = dassert(ds.vobs,1); 64 t(6) = dassert(ds.nobs,10); 65 t(7) = abs(ds.data(1)-1)<1e-9; 66 end 67 68 T = all(t); 69%@eof:1