Dynare Forecasts

Is there a way to generate dynare forecasts using simult_ function? This is what i have been doing:

[code]%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);[/code]

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.

To forecasts from which command are you comparing it? Without a full mod-file, it is hard to tell what goes wrong.

A more general remark: simult_ simulates a model solved with perturbation techniques. The ZLB introduces a non-differentiability, usually rendering the decision rules invalid. Therefore I am not sure that this will work.

  1. I have attached the mod file. I use the ‘forecast’ in estimation command as below:

estimation(optim=('MaxIter',200),datafile=data_spread13_inflcast,mode_compute=1,first_obs=1,nobs=111,smoother,presample=4,lik_init=2,prefilter=0,mh_replic=20000,mh_nblocks=2,mh_jscale=0.25,mh_drop=0.2,forecast=19,nodisplay);

  1. I see… I think what I am doing is more like ‘conditional forecast.’ I am introducing monetary policy shocks whenever interest rate goes below zero over the forecast period. How is ZLB different than this? and will the results under ZLB be very different?
    forecast_simul.m (8.52 KB)
    NGSusmodelffnews_4wp3.mod (14 KB)
  1. The data file is missing (and ideally a mode-file so I don’t need to run the estimation). Please also provide detailed information where in the code your problem occurs and how you diagnose there is a problem.
  2. That approach is common and valid (at least in the context of this literature)
  1. I have attached the data file. I have also attached an updated mod file. I cannot attach the .mat (i.e. mode) file apparently.

Problem: For example, when i compare the inflation forecasts produced by the ‘forecast_simul.m’ file with the dynare forecasts, they are close but not exactly similar. My first question is should they be similar? If yes, what am i doing wrong in the .m file i have written?

  1. Thanks. Can I call this as imposing ZLB in my thesis or will I be technically wrong in saying so?
    forecast_simul.m (9.64 KB)
    NGSusmodelffnews_4wp3.mod (12.2 KB)
    data_spread13_inflcast.m (15.5 KB)
  1. You should be able to upload everything in a zip-file
  2. You should simply describe what you are doing so that people understand your approach.
  1. I have now attached the zip folder containing all the files. If you run the forecast_simul.m file, you’ll get the ‘baseline’ plots which you can then compare with the daynare forecast plots. The differences are small but exist. Inflation plot is one example.

  2. Thanks a lot.
    Forecast.zip (1.53 MB)