Solutions / simulations

General

Periods until return to steady state

Q: How many periods must I specify in simulation so that I generate a smooth path back to steady state? There is a kink at the very end of my impulse response functions - what is going on?

You need to specify enough periods (the exact number depends on your model, you should try different values) such that you are close to steady state at end of your simulations. Dynare imposes a simplifying assumption by impose a return to steady state on the last period of the simulation, whereas instead this happens only asymptotically in theory. You may therefore get a kink in your impulse response functions if you don't specify enough periods for the simulation.

Note that if you specify X periods, get X+2 simulated values, since the first is last value before simulations and last is the terminal condition after simulations. 

[for more information, see post in forum by: marton - Jan 19, 2006]

Deterministic or stochastic models?

Q: Is my model deterministic or stochastic? Should I use the command "simul" or the command "stoch_simul"?

This is a common point of confusion for users.

Deterministic models have the following characteristics:

  • Full information, perfect foresight, no uncertainty around shocks
  • e.g. OLG models without aggregate uncertainty
  • Shocks can hit the economy today, at time t, or at any time in the future, in which case they would be expected with perfect foresight.
  • Most often, there is a positive shock today, and zero shocks thereafter (with certainty).
  • The solution does not require linearization, as the paths of each variable are fully known.
  • This can be useful when the economy is far away from steady state (when linearizations can provide highly distorted results).

Stochastic models, instead, have the following characteristics:

  • Shocks hit today (with a surprise), but thereafter, their expected value is zero.
  • e.g. most RBC models, or new keynesian monetary models
  • Note that when these models are linearized to the first order, the expectation of the shocks being zero translates into the shocks actually being zero, by certainty equivalence. This is an often overlooked point in the literature which misleads readers in supposing their models may be deterministic.
  • Solutions are technically not simulations (although the literature commonly refers to impulse response functions as being “simulated”). They are instead straightforwardly “solutions” to a constrained maximization problem (initiating a system of difference equations).

You sould use "simul" for deterministic models and "stoch_simul" for stochastic models.

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

Your output

Interpreting output: policy & transition function

Q: How should I read the Policy and Transition function table? What does it capture?

Solving the rational exectation model, E_t[f(y_{t+1},y_t,y_{t-1},u_t)]=0 , means finding an unkown function, y_t = g(y_{t-1},u_t)  that could be plugged into the original model and satisfy the implied restrictions (by the first order conditions). A first order approximation of this function can be written:  y_t = ybar + g_y yhat_{t-1} + g_u u_t, with yhat_t = y_t-ybar and ybar is the steadystate value of y, and where g_x is the partial derivative of the g function with respect to variable x. In other words, the function g is a time recursive (approximated) representation of the model that can generate timeseries that will approximatively satisfy the rational expectation hypothesis contained in the original model. In Dynare, the table "Policy and Transition function" contains the elements of g_y and g_u. 

[for more information, see post in forum by: martom - Apr 7, 2006] 

Saving output

Q: How do I save my output for future use?

To save the data after simulations, you can just type: save <datafilename> <list of observed variables> at the end of your .mod file.

[for more information, see post in forum by:  mpko - June 13, 2006]

Finding output

Q: Where is my output stored?

The IRFs produced by dynare are saved in the global oo_ :

  • oo_.PosteriorIRF.Dsge.Mean :: gives you the posterior mean IRFs,
  • oo_.PosteriorIRF.Dsge.Median :: gives you the posterior median IRFs,
  • oo_.PosteriorIRF.Dsge.Std :: gives you the standard deviation of the IRFs posterior distribution,
  • oo_.PosteriorIRF.Dsge.Distribution :: gives you the deciles of the IRFs posterior distribution.

[for more information, see post in forum by: arnedam - Feb 16, 2006, or happyworld, Apr 30, 2006]

Troubleshooting

Eigenvalues & Blanchard-Kahn conditions

Q: I receive errors messages regarding my eigenvalues, or saying that the Blanchard-Kahn conditions are not met. What does this mean?

The Blanchard and Kahn conditions state that in order to have a unique stable trajectory you need to have as many eigenvalues larger than 1 in modulus as you have forward looking variables (variables with leads in Dynare; if leads is on two periods as in y(+2), it counts for 2 forward looking variables).

In addition, a matrix that pops up in the computation of the solution must have full rank.

These conditions can be broken two different ways: with eigenvalues more or less numerous than the forward looking variables. This leads respectively to nonexistence of a stable trajectory or to an infinity of stable trajectories (indeterminacy). Dynare will only proceed with computation if there exists a unique stable trajectory. You can display the eigenvalues with the "check" command added to the line after "steady" (the command to compute the steady state of a model).

[for more information, see post in forum by: bigbigben - Sept 28, 2006, or iacoviel - Mar 7, 2006]

Infinite eigenvalues

Q: After running the "check" command, Dynare tells me my model has infinite eigenvalues. Is this a problem?

Infinite eigenvalues are firmly grounded in the theory of generalized eigenvalues. They have no detrimental influence on the next steps. As far as Blanchard and Kahn conditions are concerned they have to be counted as explosive roots of modulus larger than one.

[for more information, see post in forum by: bigbigben - Oct 5, 2006] 

Cannot find steady state

Q: I get an error message saying that a maximum iterations has been reached and that Dynare cannot find my model's steady state. 

Dynare reaches the maximum number of iterations without completing the computation. The first thing you might try is to place a command: maxit_=20 before the "steady;".

But usually the problem is that Dynare can't find the steady state value for your model. The most frequent reasons are

  1. there is one or several unit roots in your model
  2. there is an error in the equations that you typed
  3. you forgot ot give initval values for one or several variables.

[for more information, see post in forum by: tlb - April 25, 2006, or maria - Sept 28, 2006]

Deterministic model doesn't converge

Q: In trying to run "simul" on a deterministic model with permanent shocks (using "initval" and "endval"), I run into convergence problems.
An example of the error message displayed in this case is:

 err = Infy 
 err_f = order of 10^(-5) 
 matrix near singular or badly scaled

To solve a deterministic problem, Dynare uses a Newton solver which calculates errors at every iteration and these should decrease to converge to steady state. If the errors increase with each iteration of the Newton solver, this is a problem and Dynare will report the maximum error remaining after a certain amount of iterations. It may help to specify more periods to do the transition. 

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

Simulations explode

Q: My model simulations explode, yet my model satisfies the Blanchard-Kahn conditions and seems to be stationary, what could the problem be?

It is frequent for the simulations of a 2nd order accurate solution to explode, because the shocks are too big for the radius of convergency of the second order approximation. The only real solution is to diminish the shocks.

[for more information, see the post in the forum by: fravenna - July, 5, 2006]