Page 1 of 1

Parameters within parameters

PostPosted: Tue Sep 20, 2011 10:24 am
by r.mcmanus
Hello,

I have been trying to work something out for a little while and can still not find an answer. It is quite trivial, and that is why I have not asked on the forum before, but at the same time presumably the answer is quite trivial and (hopefully) easily explained; therefore I figured I would finally just ask.

The problem I am having is that when I set up a model which includes parameters that are a function of other calibrated parameters I can only effectively go for one step. For example, I can have:

Code: Select all
parameters alpha beta gamma;
alpha = 1;
beta = 2;
gamma = a/(alpha*beta);
epsilon = 3;


But I cannot have:

Code: Select all
paramets alpha beta gamma delta;
alpha = 1;
beta = 2;
delta = 1lpha*beta;
gamma = 1/delta;
epsilon = 3;


becauce delta is a function of gamma which is itself a function of alpha and beta.

Now, although this annoyed me at first, doing the former rather than the latter is simple enough (although it makes things harder when checking my coding). However, when I start to loop certain parameters the operation does not work if for example I loop alpha, but would work if I loop another parameter that does not then subsequently go into other parameters, epsilon for example.

I figured that the two problems were probably coming from the same route and thought that it would be best to check whether there was a simple enough answer.

Many thanks,
Richard.

Re: Parameters within parameters

PostPosted: Wed Sep 28, 2011 1:16 pm
by SébastienVillemot
r.mcmanus wrote:But I cannot have:

Code: Select all
paramets alpha beta gamma delta;
alpha = 1;
beta = 2;
delta = 1lpha*beta;
gamma = 1/delta;
epsilon = 3;


becauce delta is a function of gamma which is itself a function of alpha and beta.


What do you mean by "I cannot have"? This code should work in Dynare, since the assignation sequence is recursive (note that you wrote "1lpha" while you probably meant "alpha")

Now, although this annoyed me at first, doing the former rather than the latter is simple enough (although it makes things harder when checking my coding). However, when I start to loop certain parameters the operation does not work if for example I loop alpha, but would work if I loop another parameter that does not then subsequently go into other parameters, epsilon for example.


If you change the value of a parameter that enters the expression for another one (alpha for example), then you have to explicitely tell Dynare to update this other parameter by writing again the assignment expression. Dynare does not automatically updates parameters which depends on others.

Best,