Macro processor Error; follow up question on saving results

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Macro processor Error; follow up question on saving results

Postby Philipp » Wed Nov 06, 2013 1:53 pm

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.
Last edited by Philipp on Mon Nov 11, 2013 2:26 pm, edited 1 time in total.
Philipp
 
Posts: 36
Joined: Mon Apr 18, 2011 9:01 pm
Location: State Secretariate for Economic Affairs

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

Postby HoutanBastani » Fri Nov 08, 2013 10:03 am

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).
Best,
Houtan
HoutanBastani
 
Posts: 197
Joined: Fri Jan 22, 2010 4:11 pm
Location: Paris, France

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

Postby Philipp » Fri Nov 08, 2013 10:52 am

Dear Houtan,
Thank you very much, this is great help!!!
I will definitely upgrade the dynare version.
Best, philipp
Philipp
 
Posts: 36
Joined: Mon Apr 18, 2011 9:01 pm
Location: State Secretariate for Economic Affairs

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

Postby Philipp » Sat Nov 30, 2013 11:22 am

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
Philipp
 
Posts: 36
Joined: Mon Apr 18, 2011 9:01 pm
Location: State Secretariate for Economic Affairs


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 5 guests