[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 (deterministic 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-looking 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 equilibrium. 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.
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 variables, endogenous or exogenous, are not mentioned 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:
stoch_simul
, if the periods
options is specified
forecast
(in this case, note that it is still possible to
modify some of these initial values with histval
)
Options
all_values_required
Issues an error and stops processing the ‘.mod’ file if there is at least
one endogenous or exogenous variable that has not been set in the initval
block.
Example
initval; c = 1.2; k = 12; x = 1; end; steady; |
Description
This block is terminated by end;
, and contains lines of the
form:
VARIABLE_NAME = EXPRESSION; |
The endval
block makes only sense in a deterministic 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, terminal conditions are only necessary for forward
variables). If some variables, endogenous or exogenous, are not mentioned in the
endval
block, the value assumed is that of the last
initval
block or steady
command.
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.
Options
all_values_required
See all_values_required.
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
.
Example
var c k; varexo x; … model; c + k - aa*x*k(-1)^alph - (1-delt)*k(-1); c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam); end; initval; c = 1.2; k = 12; x = 1; end; endval; c = 2; k = 20; x = 1.1; end; simul(periods=200); |
In this example, the problem is finding the optimal path for consumption
and capital for the periods t=1 to T=200, given the path of the exogenous
technology level x
. Setting x=1.1
in the
endval
-block without a shocks
-block implies that technology
jumps to this new level in t=1 and stays there forever. Because the law
of motion for capital is backward-looking, we also need an initial
condition for k
at time 0, specified in the initval
-block.
Similarly, because the Euler equation is forward-looking, we need a
terminal condition for c
at t=201, which is specified in the
endval
-block. Specifying c
in the initval
-block and
k
in the endval
-block has no impact on the results: due to
the optimization problem in the first period being to choose c,k
at t=1 given predetermined capital stock k
inherited from t=0 as
well as the current and future values for technology, the value for
c
at time t=0 plays no role. The same applies to the choice of
c,k
at time t=200, which does not depend on k
at t=201. As
the Euler equation shows, that choice only depends on current capital as
well as future consumption c
and technology x
, but not on
future capital k
. The intuitive reason is that those variables are
the consequence of optimization problems taking place in at periods t=0
and t=201, respectively, which are not considered. Thus, when specifying
those values in the initval
and endval
-blocks, Dynare takes
them as given and basically assumes that there were realizations
of exogenous variables and states (basically initial/terminal conditions
at the unspecified time periods t<0 and t>201) that make those choices
equilibrium values.
This also suggest another way of looking at the use of steady
after initval
and endval
. Instead of saying that the
implicit unspecified conditions before and after the simulation range
have to fit the initial/terminal conditions of the endogenous variables
in those blocks, steady
specifies that those conditions at t<0 and
t>201 are equal to being at the steady state given the exogenous
variables in the initval
and endval
-blocks and sets the
endogenous variables at t=0 and t=201 to the corresponding steady state
equilibrium values.
The fact that c
at t=0 and k
at t=201 specified in
initval
and endval
are taken as given has an important
implication for plotting the simulated vector for the endogenous
variables: this vector will also contain the initial and terminal
conditions and thus is 202 periods long in the example. When you specify
arbitrary values for the initial and terminal conditions for forward- and
backward-looking variables, respectively, these values can be very far
away from the endogenously determined values at t=1 and t=200. While the
values at t=0 and t=201 are unrelated to the dynamics for 0<t<201, they
may result in strange-looking large jumps. In the example above,
consumption will display a large jump from t=0 to t=1 and capital will
jump from t=200 to t=201.
Description
In a deterministic perfect foresight context
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.
Variables not initialized in the histval
block are assumed to
have a value of zero at period 0 and before. Note that this behavior
differs from the case where there is no histval
block, where all
variables are initialized at their steady state value at period 0 and
before (except when a steady
command doesn’t follow an
initval
block).
In a stochastic simulation context
In the context of stochastic simulations, histval
allows setting
the starting point of those simulations in the state space (it does not
affect the starting point for impulse response functions). As for the case of
perfect foresight simulations, all not explicitly specified variables are set to 0.
Moreover, as only states enter the recursive policy functions, all values specified for control variables will be ignored.
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; |
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).
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 command accepts three file formats:
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 Build Daemon user on December 8, 2015 using texi2html 1.82.