Page 1 of 1

loop in a mod file

PostPosted: Wed Sep 10, 2008 9:21 am
by Aqua
Dear all,

I want to estimate a bvar, using the bvar a la sims toolkit over a given sample and i want to reestimate it every quarter, as Smets and Wouters do in their aer (2007) paper. As an example in my do file, i try something like :

for i = 1:100
bvar_density(datafile = mydata, first_obs = myfirstobs, bvar_prior*, presample, nobs = 44 + i-1 (for instance))
end

I get an error message since dynare does not expect the "+" and the "-" in the options. Is there any way to solve the problem?

I would greatly appreciate your help.

Aqua!

PostPosted: Mon Sep 15, 2008 1:14 pm
by SébastienVillemot
For only 100 iterations, you can use the new macro-language which was introduced recently in Dynare.

Install Dynare 4.0.0, and replace your code by the following:

@#for i in 1:100
bvar_density(datafile = mydata, first_obs = myfirstobs, ..., presample, nobs = @{44+i-1})
@#end

For more information on the macro-language, have a look at the file "macroprocessor.pdf" distributed in the archive for Dynare 4.0.0, or go to:

http://www.dynare.org/manual/ch04s14.html

Best

SV


NB: * new url

PostPosted: Tue Sep 16, 2008 3:54 pm
by Aqua
Thanks Sebastien for the reply and for this new macroprocessor. But I woul like to add just a little correction : "@#end" does'nt work but "@endfor" does.

I have appreciated your help.

Aqua