Forecasting in Dynare

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.

Re: Forecasting in Dynare

Postby jpfeifer » Thu Apr 02, 2015 7:11 pm

Getting rid of the posterior IRFs should already solve your issue. Also, if the problem always occurs with the same figure, the reason is that your path is too long. In that case, use a shorter name for the mod-file and fewer subfolders.

Also, to speed up computations, provide a mode-file.
------------
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: Forecasting in Dynare

Postby Grant » Fri Apr 03, 2015 8:32 am

Thanks Jpfeifer.

What do you mean by using a shorter name for the mod-file and fewer subfolders? Do you mean that I should use less letters to name the mod-file? As you see my mod-file is called "code" which only contains 4 letters?

As for providing a mode-file, do you mean that I just use the estimation mode as the mode file to run forecasting? Say, I use "mode_compute=0" and "mode_file=the mode file name".

I look forward to your reply.

Regards,
Grant
 
Posts: 95
Joined: Tue Jun 10, 2014 2:37 pm

Re: Forecasting in Dynare

Postby jpfeifer » Fri Apr 03, 2015 8:48 am

I said that sometimes there is a systematical problem if the path where the figure is saved is too long. But in your case, that seems unlikely (unless the mod-file is located very deep in the file tree within lots of subfolders)

I was suggesting to speed up computations by using the mode as the starting value for the next iteration. That is use the same mode_compute but also use "mode_file=the mode file name".
------------
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: Forecasting in Dynare

Postby Grant » Fri Apr 03, 2015 10:45 am

Dear Jpfeifer,

Thanks for your helpful advice.

I haven't put the mod-file very deep in the file tree. And I also follow your suggestion and get rid of the command "bayesian_irf" which is used to compute the posterior irf. However, the problem still exists. Dynare still shows that
"posterior_moments: There are not enough draws computes to compute HPD Intervals. Skipping their computation.
posterior_moments: There are not enough draws computes to compute deciles. Skipping their computation."

Could you help me fix this problem? I don't know which part of my code should be attributed to this problem.

Regards,
Grant
 
Posts: 95
Joined: Tue Jun 10, 2014 2:37 pm

Re: Forecasting in Dynare

Postby jpfeifer » Fri Apr 03, 2015 12:15 pm

You did not provide the code for this problem. My guess is that your mh_replic is not sufficient.
------------
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: Forecasting in Dynare

Postby Grant » Fri Apr 03, 2015 12:21 pm

Thanks Jpfeifer.

Actually, I have set mh_replic=200,000. Is it not still sufficient?

Here attached the code and data file.

Regards,
Attachments
data100.xls
(21.83 KiB) Downloaded 164 times
code.mod
(9.11 KiB) Downloaded 66 times
Grant
 
Posts: 95
Joined: Tue Jun 10, 2014 2:37 pm

Re: Forecasting in Dynare

Postby jpfeifer » Fri Apr 03, 2015 1:12 pm

With the unstable version, I cannot replicate the issue you report. Could you please try the most recent snapshot.
------------
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: Forecasting in Dynare

Postby Grant » Sun Apr 05, 2015 2:35 pm

Dear Jpferfer,

Thanks for your help. With the latest unstable version of dynare, this problem has been fixed.

However, after a long time of running code to do forecasting, dynare shows the error mesage when it seems that the forecasting is going to finish:

Estimation::mcmc: Forecasted variables (mean)
Estimation::mcmc: Forecasted variables (mean), done!
Estimation::mcmc: Forecasted variables (point)
Estimation::mcmc: Forecasted variables (point), done!
Error using error
The message must be specified as either a string or a message structure.

Error in read_variables (line 104)
error([strtrim(var_names_01(dyn_i_01,:)) ' not found in ' fullname])

Error in dynare_estimation (line 100)
rawdata =
read_variables(options_.datafile,options_.varobs,[],options_.xls_sheet,options_.xls_range);

