DSGE forecasting in dynare

Dear Jpfeifer,

I know that dynare can do out of sample forecasting given a dsge model. However, can dynare do out of sample forecasting about a variable which is not a observable or have measurement error defined in the code? For example, I want to do out of sample forecasting to y, but y is not the observable in the code. Or y includes measurement error defined in the code. If it is possible, can dynare generate the RMSE of forecasting?

Regards,

Of course you can forecast any variable defined in the model, whether observed or not. This works via the Kalman smoother. RMSE is more complicated as the forecasts derived from Bayesian estimation are Bayesian and use HPDIs. Regarding the measurement error, this is tricky, see github.com/DynareTeam/dynare/issues/853

Dear Jpfeifer,

Thanks for your answer.

If I want to calculate the RMSE, I need to compare the forecasted value of the variable with the true value of the variable. Since the variable which I forecast in dynare is not observable, how can I find the “true” value? Is the “true” value refered to the estimated value via Kalman smoother?

I am looking forward to your reply.

Regards,

Depends on your goal. If you just want to evaluate the uncertainty, take the RMSE around the mean forecast from the smoother. If you are talking about actual accuracy, that is not possible, because you do not observe the true value.

Dear Jpfeifer,

Thanks for your reply.

Regarding evaluating the uncertainty, how to take the RMSE around the mean forecast from the smoother? The mean forecast from the smoother is just the forecasted value of the corresponding variable, right? If yes, to take the RMSE, I should compare the forecasted value with the “true” or “estimated” value? How can I get the “true” or “estimated” value?

As for the measurement error, given your reference, bayesian forecasts completely neglect the presence of measurement error. If I want to measure the actual accurary about a variable with measurement error, say, I define in dynare as y1=y+measurement error, when doing forecast, which variable I should use to do forecasting, should I forecast y or y1?

Regards,

For classical forecast, Dynare will store oo_.forecast.HPDinf and oo_.forecast.HPDsup, which are the options_.conf_sig confidence bands. For Bayesian estimation, you will have similar fields. They can be used to judge the accuracy.

Defining measurement error as a structural shock as you suggest allows incorporating the uncertainty introduced by it. Which variable you look at, depends on your goal. If you are interested in the actual underlying economic variable, you should only care about y. This is the actual variable driving the economic mechanisms in your model (say the real wage). In contrast, if you are a professional forecaster making your money by being as close as possible to the actual data release including any measurement error, you should care about y1.

Dear Jpfeifer,

Thanks for your reply.

Regarding the Bayesian estimation, do you mean that I should compare oo_.forecast.HPDinf and oo_.forecast.HPDsup to calculate the RMSE?

As for the measurement error, if I want to compare the forecasted value with the actual underlying variable, how can I get the value of the actual underlying variable (say y in my previous post), given that I don’t observe y rather than y1? Which is the actual underlying value stored in dynare’s result?

Your help is highly appreciated.

Regards,

Yes. If you assume a normal distribution, the HPD interval will allow you to compute the standard error bands around the mean.

In your example, Dynare will provide forecasts for both y and y1, that is the actual observed variable and the underlying unobserved one. Of course there is no way to compare this unobserved variable with a true one as the latter is not known. Again, there is a difference between evaluation the uncertainty around a forecast (which derives from the model) and its accuracy (which is also a function of the data).

How can I get the “out of sample forecast”?
I mean if I used the historical CPI data (100 periods) to estimate the model, I want to forecast CPI in 100-110 periods (in the future). How can I do it?
I am looking forward to your reply.

Regards,

Dear Jpfeifer,

How can I get the “out of sample forecast”?
I mean if I used the historical CPI data (100 periods) to estimate the model, I want to forecast CPI in 100-110 periods (in the future). How can I do it?
I am looking forward to your reply.

Regards,

It can be done using forecast option in estimation command. Some code like this

estimation(datafile = ‘mydata’, forecast = 10,…) CPI ;

You will get forecasts for 101-110 periods

Thanks a lot! That works.
One more question: Why the forecasting values will converge to the steady state after a relative long period? 10 periods is okay, but after 1000 periods, it will converge.
Thanks.

Because your model is covariance stationary, i.e. all series that do not contain a unit root will be mean-reverting.

Thanks a lot. So my model is right (at least for forecasting, it should converge for a correct mode)?

I don’t think you can conclude anything from this.