Writing a function that depends on time


Hello friends
How to write a function that is dependent on time in the DYNARE.
Like x=1+exp(k t)_2exp(h t)
I want friends to help me in this case.



Hi, I do not know why you would need that… But if you do not rely on the perturbation approach (and use a perfect foresight based solution method) you can simply add a state variable named time with corresponding equation:

time = time(-1) + 1;

in the model block. If you set the initial condition of this new variable to zero, you will have exactly what you want.



thanks for the reply
Now I encountered the following error

Residuals of the static equations:

Equation number 14 : -1


Hi, This equation (random walk with drift) does not admit any steady state. That is expected. Do you really need a steady state?



Hi, Stepan
I also know that this equation does not admit any steady state.
But anyway, I encounter this error and can not continue to work.

I want to write the following equation in the DYNARE, but I do not know how.



Hi Esmael,

I do not really understand your equation (the term between square brackets looks like the solution of a linear second order differential equation), but in this case you do not need to declare t as a variable to have this equation in Dynare. Suppose you have a term like e^{\alpha t }, where \alpha is a parameter. Then you have:

e^{\alpha (t+1)} = e^{\alpha t}e^{\alpha}

Hence it is possible to define this term recursively. Let A_t = e^{\alpha t}, you must have A_{t} = e^{\alpha}A_{t-1} , and you would write something like:

A = exp(alpha) * A(-1);

in you model block. The steady state of this equation is well defined (A=0), and this steady state is stable provided \alpha<0.



Thank you very much

Sorry I replied late.
I was traveling.