Can we seperately use Forecast after Estimation?


As you know we can add Forecast in Estimation function of Dynare:

estimation (datafile=MYdata, nobs=200, first_obs=500, mh_replic=2000, mh_nblocks=2, mh_drop=0.45, mh_jscale=0.8, mode_compute=6,forecast=5)

Is anyway to forecast model after estimation? (In .Mod file or specially in Command Prompt of MATLAB). My estimation process is time consuming and i need check Forecast after it with different time durations without repeating the process.


Try copying everything to a new folder and then use the load_mh_file of the estimation command to load the MCMC draws without running estimation again. This should allow you to use the forecast option of the estimation command without having to set up the full call to dyn_forecast.m

Otherwise, you need to set

and call

where var_list_ is the list of variables to be forecasted. You should be able to find the code for generating this object in the m-file with the same name as the mod-file just before the call to dynare_estimation.m

Thank you for answer. How we can set ptions_.forecast . I’m calling your proposed steps using this code in command prompt of MATLAB:

var_list_=]; % Calling it same as generated m-file options_.forecast=]; dynare_estimation(var_list_,load_mh_file);

Returns this error:

What is my problem? Can you prepare some example codes for my question?


Your problem is that

is an option of the estimation command. See the manual.

so I used this code in mod file:

var_list_=]; % Calling it same as generated m-file options_.forecast=]; estimation(var_list_,load_mh_file);

But returns this error:

Error using dynare (line 174)
DYNARE: preprocessing failed[/quote]

I insert “load_mh_file” as an option of estimation. So what is the problem?

Apparently, you don’t understand the difference between a mod-file and Matlab code. I told you to use

within the estimation command of the mod-file. Combine this with


where nametoyourmodefile is the mode-file generated by your last estimation run. Also add

where x is the number of periods you will forecast. In total, you will have something like

estimation (datafile=MYdata, nobs=200, first_obs=500, mh_replic=0, mh_nblocks=2, mh_drop=0.45, mh_jscale=0.8, mode_compute=0,mode_file=nametoyourmodefile,load_mh_file,forecast=5)
Then run Dynare on this mode-file. This should load the previous draws you had and compute forecasts without reestimating the model. This avoids manipulating the Matlab files, which, given your apparent knowledge of Dynare at this point seems a tall task.

Thank you so much for answer.