Page 1 of 1

Can we seperately use Forecast after Estimation?

PostPosted: Sat Jul 18, 2015 11:02 am
by jack2015
Hi.

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.

Thanks.

Re: Can we seperately use Forecast after Estimation?

PostPosted: Sun Jul 19, 2015 12:31 pm
by jpfeifer
Try copying everything to a new folder and then use the
Code: Select all
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
Code: Select all
options_.forecast

and call
Code: Select all
dyn_forecast(var_list_,'smoother');

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

Re: Can we seperately use Forecast after Estimation?

PostPosted: Sun Jul 19, 2015 2:35 pm
by jack2015
Thank you for answer. How we can set
Code: Select all
ptions_.forecast
. I'm calling your proposed steps using this code in command prompt of MATLAB:

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


Returns this error:

Undefined function or variable 'load_mh_file'.


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

thanks.

Re: Can we seperately use Forecast after Estimation?

PostPosted: Sun Jul 19, 2015 3:22 pm
by jpfeifer
Your problem is that
Code: Select all
load_mh_file

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

Re: Can we seperately use Forecast after Estimation?

PostPosted: Sun Jul 19, 2015 4:13 pm
by jack2015
so I used this code in mod file:

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


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

Re: Can we seperately use Forecast after Estimation?

PostPosted: Sun Jul 19, 2015 5:00 pm
by jpfeifer
Apparently, you don't understand the difference between a mod-file and Matlab code. I told you to use
Code: Select all
load_mh_file

within the estimation command of the mod-file. Combine this with
Code: Select all
mh_replic=0

and
Code: Select all
mode_compute=0,mode_file=nametoyourmodefile

where nametoyourmodefile is the mode-file generated by your last estimation run. Also add
Code: Select all
forecast=x

where x is the number of periods you will forecast. In total, you will have something like
Code: Select all
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.

Re: Can we seperately use Forecast after Estimation?

PostPosted: Sun Jul 19, 2015 9:33 pm
by jack2015
Thank you so much for answer.