DSGE Forecasting Performance


I’m trying to make a model that tests the forecasting performance of DSGE models.

In order to make it, here’s what I need:

1- I have 55 observations, and I’d like to test a 8 periods forecasting performance;
2- So with the observation interval [1:47] I’d like to predict the next 8 and compare with the truth value;
3- So with the observation interval [1:48] I’d like to predict the next 7 and compare with the truth value;
4- So with the observation interval [1:49] I’d like to predict the next 6 and compare with the truth value;
… and so on till with observation interval [1:54] I’d like to predict the next 1 and compare with the truth value;

How should I write the estimation part? That’s what I did:
estimation(nograph ,datafile = br_data2, prefilter = 1, nobs = [48:55], mh_nblocks = 2, mh_replic = 10000, mh_drop = 0.45, mh_jscale = 0.35, mode_check,
forecast = 8 ) y pi pi_h w s q i d r pi_f d_y pi_w d_z d_y_star pi_star i_star;


Please, anyone?

It looks about right. Note that Dynare always will give you forecasts for the number of periods specified in the forecast command. Just set it to 8 and ignore the additional points. Are you experiencing any problems?
Note also that the results are stored in oo_.RecursiveForecasts

What I found in output stored oo_.RecursiveForecasts is a 8x8 matrix for each variable.
Is this the out sample forecast, for periods [56:63]? What’s this recursive forecast really means, how does it works?
And what means the 8x8 matrix? What means each line?


I’m sorry to bother you, but I need to know it urgently…


The first row is the first observation point, in your case 47. The columns give the forecast horizon. That is, element (1,1) is the one-step ahead forecast at time 47. (1,2) is the two-step ahead forecast, etc.
Element (8,1) is the 1-step ahead forecast error at time 55.

Ok! Thanks :slight_smile:

Sorry, but looking my results it’s not that clear for me.
What subfolder should I look for? Mean, HPDinf or HPDsup?

So, just repeting, that’s what I did:

estimation(nograph ,datafile = br_data2, prefilter = 1, nobs = [48:55], mh_nblocks = 2, mh_replic = 10000, mh_drop = 0.45, mh_jscale = 0.35, mode_check,
forecast = 8 ) y pi pi_h w s q i d r pi_f d_y pi_w d_z d_y_star pi_star i_star;

And the output is a 8x8 matrix for each variable. Can you explain better what each number in this matrix means?

See the manual:

This field can take the following values:
HPDinf: Lower bound of a 90% HPD interval
HPDsup: Upper bound of a 90% HPD interval
Mean: Mean of the posterior distribution[/quote]

If you want to have a point estimate, take the mean, if you want to get highest posterior density intervals (“Bayesian confidence interval”) take the HPD-fields. The ordering of the matrices is as described in my previous post.

Hi everyone!

I was trying to complete in Dynare 4.4.0 the forecast of the output in case of Smets/Wouters (2007) model.
I wrote the command described bellow, as I have a number of 56 observed variables and I want to get the forecast for 4 periods:
estimation(datafile=MATAeuazi2,xls_sheet=MATAeuazi2,xls_range=A1:G56,prefilter=1,nobs=[53:56], mh_replic=20000, mh_nblocks=2, mh_jscale=0.30, presample=0, mode_check, forecast=4,mh_drop=0.5,nodiagnostic) y;

According with the User Guide manual, my undertanding is that I have to run firstly the Metropolis-Hastings algorithm, before running the forecast of the estimated model.
So, I tried to write to following command:
estimation(datafile=MATAeuazi2,xls_sheet=MATAeuazi2,xls_range=A1:G56,prefilter=1,nobs=[53:56],mh_replic=20000,mh_nblocks=2,mh_jscale=0.30,presample=0,mode_compute=6,forecast=4,mh_drop=0.5,nodiagnostic) y;

In both of the cases the error described bellow occurred.

Can you please help me regarding the command that I should write in order to get the correct forecast for the four periods mentioned above?

Thanks a lot!

Description of the error:

Restricting the sample to observations 1 to 53. Using in total 53 observations.
You are trying to estimate a model with a non zero steady state for the observed endogenous
variables using demeaned data!
Error using initial_estimation_checks (line 75)
You should change something in your mod file…
Error in initial_estimation_checks (line 75)
error(‘You should change something in your mod file…’)
Error in dynare_estimation_1 (line 180)
oo_ = initial_estimation_checks(objective_function,xparam1,dataset_,M_,estim_params_,options_,bayestopt_,oo_);
Error in dynare_estimation (line 72)
Error in azi2forec6 (line 496)
Error in dynare (line 162)
evalin(‘base’,fname) ;

This indicates a bigger issue than just with forecasting. It seems your data and the model are inconsistent.


Thanks for the answer.
Right, on the first trial of optimization I have met the error described above*. Then you suggested me that I should try to use mode_compute=6 or 9 (or a combination of both). Afterwards, using this, the output of the model seemed like it was correctly estimated (it turned me the results from posterior estimation, the MCMC acceptance ratio and all the results illustrated in the attached pdf- Output dynare 4.4.0 -Matlab.pdf).

What I actually don’t understand is why the error occurs again, only in forecast function, even though I have used the command mode_compute=6.

Big thanks to all of you!

(minus) the hessian matrix at the “mode” is not positive definite!
=> posterior variance of the estimated parameters are not positive.
You should try to change the initial values of the parameters using
the estimated_params_init block, or use another optimization routine.
Warning: The results below are most likely wrong!

In dynare_estimation_1 at 711
In dynare_estimation at 84
In azi2pol3bob at 495
In dynare at 162
Output dynare 4.4.0 -Matlab.pdf (173 KB)

mode_compute=6 also does not always work directly. That was why I suggested using a combination of different optimizers to assure that the hessian is positive definite (which occurs if you find a mode)

Hi everybody and big thanks, Mr. Professor Johannes P.

Based on your indications and support I have found the steady state of the model Smets&Wouters (2007), for the observed variables that I analyzed.
I have one question related to the steady-state obtained and another regarding the forecast option.

  1. Regarding the variables with trend: consumption, investment, GDP and real wages, the steady-state obtained by writing the command oo_.steady_state, is different than 0, which is probably due to the trend used. Can you please tell me how can I interpret in this case the value of the steady state (for example, in my case, a steady state of 0.312 for dy)?
  2. For the forecast option, I want to get an out-of-sample forecast of the last three periods (53:55) from a sample of 55 observed variables.
    So, I wrote the estimation command in the code, as described above and afterwards I wrote the command oo_.RecursiveForecast.HPDTotalinf.y in Matlab workspace. Then I received the following error message: Reference to non-existent field ‘RecursiveForecast’.

Can you, please, suggest me how to solve it? Have I omitted some parameters from the estimation function referring to the forecast?

Description of the estimation function
estimation(datafile=db, xls_sheet=dbdate, xls_range=A1:G56, first_obs=1, presample=4, lik_init=2, prefilter=0, mh_replic=350000, mh_nblocks=2, mh_jscale=0.30, mode_compute=6,mode_file=doc_mode,mh_drop=0.5,forecast=3);

Thanks a lot for all your support and understanding,

Have a nice evening,

  1. dy is the growth rate of output. A steady state value of 0.312 means that output per quarter grew on average by 0.312 percent (if you data is log differences multiplied by 100).
  2. You just requested an ordinary forecast after the last period. You need to set

to request recursive forecasts for different periods. See the manual.