DSGE Forecasting Performance

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.

DSGE Forecasting Performance

Postby irisqueiroz » Sun Feb 24, 2013 3:16 pm

Hi,

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;

Thanks.
irisqueiroz
 
Posts: 15
Joined: Mon Jan 21, 2013 2:39 pm

Re: DSGE Forecasting Performance

Postby irisqueiroz » Mon Feb 25, 2013 5:56 pm

Please, anyone?
irisqueiroz
 
Posts: 15
Joined: Mon Jan 21, 2013 2:39 pm

Re: DSGE Forecasting Performance

Postby jpfeifer » Mon Feb 25, 2013 7:11 pm

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
------------
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: DSGE Forecasting Performance

Postby irisqueiroz » Mon Feb 25, 2013 9:32 pm

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?


Thanks.
irisqueiroz
 
Posts: 15
Joined: Mon Jan 21, 2013 2:39 pm

Re: DSGE Forecasting Performance

Postby irisqueiroz » Wed Feb 27, 2013 1:34 am

I'm sorry to bother you, but I need to know it urgently...

Thanks!
irisqueiroz
 
Posts: 15
Joined: Mon Jan 21, 2013 2:39 pm

Re: DSGE Forecasting Performance

Postby jpfeifer » Fri Mar 01, 2013 12:40 am

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.
------------
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: DSGE Forecasting Performance

Postby irisqueiroz » Mon Mar 04, 2013 2:14 pm

Ok! Thanks :)
irisqueiroz
 
Posts: 15
Joined: Mon Jan 21, 2013 2:39 pm

Re: DSGE Forecasting Performance

Postby irisqueiroz » Tue Mar 05, 2013 3:43 am

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?
irisqueiroz
 
Posts: 15
Joined: Mon Jan 21, 2013 2:39 pm

Re: DSGE Forecasting Performance

Postby jpfeifer » Tue Mar 05, 2013 1:55 pm

See the manual:

MOMENT NAME
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


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.
------------
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: DSGE Forecasting Performance

Postby georgiana_alina » Mon May 05, 2014 7:15 pm

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)
dynare_estimation_1(var_list,M_.dname);
Error in azi2forec6 (line 496)
dynare_estimation(var_list_);
Error in dynare (line 162)
evalin('base',fname) ;
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: DSGE Forecasting Performance

Postby jpfeifer » Wed May 07, 2014 9:46 am

This indicates a bigger issue than just with forecasting. It seems your data and the model are inconsistent.
------------
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: DSGE Forecasting Performance

Postby georgiana_alina » Thu May 08, 2014 9:20 pm

Hi,

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!


*POSTERIOR KERNEL OPTIMIZATION PROBLEM!
(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
Attachments
Output dynare 4.4.0 -Matlab.pdf
(172.85 KiB) Downloaded 174 times
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: DSGE Forecasting Performance

Postby jpfeifer » Fri May 09, 2014 7:31 am

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)
------------
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: DSGE Forecasting Performance

Postby georgiana_alina » Wed May 21, 2014 8:27 pm

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,
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: DSGE Forecasting Performance

Postby jpfeifer » Fri May 23, 2014 4:12 am

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
Code: Select all
nobs = [53:55]

to request recursive forecasts for different periods. 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


Return to Dynare help

Who is online

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