Nobs and first_obs in dynare for rolling window

Hello everyone

I have a quesions related to how specify a rolling window in Dynare
I would run the rolling window as following
my full sample, T = 93 observation form 1993q2 to 2016q2
I specify a window size m = 80 observation
then I have a number of window = T - m -1 = 93 - 80 -1 = 12
Moreover, in each Window I would do a horizontal forecast, h = 4

To do that in dynare, I read manual, then it would specify as following command in estimation block
first_obs = [INTEGER1:INTEGER2],
However, I stil do not know how to specify this in Dynare, since there is no clear example for that in Dynare manual

Can anyone help me in my case?

You need to keep nobs fixed at the window size and specify first_obs as the vector for which you want to do the rolling window:
estimation(...,nobs = 80,first_obs = [1:12],forecast=4)

Dear @jpfeifer

Thank you so much for that

I have a futher question related to rolling window

in my case, I run 12 windows with window size of 80
so that
first window will take 80 obs from the first obs to 80th obs
second window will take 80 obs from the second obs to 81th obs

so the same structure of model but different sample of data
thus, when I estimate the same structure of DSGE model in 12 windows, do I need to repeat the following procedure? since each window has each own data set
step 1: finding to mode
step 2: lauching MH algorithm
step 3: checking convergence
step 4: forecasting

Yes. But given that the data only slightly changes, you can start from the previous mode-file to make step 1 quicker. Step 2 and 4 always need to be conducted for the different data. Step 3 is subtle. Usually, if the number of draws is sufficient for one of the windows it tends to be sufficient for all of them. Thus, I would check convergence for the first window.

Dear prof @jpfeifer

Thank you so much for your answer.
my understading about your answer is that
since I use the step = 1 beween two windows so that the data set between these two windows slightly change. Thus I can use the mode_filde of previous window as a proxy for next window to lauch the MH agorithm.
Futhermore, if the MH of the first window converge with number of draw of 100 000, for example,
then I can fix this number of draw for all rest of window
Thus, checking for the first window convergence is very important, it can help to determine the sufficient number of draws for all windows
Please correct me if I misunderstand your explanation

Yes. But my suggestion was to use the mode-file from the previous window for a new round of mode-finding. You seem to suggest to not run mode-finding again (mode_compute=0)

Dear @jpfeifer

Yes, I suggest to not to run mode_fiding againg by setting mode_compute = 0. It is not reasonable, right?

If not correct, then based on your suggestion

then I use the previous mode-file for a new round of mode-finding in new window, and turn mode_compute=9
I use the command as following

nobs=80, % determining the size of each window
mh_replic=100000, % number of draw for all windows
mh_nblocks = 1, % number of MH chain
mh_drop = 0.45,
mh_jscale = 0.7,
mode_file=nkp_mode, % using the mode-file from previous window for new round of mode-
% finding in new window
diffuse_filter, % to stationanize data
first_obs=[1:16], % number of Window to run
forecast=4 % horizontal forecasting
)y_obs pii_obs;
So this is procedure is suggested by you? is my understanding correct?

I would run mode_compute=9 on the first window with mh_replic=0. Then I would run the mod-file again for the rolling window estimation with mode_compute=4 or 5. The reason is that derivative-based optimizers work more quickly if you have decent starting values. I would not use mode_compute=0, because mode-finding should be quick relative to the additional number of MCMC draws you would need if you start at a suboptimal point.