


function [yf,int_width]=forecst(dr,y0,horizon,var_list)
computes mean forecast for a given value of the parameters
computes also confidence band for the forecast
INPUTS:
dr: structure containing decision rules
y0: initial values
horizon: nbr of periods to forecast
var_list: list of variables (character matrix)
OUTPUTS:
yf: mean forecast
int_width: distance between upper bound and
mean forecast
SPECIAL REQUIREMENTS
none

0001 function [yf,int_width]=forcst(dr,y0,horizon,var_list) 0002 % function [yf,int_width]=forecst(dr,y0,horizon,var_list) 0003 % computes mean forecast for a given value of the parameters 0004 % computes also confidence band for the forecast 0005 % 0006 % INPUTS: 0007 % dr: structure containing decision rules 0008 % y0: initial values 0009 % horizon: nbr of periods to forecast 0010 % var_list: list of variables (character matrix) 0011 % 0012 % OUTPUTS: 0013 % yf: mean forecast 0014 % int_width: distance between upper bound and 0015 % mean forecast 0016 % 0017 % SPECIAL REQUIREMENTS 0018 % none 0019 0020 % Copyright (C) 2003-2011 Dynare Team 0021 % 0022 % This file is part of Dynare. 0023 % 0024 % Dynare is free software: you can redistribute it and/or modify 0025 % it under the terms of the GNU General Public License as published by 0026 % the Free Software Foundation, either version 3 of the License, or 0027 % (at your option) any later version. 0028 % 0029 % Dynare is distributed in the hope that it will be useful, 0030 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0031 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0032 % GNU General Public License for more details. 0033 % 0034 % You should have received a copy of the GNU General Public License 0035 % along with Dynare. If not, see <http://www.gnu.org/licenses/>. 0036 0037 global M_ oo_ options_ 0038 0039 make_ex_; 0040 yf = simult_(y0,dr,zeros(horizon,M_.exo_nbr),1); 0041 nstatic = dr.nstatic; 0042 npred = dr.npred; 0043 nc = size(dr.ghx,2); 0044 endo_nbr = M_.endo_nbr; 0045 inv_order_var = dr.inv_order_var; 0046 [A,B] = kalman_transition_matrix(dr,nstatic+(1:npred),1:nc,M_.exo_nbr); 0047 0048 if size(var_list,1) == 0 0049 var_list = M_.endo_names(1:M_.orig_endo_nbr,:); 0050 end 0051 nvar = size(var_list,1); 0052 ivar=zeros(nvar,1); 0053 for i=1:nvar 0054 i_tmp = strmatch(var_list(i,:),M_.endo_names,'exact'); 0055 if isempty(i_tmp) 0056 disp(var_list(i,:)); 0057 error (['One of the variable specified does not exist']) ; 0058 else 0059 ivar(i) = i_tmp; 0060 end 0061 end 0062 0063 ghx1 = dr.ghx(inv_order_var(ivar),:); 0064 ghu1 = dr.ghu(inv_order_var(ivar),:); 0065 0066 sigma_u = B*M_.Sigma_e*B'; 0067 sigma_u1 = ghu1*M_.Sigma_e*ghu1'; 0068 sigma_y = 0; 0069 0070 for i=1:horizon 0071 sigma_y1 = ghx1*sigma_y*ghx1'+sigma_u1; 0072 var_yf(i,:) = diag(sigma_y1)'; 0073 if i == horizon 0074 break 0075 end 0076 sigma_u = A*sigma_u*A'; 0077 sigma_y = sigma_y+sigma_u; 0078 end 0079 0080 fact = norminv((1-options_.conf_sig)/2,0,1); 0081 0082 int_width = zeros(horizon,M_.endo_nbr); 0083 for i=1:nvar 0084 int_width(:,i) = -fact*sqrt(var_yf(:,i)); 0085 end 0086 0087 yf = yf(ivar,:);