Can we seperately use Forecast after Estimation?

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.

Can we seperately use Forecast after Estimation?

Postby jack2015 » Sat Jul 18, 2015 11:02 am

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.
jack2015
 
Posts: 13
Joined: Fri Jul 17, 2015 2:02 pm

Re: Can we seperately use Forecast after Estimation?

Postby jpfeifer » Sun Jul 19, 2015 12:31 pm

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
------------
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: Can we seperately use Forecast after Estimation?

Postby jack2015 » Sun Jul 19, 2015 2:35 pm

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.
jack2015
 
Posts: 13
Joined: Fri Jul 17, 2015 2:02 pm

Re: Can we seperately use Forecast after Estimation?

Postby jpfeifer » Sun Jul 19, 2015 3:22 pm

Your problem is that
Code: Select all
load_mh_file

is an option of the estimation command. See the manual.
------------
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: Can we seperately use Forecast after Estimation?

Postby jack2015 » Sun Jul 19, 2015 4:13 pm

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?
jack2015
 
Posts: 13
Joined: Fri Jul 17, 2015 2:02 pm

Re: Can we seperately use Forecast after Estimation?

Postby jpfeifer » Sun Jul 19, 2015 5:00 pm

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.
------------
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: Can we seperately use Forecast after Estimation?

Postby jack2015 » Sun Jul 19, 2015 9:33 pm

Thank you so much for answer.
jack2015
 
Posts: 13
Joined: Fri Jul 17, 2015 2:02 pm


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 4 guests

cron