Page 1 of 1

define periods using symbol

PostPosted: Fri Apr 19, 2013 6:18 pm
by llie19
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.

Re: define periods using symbol

PostPosted: Sun Apr 21, 2013 7:57 am
by jpfeifer
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?

Re: define periods using symbol

PostPosted: Mon Apr 22, 2013 3:20 pm
by llie19
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?

Re: define periods using symbol

PostPosted: Mon Apr 22, 2013 8:54 pm
by jpfeifer
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.

Re: define periods using symbol

PostPosted: Tue Apr 23, 2013 7:05 pm
by llie19
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.