[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 4.7 Initial and terminal conditions

For most simulation exercises, it is necessary to provide initial (and possibly terminal) conditions. It is also necessary to provide initial guess values for non-linear solvers. This section describes the statements used for those purposes.

In many contexts (determistic or stochastic), it is necessary to compute the steady state of a non-linear model: `initval` then specifies numerical initial values for the non-linear solver. The command `resid` can be used to compute the equation residuals for the given initial values.

Used in perfect foresight mode, the types of forward-loking models for which Dynare was designed require both initial and terminal conditions. Most often these initial and terminal conditions are static equilibria, but not necessarily.

One typical application is to consider an economy at the equilibrium, trigger a shock in first period, and study the trajectory of return at the initial equilbrium. To do that, one needs `initval` and `shocks` (see section Shocks on exogenous variables.

Another one is to study, how an economy, starting from arbitrary initial conditions converges toward equilibrium. To do that, one needs `initval` and `endval`.

For models with lags on more than one period, the command `histval` permits to specify different historical initial values for periods before the beginning of the simulation.

Block: initval ;

  Description

  The `initval` block serves two purposes: declaring the initial (and possibly terminal) conditions in a simulation exercise, and providing guess values for non-linear solvers.

  This block is terminated by `end;`, and contains lines of the form:

      VARIABLE_NAME = EXPRESSION;

  In a deterministic (i.e. perfect foresight) model

  First, it provides the initial conditions for all the endogenous and exogenous variables at all the periods preceeding the first simulation period (unless some of these initial values are modified by `histval`).

  Second, in the absence of an `endval` block, it sets the terminal conditions for all the periods succeeding the last simulation period.

  Third, in the absence of an `endval` block, it provides initial guess values at all simulation dates for the non-linear solver implemented in `simul`.

  For this last reason, it necessary to provide values for all the endogenous variables in an `initval` block (even though, theoretically, initial conditions are only necessary for lagged variables). If some exogenous variables are not mentionned in the `initval` block, a zero value is assumed.

  Note that if the `initval` block is immediately followed by a `steady` command, its semantics is changed. The `steady` command will compute the steady state of the model for all the endogenous variables, assuming that exogenous variables are kept constant to the value declared in the `initval` block, and using the values declared for the endogenous as initial guess values for the non-linear solver. An `initval` block followed by `steady` is formally equivalent to an `initval` block with the same values for the exogenous, and with the associated steady state values for the endogenous.

  In a stochastic model

  The main purpose of `initval` is to provide initial guess values for the non-linear solver in the steady state computation. Note that if the `initval` block is not followed by `steady`, the steady state computation will still be triggered by subsequent commands (`stoch_simul`, `estimation`…).

  It is not necessary to declare `0` as initial value for exogenous stochastic variables, since it is the only possible value.

  This steady state will be used as the initial condition at all the periods preceeding the first simulation period for the two possible types of simulations in stochastic mode:

  - in `stoch_simul`, if the `periods` options is specified
  - in `forecast` (in this case, note that it is still possible to modify some of these initial values with `histval`)

  Example

      initval;
      c = 1.2;
      k = 12;
      x = 1;
      end;

      steady;

Block: endval ;

  Description

  This block is terminated by `end;`, and contains lines of the form:

      VARIABLE_NAME = EXPRESSION;

  The `endval` block makes only sense in a determistic model, and serves two purposes.

  First, it sets the terminal conditions for all the periods succeeding the last simulation period.

  Second, it provides initial guess values at all the simulation dates for the non-linear solver implemented in `simul`.

  For this last reason, it necessary to provide values for all the endogenous variables in an `endval` block (even though, theoretically, initial conditions are only necessary for forward variables). If some exogenous variables are not mentionned in the `endval` block, a zero value is assumed.

  Note that if the `endval` block is immediately followed by a `steady` command, its semantics is changed. The `steady` command will compute the steady state of the model for all the endogenous variables, assuming that exogenous variables are kept constant to the value declared in the `endval` block, and using the values declared for the endogenous as initial guess values for the non-linear solver. An `endval` block followed by `steady` is formally equivalent to an `endval` block with the same values for the exogenous, and with the associated steady state values for the endogenous.

  Example

      var c k;
      varexo x;
      …
      initval;
      c = 1.2;
      k = 12;
      x = 1;
      end;

      steady;

      endval;
      c = 2;
      k = 20;
      x = 2;
      end;

      steady;

  The initial equilibrium is computed by `steady` for `x=1`, and the terminal one, for `x=2`.

Block: histval ;

  Description

  In models with lags on more than one period, the `histval` block permits to specify different historical initial values for different periods.

  This block is terminated by `end;`, and contains lines of the form:

      VARIABLE_NAME(INTEGER) = EXPRESSION;

  EXPRESSION is any valid expression returning a numerical value and can contain already initialized variable names.

  By convention in Dynare, period 1 is the first period of the simulation. Going backward in time, the first period before the start of the simulation is period `0`, then period `-1`, and so on.

  If your lagged variables are linked by identities, be careful to satisfy these identities when you set historical initial values.

  Example

      var x y;
      varexo e;

      model;
      x = y(-1)^alpha*y(-2)^(1-alpha)+e;
      …
      end;

      initval;
      x = 1;
      y = 1;
      e = 0.5;
      end;

      steady;

      histval;
      y(0) = 1.1;
      y(-1) = 0.9;
      end;

Command: resid ;

  This command will display the residuals of the static equations of the model, using the values given for the endogenous in the last `initval` or `endval` block (or the steady state file if you provided one, see section Steady state).

Command: initval_file (filename = FILENAME);

  Description

  In a deterministic setup, this command is used to specify a path for all endogenous and exogenous variables. The length of these paths must be equal to the number of simulation periods, plus the number of leads and the number of lags of the model (for example, with 50 simulation periods, in a model with 2 lags and 1 lead, the paths must have a length of 53). Note that these paths cover two different things:

  - the constraints of the problem, which are given by the path for exogenous and the initial and terminal values for endogenous
  - the initial guess for the non-linear solver, which is given by the path for endogenous variables for the simulation periods (excluding initial and terminal conditions)

  The command accepts three file formats:

  - M-file (extension ‘`.m`’): for each endogenous and exogenous variable, the file must contain a row vector of the same name.
  - MAT-file (extension ‘`.mat`’): same as for M-files.
  - Excel file (extension ‘`.xls`’): for each endogenous and exogenous, the file must contain a column of the same name (not supported under Octave).

  Warning

  The extension must be omitted in the command argument. Dynare will automatically figure out the extension and select the appropriate file type.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ]

This document was generated by SÃ©bastien Villemot on May 24, 2011 using texi2html 1.82.