- Code: Select all
%SETTING UP SIMULATION FOR THE FORECAST PERIOD
%number of periods over which to plot forecast
iperiod=30;
%setting initial period for simulation which is the last period of estimation
last= size(oo_.SmoothedVariables.Mean.('b'),1); %'b' is any endogenous variable
%set matrix of shocks over the forecast period
ex=zeros(iperiod,M_.exo_nbr); %all future shocks are zero for unconditional forecast
%set the last estimated value of variables as their starting value for simulations
y0=[];
if M_.orig_endo_nbr==M_.endo_nbr
for endo_iter=1:M_.endo_nbr
y0 = [y0;
oo_.SmoothedVariables.Mean.(deblank(M_.endo_names(endo_iter,:)))(last)];
end;
else
for endo_iter=1:M_.orig_endo_nbr
y0 = [y0;
oo_.SmoothedVariables.Mean.(deblank(M_.endo_names(endo_iter,:)))(last)];
end;
%deals with the auxilary variables (if there are any in the model)
aux = M_.endo_nbr - M_.orig_endo_nbr;
aux = zeros(aux,1);
y0 = vertcat(y0, aux);
end
%make sure decision rules were updated
[oo_.dr,info,M_,options_] = resol(0,M_,options_,oo_);
dr = oo_.dr;
iorder=1;
y_=simult_(y0,dr,ex,iorder);
This gives me simulation results which look like forecasts but are not exactly similar to Dynare forecast results. What am I doing wrong here?
I want this so I could implement ZLB on the forecast and also do other counterfactual analysis.