# Understanding forecast methodology in Dynare

Dear all,
I am very new to Dynare and I would like to do an out-of-sample forecast with the help of the program. I estimated a small DSGE with Bayesian techniques. Afterwards, I would like to insert the estimated values into the state space and make a simple prediction by iterating the state space for the specific time horizon. Unfortunately, the manual was unable to solve my lack of theoretical knowledge.

I do not quite understand how the forecasts are done in Dynare, i.e. what kind of formulas are used to compute the mean and point forecasts. Furthermore, what is the exact difference between those two methods? As far as I know, incorporates the point forecast the uncertainty of the shocks, but how exactly is this derived theoretically? Lastly, for the prediction I would not like to sample from the predictive distribution but just insert the posterior mean of the estimation and then iterating the state space. Is there a simple way to do this?

Thank you very much for your help and answer.

Kind regards,

Hi,

After a Bayesian estimation we do not use any formula to compute the forecasts, but rely on Monte Carlo simulations. In both cases, the initial condition of the forecast is provided by the Kalman smoother. In the case of the Point forecast we draw vectors of parameters in the posterior distribution. For each vector we compute the the initial condition (with the smoother) and from that point simulate the model adding Gaussian innovations for the exogenous variables during the forecasted periods. We obtain a posterior empirical distribution of the forecasts, and we can then compute various posterior moments (mean, deciles, â€¦). The Mean forecast follows the same approach except that future innovations are set to zero (ie we do not draw future innovations in a normal distribution). The posterior distributions of the Mean forecast do not account for the uncertainty coming from the shocks.

Best,

1 Like

Thank you very much for your quick and informative answer. I believe to have understood now the basics of this forecast method. However, I cannot relate it exactly to the prediction produced by the simple state-space iteration (i.e. the iteration of the measurement and transition equation to generate the forecast). How do they differ in the results and is there a way to implement the latter forecast procedure in Dynare?

Thank you again for your help.
Best regards,

Dynare does exactly that, but the issue is uncertainty about parameters. For every given parameter vector, Dynare will iterate on the state space solution model. But in Bayesian estimation, there is uncertainty about parameters. So Dynare draws parameters from the posterior distribution and iterates on the state space (with or without shocks depending on the object your are looking at) for every draw. Finally, the mean is taken over the draws. This is different than frequentist econometrics where you would take the mean parameter vector and then iterate on the state space for the single mean parameter vector.

In the classical approach you would also iterate on the state space equation to recover the forecast uncertainty related to the future innovations (iterating on the covariance matrix of the innovations). The relative advantage of the Bayesian approach is that it is far easier to take into account the uncertainty related to the inference (ie the posterior distribution of the parameters) especially if the model is non linear with respect to the parameters (in the linear case I guess it is possible to derive classical confidence bands relying on asymptotic approximations, but I am not aware of such results in the non linear case and I suppose that a classical approach would also rely on Monte Carlo).

Best,

Dear jpfeifer and StĂ©pahne,
Thank you very much for your answers. It finally helps to understand the dynamics of the forecasts. Lastly, is there a possible way in Dynare to do the forecast by taking the mean parameter vector and then iterating on the state space for the single mean parameter vector?
Best regards,

You can use the `forecast` command, described here.

Best,

Thank you very much for your answer. I tried your suggestion and inserted the forecast command. I intended to plug the posterior means of an estimation in to the calibrated values and generate the forecast lastly. However, the forecast returns with zeros. Is it because the forecast expects the variables to be in the steady state in the future, even though they experienced shocks?

Thank you again for your kind and generous help. I attached the mod file below.
Best regards,

DSGE.mod (1.1 KB)

Hi, Since you do not provide an initial condition (with `histval` or `initval`) the endogenous variables are initialized at the steady state (zero in your model) and in the future these variables are supposed to converge to the steady state. Also, because the your model is linear the shocks are averaging out. So there is no reason to move, and it is not surprising if you observe a flat zero line for your forecasts.

Best,

Instead of the `forecast` command, you should use `calib_smoother`-command after estimation.

Dear StĂ©phane and jpfeifer,
Thank you very much for your answers. StĂ©phane, using the histval command on the state variables produced a well-functioning forecast.
Jpfeifer, what is the reason for using the calib_smoother-command rather than the forecast command?

Thank you again very much.
Best regards,

You can call it after `estimation` with the respective parameter set and it will automatically use the end of sample smoothed states as the initial condition for forecasting.

Dear jpfeifer,
Thank you very much for your answer. I will try it out as soon as I can.
Best regards,