Dynare Forecasts

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Dynare Forecasts

Postby ajpirzada » Mon Aug 29, 2016 1:57 pm

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

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.
ajpirzada
 
Posts: 20
Joined: Tue Apr 30, 2013 11:41 am

Re: Dynare Forecasts

Postby jpfeifer » Wed Aug 31, 2016 7:08 am

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Dynare Forecasts

Postby ajpirzada » Wed Aug 31, 2016 12:31 pm

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

Code: Select all
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);


2. 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?
Attachments
forecast_simul.m
generates forecasts using simult_
(8.52 KiB) Downloaded 60 times
NGSusmodelffnews_4wp3.mod
model with SW+BGG
(13.96 KiB) Downloaded 78 times
ajpirzada
 
Posts: 20
Joined: Tue Apr 30, 2013 11:41 am

Re: Dynare Forecasts

Postby jpfeifer » Tue Sep 06, 2016 11:08 pm

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)
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Dynare Forecasts

Postby ajpirzada » Sun Sep 11, 2016 1:35 am

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?


2. Thanks. Can I call this as imposing ZLB in my thesis or will I be technically wrong in saying so?
Attachments
forecast_simul.m
forecasts using simult_
(9.64 KiB) Downloaded 73 times
NGSusmodelffnews_4wp3.mod
mod file
(12.19 KiB) Downloaded 70 times
data_spread13_inflcast.m
data file
(15.53 KiB) Downloaded 75 times
ajpirzada
 
Posts: 20
Joined: Tue Apr 30, 2013 11:41 am

Re: Dynare Forecasts

Postby jpfeifer » Tue Sep 13, 2016 9:33 am

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Dynare Forecasts

Postby ajpirzada » Tue Sep 13, 2016 10:16 pm

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.
Attachments
Forecast.zip
(1.53 MiB) Downloaded 73 times
ajpirzada
 
Posts: 20
Joined: Tue Apr 30, 2013 11:41 am


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 6 guests