Are some MATLAB toolboxes necessary?

Q: Do I need to install some MATLAB toolboxes to run Dynare?

No, no additional toolbox is necessary for running most of Dynare, except maybe for optimal simple rules 'osr' and that could be easily remedied. If you have the 'optimization toolbox', you will have additional options for solving for the steady state (solve_algo option) and for searching for the posterior mode/maximum likelihood (mode_compute option). [for more info, see post on forum by: olivier - July 19, 2006]

Simple syntax

Running a Dynare program

Q: I am having trouble running the examples, how do I instruct MATLAB or Octave to run the example .mod files?

In order to run an example, you must first change the current directory of MATLAB or Octave to the location where you put the MOD files.

For example, if your examples are stored in c:\dynare\examples, then you need to type:

cd c:\dynare\examples
dynare example1

You can also use the Current Directory window at the top of your MATLAB screen.

[for more information, see post in forum by: bigbigben - Aug 31, 2006]

Model, variables & parameters

Linear models

Q: Must my model be linear before inputting in into Dynare?

No, on the contrary, that is one of the strengths of Dynare. Dynare is set up to linearize your model around steady state. If you do have a linear model though, that you may have linearized by hand, you can also enter it in Dynare, but you will have to tell Dynare not to linearize it. That is done by entering the option "linear" when declaring your model block.

For example:

# b = 1/c;
x = a*x(-1)+b*y(+1)+e_x;
y = d*y(-1)+e_y;

Note that as a consequence, the steady state of the variables will be zero, as each variable is in fact in deviation from steady state.

[for more information, see post in forum by: martom - Jan 17, 2006] 

Stationary models

Q: Does my model need to be stationary? If I start out with a non stationary model, what should I do?

Models in Dynare must be stationary, such that you can linearize them around a steady state and return to steady state after a shock. Thus, you must first stationarize your model, then linearize it, either by hand, or by letting Dynare do the work.  You can then reconstruct ex-post the non-stationary simulated variables after running impulse response functions .

For deterministic models, the trick is to use only stationary variables in t+1 (If y_t is I(1), you can always write y_{t+1} as y_t+dy_{t+1}, where dy_t= y_t-y_{t-1}). Of course, you need to know the value of dy_t at the final equilibrium.

Note that in a stationary model, it is expected that variables will eventually go back to steady state after the initial shock. If you expect to see a growing curve for a variable, you are thinking about a growth model. Because growth models are nonstationary, it is easier to work with the stationarized version of such models. Again, if you know the trend, you can always add it after the simulation of the stationary components of the variables.

[for more information, see posts in forum by:  Luis - Jan 16, 06, or SS78 - May 15, 2006, or bernie - July 11, 2006]

Continuous time models

Q: My model is in continuous time, can I use Dynare to solve it?

No, unfortunately not. You will have to use software that is specifically designed to solve differential equations. Dynare is designed to solve systems of difference equations in discrete time. 

Predetermined, non predetermined variables

Q: How do I tell Dynare which of my variables are predetermined (backward looking) and non predetermined (forward looking)?

You actually don't have to specify this in Dynare. Dynare figures this out  by itself. This is in fact one of the advantages of Dynare as the procedure of defining predetermined and non predetermined variables can be difficult, if not ambiguous, in complicated models. 

In Dynare, a forward-looking variable is a variable that appears in the model with a lead. For eg, "c(+1)". When you have a model with a lead p periods ahead, that variable count for p forward-loking variables.  A predetermined variable is a variable that appears with a lag. Note that a variable can be both forward-looking and predetermined. A static variable is a variable that don't appear in the model with a lead or with a lag. Note, this is different from traditional BlanchardKahn.

One word of caution: for stock variables, you must use a 'stock at the end' of the period concept. It is investment during period 't' that sets stock at the end of period 't'. Be careful, there is a lot of papers that are written using 'stock at the beginning of the period' convention. You must then change the timing of the stock variables. For prices, what matters is when the price is decided upon. In some wage negociation models, wages used during a period are set at the period before. You must then write wage in period 't' when they are set and wage in period t-1 in the labor demand equation. Using these conventions, it is easy to determine that predetermined variables are these variables that appears with a lag in the model and jump variables are those that appears with a lead.

Lastly, note that for deterministic simulations in Dynare, you can't use a model without lagged variables.

[for more information, see posts in forum by: martom - Feb 1, 2006, or bigbigben - Sept 28, 2006]

Expectations taken in past

Q: How do I input expectations taken in the past?

For instance, to enter the term E(t-1)y(t), define s(t)=E(t)y(t+1) and then use s(t-1).

[for more information, see posts in forum by: pburriel - July 5, 2006 or bhilberg - July 31, 2006]

Functions of deep parameters

Q: how do I redefine certain parameters to be functions of my deep parameters?

When one has functions of deep parameters, one should write the derived parameters' definition inside the model block, after defining the deep parameters in the parameters block. The functions of deep parameters should be written with a pound sign (#) in front of them, to distinguish them from an equation of the model.

Example 1:

#gammak=((1-alph)/(1+psi))*log((1-alph)/(1-bet*alph)) + log(bet*alph);

Example 2:     

parameters bet;

# sig = 1/bet;
c = sig*c(+1)*mpk;


[for more information, see post in forum by:  jdavis - Aug 1, 2006]