Page 1 of 1

Macro processor Error; follow up question on saving results

PostPosted: Wed Nov 06, 2013 1:53 pm
by Philipp
Dear all,

I have a question regarding the macro processor:
I have a nicely running model, now I want to check for gsy in 0:0.1:0.4 and tau in 0:0.15:0.6.
I set up a macro processor to do this but I get the following error:

ERROR in macro-processor: gexoutil.mod:173.16-17: @#for loop not matched by an @#endfor (unexpected end of file)

My Dynare version is 4.1.
Unfortunately I cannot find my mistake...

Further, once this problem is solved, I would like to store the variance of y for each iteration, i.e. 25 times, in a table which should have the following properties: 5x5 with tau on the vertical axis and gsy on the horizontal. How is there a nice and efficient way to do such a thing?

I guess I have to extract the results from oo_.var(1,1), but then how can I assign the correct cell to put it in the new matrix?

Thanks a lot for your advice.

Re: Macro processor Error; follow up question on saving resu

PostPosted: Fri Nov 08, 2013 10:03 am
by HoutanBastani
Remove the semicolons after your endfors.

To store the output of oo_.var in a cell, do the following:

Code: Select all
mycell=cell(5,5);
@#for ii in 1:5
    @# for jj in 1:5
            gsy = gsys(@{ii});
            tau = taus(@{jj});
            stoch_simul(order=1,irf=20) y;
            mycell{@{jj}, @{ii}} = oo_.var(1);
    @# endfor
@#endfor


I tested it with 4.3.3 (you should upgrade).

Re: Macro processor Error; follow up question on saving resu

PostPosted: Fri Nov 08, 2013 10:52 am
by Philipp
Dear Houtan,
Thank you very much, this is great help!!!
I will definitely upgrade the dynare version.
Best, philipp

Re: Macro processor Error; follow up question on saving resu

PostPosted: Sat Nov 30, 2013 11:22 am
by Philipp
Dear Houtan,

maybe you can help me out once more:
The thing is I have 4 different shocks in my model and I would like to stora a table as above for each of the shocks,
but Id prefer to have the code in one .mod file and not use a file for each shock. Do you know of a trick using the
macro processor on how to save the results for each shock? Im not sure how to loop over the shocks creating a mycell for each, and Id appreciate your help very much.

Best,
Philipp