1function yf=forcst2a(y0,dr,e) 2% function yf=forcst2a(y0,dr,e) 3% computes forecasts based on first order model solution, assuming the absence of shocks 4% Inputs: 5% - y0 [endo_nbr by maximum_endo_lag] matrix of starting values 6% - dr [structure] structure with Dynare decision rules 7% - e [horizon by exo_nbr] matrix with shocks 8% 9% Outputs: 10% - yf [horizon+maximum_endo_lag,endo_nbr] matrix of forecasts 11% 12% Copyright (C) 2008-2017 Dynare Team 13% 14% This file is part of Dynare. 15% 16% Dynare is free software: you can redistribute it and/or modify 17% it under the terms of the GNU General Public License as published by 18% the Free Software Foundation, either version 3 of the License, or 19% (at your option) any later version. 20% 21% Dynare is distributed in the hope that it will be useful, 22% but WITHOUT ANY WARRANTY; without even the implied warranty of 23% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24% GNU General Public License for more details. 25% 26% You should have received a copy of the GNU General Public License 27% along with Dynare. If not, see <http://www.gnu.org/licenses/>. 28 29global M_ options_ 30 31endo_nbr = M_.endo_nbr; 32ykmin_ = M_.maximum_endo_lag; 33 34horizon = size(e,1); 35 36k1 = [ykmin_:-1:1]; 37k2 = dr.kstate(find(dr.kstate(:,2) <= ykmin_+1),[1 2]); 38k2 = k2(:,1)+(ykmin_+1-k2(:,2))*endo_nbr; 39 40yf = zeros(horizon+ykmin_,endo_nbr); 41yf(1:ykmin_,:) = y0'; 42 43j = ykmin_*endo_nbr; 44for i=ykmin_+(1:horizon) 45 tempx = yf(k1,:)'; 46 yf(i,:) = tempx(k2)'*dr.ghx'; 47 k1 = k1+1; 48end 49 50yf(:,dr.order_var) = yf; 51