Forecasting out of sample


I have completed Bayesian estimation based on the entire data sample I have. For this case, I found out how to do k-step ahead forecast.

Now, 4 more quarters of data have been released. I do not want to re-run estimation with these additional data, but would like to forecast using the previously estimated model starting at the end of newly available data. Is this possible to accomplish in DYNARE?

Thank you.

You can run the calib_smoother based on the old parameter values on the new data. See

Thank you.

Could I ask if k-step ahead forecast is available in an array/vector form? _.FilteredVariablesKStepAhead is text with no definition of displayed columns, also not so straightforward to copy individual columns.

Also, what is the difference between filtered_vars and forecast?

What do you mean? oo_.FilteredVariablesKStepAhead is a three dimensional array

MATLAB/Octave variable: oo_.FilteredVariablesKStepAhead

Variable set by the estimation command, if it is used with the filter_step_ahead option. The k-steps are stored along the rows while the columns indicate the respective variables. The third dimension of the array provides the observation for which the forecast has been made. For example, if filter_step_ahead=[1 2 4] and nobs=200, the element (3,5,204) stores the four period ahead filtered value of variable 5 computed at time t=200 for time t=204. The periods at the beginning and end of the sample for which no forecasts can be made, e.g. entries (1,5,1) and (1,5,204) in the example, are set to zero. Note that in case of Bayesian estimation the variables will be ordered in the order of declaration after the estimation command (or in general declaration order if no variables are specified here). In case of running the classical smoother, the variables will always be ordered in general declaration order. If the selected_variables_only option is specified with the classical smoother, non-requested variables will be simply left out in this order.

  1. The forecast is for the end of the sample. The filtered variables provide forecasts at each point within the sample.

Thank you

Hi all,

sorry to reactivate such an old thread but this is exactly what I am trying to do and I am not certain that my approach is correct. I have estimated a simple model on a subset of the data, let’s call it the in-sample period. Now, as if there is new data available, the out-sample period, I want to run recursive 1-3 step ahead forecasts based on the estimated model and the ‘new’ data (no new estimation of the model).
The approach I have been following is to estimated the model and the use these results and calibrate a second mod file where I do run the calib_smoother with the filetered_vars and filter_step_ahead = [1:3] command on the new data. I then get the forecasts from the structure: oo_.FilteredVariablesKStepAhead. Is there a more ‘elegant’ way of doing this or is this even the correct approach?

Thank you already very much for considering my question and I am of course happy to share code if needed.

What is the underlying idea here? I don’t understand what the relevant information sets are.

Sorry for being imprecise. The underlying idea is: I have a data-set covering for instance 1985Q1 until 2018Q1 on which I estimate my model. I can do forecasting on this estimated model, that is clear to me. Now, the agents in the model first get new data for 2018Q2, which they add to their information set but do not re-estimate the model parameters. Their objective is to perform forecasting from this new observation. I.e. add it to the existing data-set they have and forecast from this new point.
Then, they receive the data for 2018Q3, add it to their information set (again no re-estimation) and want to perform forecasts from this new observation. And so forth.
This is what I meant with in-sample (1985Q-2018Q1) and out-sample (2018Q2- ) forecasting.

I hope this is clearer now. I guess from what I have seen that I have to use the calib_smoother command, but as stated before, I am not sure whether this is the correct or most elegant approach.

Yes, the calib_smoother-command is the right way to go. That way, you can fix the parameters and then run the Kalman filter to obtain forecasts, i.e. filtered variables.

1 Like

Thank you very much for the answer. So for me to understand perfectly. If I want to do what I explained above, I first have mod file in which I estimate the parameters. I then use these to calibrate another mod file where, I use

calib_smoother(datafile=estimdata_out, filtered_vars, filter_step_ahead = [1:3]) y_obs pi_obs i_obs;

and the oo_.FilteredVariablesKStepAhead structure gives me the forecasts that I want.
Because when I want to run the calib_smoother command right after estimation I get an error.

Again, thank you so much!

Which error are you getting?


Could i ask a quick follow up question?

Case 1. The parameters are calibrated at the mode, and I can run calib_smoother to get forecats.

Case 2. The parameters are calibrated at the mode, and the mode file is loaded. I run estimation command with no draws and request forecast in the estimation.

Are the results supposed to be the same?

Thanks a lot

Yes, results are supposed to be the same.