Writing a loop within the .mod file

Hello all,

I am afraid this may be a trivial question, but I am nonetheless curious; one of the options in the “estimation” function is the starting value for the data set one is using in order to estimate the model. Another option is the length of the “window” of data. So, for example, if one has a data set of 500 observations and uses a starting value of 25 and a length of 100, only the observations #25 through 125 will be used.

I am wondering if anyone has ever written a loop within the matlab environment or even within the .mod file in order to run a routine where the “window” stays the same size, but the beginning value is incrementally increased so that a “rolling window” type of estimation is performed and after each iteration, the posterior means of specified parameters to be estimated are stored in a vector of sorts?

Has anyone ever done anything remotely similar to this, and if so, do you mind posting your code?

You would need to call estimation
once and then in the mod-file start looping. Code would work along the lines of

verbatim; for obs_iter=1:10 options_.first_obs = 10+obs_iter; options_.nobs = 192; dname=[M_.fname,'_',num2str(obs_iter)]; oo_recursive_=dynare_estimation(var_list_,dname); end end;
I tried this code with the unstable version of Dynare and the fs2000.mod. It increases the first observation used, starting from observation 11 and saves the results in a separate folder with the constructed

However, for the latter to work, one needs to fix github.com/DynareTeam/dynare/pull/1399