Error in code (line 523)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 199)
evalin('base',fname) ;

I set in the estimation block as
Code: Select all
estimation(datafile=data100, mode_compute =4, mh_jscale=0.3,mh_nblocks = 1, mh_replic=200000, nobs=[87:116],forecast=8)y n p_dc pi_c_h r c ;
.

Is it related to my data file or anything else? I don't know which part of my code should be attribute to this problem. Could you help me? You advice is highly appreciated.

Regards,
Grant
 
Posts: 95
Joined: Tue Jun 10, 2014 2:37 pm

Re: Forecasting in Dynare

Postby jpfeifer » Mon Apr 06, 2015 8:40 pm

The attached file runs without problems on my machine. Did you change anything compared to what you posted?
------------
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: Forecasting in Dynare

Postby selima » Tue Apr 07, 2015 1:50 pm

Dear Jp feifer
in fact I have the same problem but I don' know if it is a bug or another problem?
In fact I have dynare 4.4.3 version.
Could you please guide me about the problem?
Is it a problem on the data which does not match the model ?
I always thank you
Attachments
article4Tun.mod
(5.96 KiB) Downloaded 56 times
selima
 
Posts: 46
Joined: Thu Jan 10, 2013 5:13 pm

Re: Forecasting in Dynare

Postby selima » Tue Apr 07, 2015 1:51 pm

and this is the data
Attachments
data2.m
(13.59 KiB) Downloaded 54 times
selima
 
Posts: 46
Joined: Thu Jan 10, 2013 5:13 pm

Re: Forecasting in Dynare

Postby Grant » Thu Apr 09, 2015 3:58 am

Dear Jpfeifer,

With the latest unstable version of dynare, I still got the above problem when doing out of sample forecasting. Here attached the code and data file again. Hope you help me fix it out.

Thanks in advance.

Regards,
Attachments
code.mod
(9.04 KiB) Downloaded 62 times
data100.xls
(21.83 KiB) Downloaded 238 times
Grant
 
Posts: 95
Joined: Tue Jun 10, 2014 2:37 pm

Re: Forecasting in Dynare

Postby jpfeifer » Thu Apr 09, 2015 7:23 pm

Please be more precise. Which of the two problems do you encounter. The one where the data loading does not work of the one with the draws. If the latter, try deleting the files from previous runs (including subfolders) before running the program again. Please report back if this helps.
------------
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: Forecasting in Dynare

Postby Grant » Fri Apr 10, 2015 8:09 am

Dear Jpfeifer,

Sorry for the misunderstanding. My problem is: with the latest unstable version of dynare, after a long time of running code to do forecasting, dynare shows the error mesage when it seems that the forecasting is going to finish:

Estimation::mcmc: Forecasted variables (mean)
Estimation::mcmc: Forecasted variables (mean), done!
Estimation::mcmc: Forecasted variables (point)
Estimation::mcmc: Forecasted variables (point), done!
Error using error
The message must be specified as either a string or a message structure.

Error in read_variables (line 104)
error([strtrim(var_names_01(dyn_i_01,:)) ' not found in ' fullname])

Error in dynare_estimation (line 100)
rawdata =
read_variables(options_.datafile,options_.varobs,[],options_.xls_sheet,options_.xls_range);

Error in code (line 523)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 199)
evalin('base',fname) ;

I have also tries to run my code in a new file but still got the problem. I am looking forward to your reply.

Regards,
Grant
 
Posts: 95
Joined: Tue Jun 10, 2014 2:37 pm

Re: Forecasting in Dynare

Postby jpfeifer » Fri Apr 10, 2015 12:39 pm

Please provide the log-file. I need to know for which observation this happens. You can see this in the output like
Code: Select all
Estimation::mcmc: Details about the MCMC are available in code_106/metropolis\code_mh_history_0.mat
#
The 106 says the last run was for nobs=106.
------------
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

PreviousNext

Return to Dynare help

Who is online

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