define periods using symbol

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.

define periods using symbol

Postby llie19 » Fri Apr 19, 2013 6:18 pm

this is a stupid question that may have a quick answer. in deterministic simulations, when defining the sequence of shocks, for example you can define a sequence of exogenous parameter changes, path = [1;2;3], and write
periods 1:3;
values (A);

that works fine. what if i want to define the number of periods as a symbol, say span=3, and let periods go from 1 to the span value, while changing span as you will. i tried 1:(span) and 1:('span'), neither seems to work, dynare says it must be an integer. how should i write it? thanks a lot.
llie19
 
Posts: 7
Joined: Fri Mar 15, 2013 10:13 pm

Re: define periods using symbol

Postby jpfeifer » Sun Apr 21, 2013 7:57 am

I think this is not possible yet as the preprocessor does not accept this syntax. Is there a particular reason why you would need such a feature?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: define periods using symbol

Postby llie19 » Mon Apr 22, 2013 3:20 pm

thank you. we want to compare simulation results between quarterly and annual setup. if we let for example TFP (call it A) increase over time from 0.8 to 1, i can make it happen over 20 years or 80 quarters, and define "span" as the number of periods. i would write the code like this:

span = 20(or 80);
pathA = linspace(0.8,1,span)';

shocks;
var A;
periods 1:"span";
values (pathgamma);
end;

is there no way to do it even with matlab commands? thanks.

jpfeifer wrote:I think this is not possible yet as the preprocessor does not accept this syntax. Is there a particular reason why you would need such a feature?
llie19
 
Posts: 7
Joined: Fri Mar 15, 2013 10:13 pm

Re: define periods using symbol

Postby jpfeifer » Mon Apr 22, 2013 8:54 pm

You might be able to do it with the Macro language of the preprocessor. But for your case it seems quicker to do it manually. If you have to do it more often, just add both commands and comment one of them out.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: define periods using symbol

Postby llie19 » Tue Apr 23, 2013 7:05 pm

it's not a big deal i was just wondering if there is something i was missing from the manual. thanks a lot!

jpfeifer wrote:You might be able to do it with the Macro language of the preprocessor. But for your case it seems quicker to do it manually. If you have to do it more often, just add both commands and comment one of them out.
llie19
 
Posts: 7
Joined: Fri Mar 15, 2013 10:13 pm


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 7 guests