[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In a stochastic context, Dynare computes one or several simulations corresponding to a random draw of the shocks.
The main algorithm for solving stochastic models relies on a Taylor
approximation, up to third order, of the expectation functions (see
Judd (1996), Collard and Juillard (2001a), Collard
and Juillard (2001b), and Schmitt-Grohé and Uríbe (2004)). The
details of the Dynare implementation of the first order solution are
given in Villemot (2011). Such a solution is computed using
the stoch_simul
command.
As an alternative, it is possible to compute a simulation to a
stochastic model using the extended path method presented by
Fair and Taylor (1983). This method is especially useful when
there are strong nonlinearities or binding constraints. Such a
solution is computed using the extended_path
command.
4.13.1 Computing the stochastic solution | ||
4.13.2 Typology and ordering of variables | ||
4.13.3 First order approximation | ||
4.13.4 Second order approximation | ||
4.13.5 Third order approximation |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Description
stoch_simul
solves a stochastic (i.e. rational
expectations) model, using perturbation techniques.
More precisely, stoch_simul
computes a Taylor approximation of
the decision and transition functions for the model. Using this, it
computes impulse response functions and various descriptive statistics
(moments, variance decomposition, correlation and autocorrelation
coefficients). For correlated shocks, the variance decomposition is
computed as in the VAR literature through a Cholesky decomposition of
the covariance matrix of the exogenous variables. When the shocks are
correlated, the variance decomposition depends upon the order of the
variables in the varexo
command.
The Taylor approximation is computed around the steady state (see section Steady state).
The IRFs are computed as the difference between the trajectory of a variable following a shock at the beginning of period 1 and its steady state value. More details on the computation of IRFs can be found on the DynareWiki.
Variance decomposition, correlation, autocorrelation are only
displayed for variables with positive variance. Impulse response
functions are only plotted for variables with response larger than
.
Variance decomposition is computed relative to the sum of the contribution of each shock. Normally, this is of course equal to aggregate variance, but if a model generates very large variances, it may happen that, due to numerical error, the two differ by a significant amount. Dynare issues a warning if the maximum relative difference between the sum of the contribution of each shock and aggregate variance is larger than 0.01%.
Currently, the IRFs are only plotted for 12 variables. Select the ones you want to see, if your model contains more than 12 endogenous variables.
The covariance matrix of the shocks is specified with the
shocks
command (see section Shocks on exogenous variables).
When a list of VARIABLE_NAME is specified, results are displayed only for these variables.
The stoch_simul
command with a first order approximation can benefit from the block decomposition of the model (see block).
Options
ar = INTEGER
Order of autocorrelation coefficients to compute and to print. Default: 5
.
drop = INTEGER
Number of points dropped at the beginning of simulation before
computing the summary statistics. Default: 100
.
hp_filter = DOUBLE
Uses HP filter with = DOUBLE before computing
moments. Default: no filter.
hp_ngrid = INTEGER
Number of points in the grid for the discrete Inverse Fast Fourier
Transform used in the HP filter computation. It may be necessary to
increase it for highly autocorrelated processes. Default: 512
.
irf = INTEGER
Number of periods on which to compute the IRFs. Setting irf=0
,
suppresses the plotting of IRF’s. Default: 40
.
irf_shocks = ( VARIABLE_NAME [[,] VARIABLE_NAME …] )
The exogenous variables for which to compute IRFs. Default: all.
relative_irf
Requests the computation of normalized IRFs in percentage of the standard error of each shock.
nocorr
Don’t print the correlation matrix (printing them is the default).
nofunctions
Don’t print the coefficients of the approximated solution (printing them is the default).
nomoments
Don’t print moments of the endogenous variables (printing them is the default).
nograph
Do not create graphs (which implies that they are not
saved to the disk nor displayed). If this option is not used, graphs
will be saved to disk (to the format specified by graph_format
option) and displayed to screen (unless nodisplay
option is
used).
nodisplay
Do not display the graphs, but still save them to disk
(unless nograph
is used).
graph_format = FORMAT
graph_format = ( FORMAT, FORMAT… )
Specify the file format(s) for graphs saved to disk. Possible values are
eps
(the default), pdf
and fig
(under Octave,
only eps
is available).
noprint
Don’t print anything. Useful for loops.
print
Print results (opposite of noprint
).
order = INTEGER
Order of Taylor approximation. Acceptable values are 1
,
2
and 3
. Note that for third order,
k_order_solver
option is implied and only empirical moments are
available (you must provide a value for periods
option). A value of 2
or more is incompatible with block
and bytecode
options of the model
block. Default:
2
(except after an estimation
command,
in which case the default is the value used for the estimation).
k_order_solver
Use a k-order solver (implemented in C++) instead of the default
Dynare solver. This option is not yet compatible with the
bytecode
option (see section Model declaration. Default: disabled
for order 1 and 2, enabled otherwise
periods = INTEGER
If different from zero, empirical moments will be computed instead of
theoretical moments. The value of the option specifies the number of
periods to use in the simulations. Values of the initval
block,
possibly recomputed by steady
, will be used as starting point
for the simulation. The simulated endogenous variables are made
available to the user in a vector for each variable and in the global
matrix oo_.endo_simul
(see oo_.endo_simul). The simulated
exogenous variables are made available in oo_.exo_simul
(see oo_.exo_simul). Default: 0
.
qz_criterium = DOUBLE
Value used to split stable from unstable eigenvalues in reordering the
Generalized Schur decomposition used for solving 1^st order
problems. Default: 1.000001
(except when estimating with
lik_init
option equal to 1
: the default is
0.999999
in that case; see section Estimation).
replic = INTEGER
Number of simulated series used to compute the IRFs. Default: 1
if order
=1
, and 50
otherwise.
simul_replic = INTEGER
Number of series to simulate when empirical moments are requested
(i.e. periods
> 0). Note that if this option is greater
than 1
, the additional series will not be used for computing
the empirical moments but will simply be saved in binary form to the
file ‘FILENAME_simul’. Default: 1
.
solve_algo = INTEGER
See solve_algo, for the possible values and their meaning.
aim_solver
Use the Anderson-Moore Algorithm (AIM) to compute the decision rules, instead of using Dynare’s default method based on a generalized Schur decomposition. This option is only valid for first order approximation. See AIM website for more details on the algorithm.
conditional_variance_decomposition = INTEGER
conditional_variance_decomposition = [INTEGER1:INTEGER2]
See below.
conditional_variance_decomposition = [INTEGER1 INTEGER2 …]
Computes a conditional variance decomposition for the specified
period(s). The periods must be strictly positive. Conditional variances are given by
. For period 1, the conditional variance
decomposition provides the decomposition of the effects of shocks upon
impact. The results are stored in
oo_.conditional_variance_decomposition
(see oo_.conditional_variance_decomposition).
pruning
Discard higher order terms when iteratively computing simulations of the solution, as in Kim, Kim, Schaumburg and Sims (2008).
partial_information
Computes the solution of the model under partial information, along
the lines of Pearlman, Currie and Levine (1986). Agents are
supposed to observe only some variables of the economy. The set of
observed variables is declared using the varobs
command. Note
that if varobs
is not present or contains all endogenous
variables, then this is the full information case and this option has
no effect. More references can be found at
http://www.dynare.org/DynareWiki/PartialInformation.
sylvester = OPTION
Determines the algorithm used to solve the Sylvester equation for block decomposed model. Possible values for OPTION
are:
default
Uses the default solver for Sylvester equations (gensylv
) based
on Ondra Kamenik algorithm (see
the Dynare Website for more information).
fixed_point
Uses a fixed point algorithm to solve the Sylvester equation (gensylv_fp
). This method is faster than the default
one for large scale models.
Default value is default
sylvester_fixed_point_tol = DOUBLE
It is the convergence criterion used in the fixed point sylvester solver. Its default value is 1e-12.
Output
This command sets oo_.dr
, oo_.mean
, oo_.var
and
oo_.autocorr
, which are described below.
If option periods
is present, sets oo_.endo_simul
(see oo_.endo_simul), and also saves the simulated variables in
MATLAB/Octave vectors of the global workspace with the same name as
the endogenous variables.
If options irf
is different from zero, sets oo_.irfs
(see below) and also saves the IRFs in MATLAB/Octave vectors of
the global workspace (this latter way of accessing the IRFs is
deprecated and will disappear in a future version).
Example 1
shocks; var e; stderr 0.0348; end; stoch_simul; |
Performs the simulation of the 2nd order approximation of a model
with a single stochastic shock e
, with a standard error of
0.0348.
Example 2
stoch_simul(irf=60) y k; |
Performs the simulation of a model and displays impulse
response functions on 60 periods for variables y
and k
.
After a run of stoch_simul
, contains the mean of the endogenous
variables. Contains theoretical mean if the periods
option is
not present, and empirical mean otherwise. The variables are arranged
in declaration order.
After a run of stoch_simul
, contains the variance-covariance of
the endogenous variables. Contains theoretical variance if the
periods
option is not present, and empirical variance
otherwise. The variables are arranged in declaration order.
After a run of stoch_simul
, contains a cell array of the
autocorrelation matrices of the endogenous variables. The element
number of the matrix in the cell array corresponds to the order of
autocorrelation. The option ar
specifies the number of
autocorrelation matrices available. Contains theoretical
autocorrelations if the periods
option is not present, and
empirical autocorrelations otherwise.
The element oo_.autocorr{i}(k,l)
is equal to the correlation
between and
, where
(resp.
) is the
-th (resp.
-th) endogenous
variable in the declaration order.
Note that if theoretical moments have been requested,
oo_.autocorr{i}
is the same than oo_.gamma_y{i+1}
.
After a run of stoch_simul
, if theoretical moments have been
requested (i.e. if the periods
option is not present), this
variable contains a cell array with the following values (where
ar
is the value of the option of the same name):
oo_.gamma{1}
Variance/co-variance matrix.
oo_.gamma{i+1} (for i=1:ar)
Autocorrelation function. see oo_.autocorr for more details. Beware, this is the autocorrelation function, not the autocovariance function.
oo_.gamma{nar+2}
Variance decomposition.
oo_.gamma{nar+3}
If a second order approximation has been requested, contains the vector of the mean correction terms.
After a run of stoch_simul
with option irf
different
from zero, contains the impulse responses, with the following naming
convention: VARIABLE_NAME_SHOCK_NAME
.
For example, oo_.irfs.gnp_ea
contains the effect on gnp
of a one standard deviation shock on ea
.
The approximated solution of a model takes the form of a set of decision
rules or transition equations expressing the current value of the endogenous
variables of the model as function of the previous state of the model and
shocks oberved at the beginning of the period. The decision rules are stored
in the structure oo_.dr
which is described below.
Description
extended_path
solves a stochastic (i.e. rational
expectations) model, using the extended path method presented
by Fair and Taylor (1983).
This function first computes a random path for the exogenous variables
(stored in oo_.exo_simul
, see oo_.exo_simul) and then
computes the corresponding path for endogenous variables, taking the
steady state as starting point. The result of the simulation is stored
in oo_.endo_simul
(see oo_.endo_simul).
Options
periods = INTEGER
The number of periods for which the simulation is to be computed. No default value, mandatory option.
solver_periods = INTEGER
The number of periods used to compute the approximate solution
at every iteration of the algorithm. Default: 200
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Dynare distinguishes four types of endogenous variables:
Those that appear only at current and past period in the model, but
not at future period (i.e. at and
but not
). The number of such variables is equal to
oo_.dr.npred - oo_.dr.nboth
.
Those that appear only at current and future period in the model, but
not at past period (i.e. at and
but not
). The number of such variables is stored in
oo_.dr.nfwrd
.
Those that appear at current, past and future period in the model
(i.e. at ,
and
). The number of such
variables is stored in
oo_.dr.nboth
.
Those that appear only at current, not past and future period in the
model (i.e. only at , not at
or
). The number of such variables is stored in
oo_.dr.nstatic
.
Note that all endogenous variables fall into one of these four categories, since after the creation of auxiliary variables (see section Auxiliary variables), all endogenous have at most one lead and one lag. We therefore have the following identity:
oo_.dr.npred + oo_.dr.nfwrd + oo_.dr.nstatic = M_.endo_nbr |
Internally, Dynare uses two orderings of the endogenous variables: the
order of declaration (which is reflected in M_.endo_names
), and
an order based on the four types described above, which we will call
the DR-order (“DR” stands for decision rules). Most of the time, the
declaration order is used, but for elements of the decision rules, the
DR-order is used.
The DR-order is the following: static variables appear first, then purely backward variables, then mixed variables, and finally purely forward variables. Inside each category, variables are arranged according to the declaration order.
Variable oo_.dr.order_var
maps DR-order to declaration
order, and variable oo_.dr.inv_order_var
contains the
inverse map. In other words, the k-th variable in the DR-order corresponds
to the endogenous variable numbered oo_.dr_order_var(k)
in
declaration order. Conversely, k-th declared variable is numbered
oo_.dr.inv_order_var(k)
in DR-order.
Finally, the state variables of the model are the purely backward variables
and the mixed variables. They are orderer in DR-order when they appear in
decision rules elements. There are oo_.dr.npred
such
variables.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The approximation has the form:
where is the steady state value of
and
.
The coefficients of the decision rules are stored as follows:
oo_.dr.ys
. The vector rows
correspond to all endogenous in the declaration order.
oo_.dr.ghx
. The matrix rows correspond to all
endogenous in DR-order. The matrix columns correspond to state
variables in DR-order.
oo_.dr.ghu
. The matrix rows correspond to all
endogenous in DR-order. The matrix columns correspond to exogenous
variables in declaration order.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The approximation has the form:
where is the steady state value of
,
, and
is the shift effect of the
variance of future shocks.
The coefficients of the decision rules are stored in the variables described for first order approximation, plus the following variables:
oo_.dr.ghs2
. The vector rows
correspond to all endogenous in DR-order.
oo_.dr.ghxx
. The matrix rows
correspond to all endogenous in DR-order. The matrix columns correspond
to the Kronecker product of the vector of state variables in DR-order.
oo_.dr.ghuu
. The matrix rows correspond
to all endogenous in DR-order. The matrix columns correspond to the
Kronecker product of exogenous variables in declaration order.
oo_.dr.ghxu
. The matrix rows correspond
to all endogenous in DR-order. The matrix columns correspond to the
Kronecker product of the vector of state variables (in DR-order) by
the vector of exogenous variables (in declaration order).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The approximation has the form:
where is the steady state value of
, and
is a
vector consisting of the deviation from the steady state of the state
variables (in DR-order) at date
followed by the exogenous variables at
date
(in declaration order). The vector
is
therefore of size
=
oo_.dr.npred +
M_.exo_nbr
.
The coefficients of the decision rules are stored as follows:
oo_.dr.ys
. The vector rows
correspond to all endogenous in the declaration order.
oo_.dr.g_0
. The
vector rows correspond to all endogenous in DR-order.
oo_.dr.g_1
. The matrix rows correspond
to all endogenous in DR-order. The matrix columns correspond to state
variables in DR-order, followed by exogenous in declaration order.
oo_.dr.g_2
. The matrix rows correspond
to all endogenous in DR-order. The matrix columns correspond to the
Kronecker product of state variables (in DR-order), followed by
exogenous (in declaration order). Note that the Kronecker product is
stored in a folded way, i.e. symmetric elements are stored only
once, which implies that the matrix has oo_.dr.g_3
. The matrix rows correspond
to all endogenous in DR-order. The matrix columns correspond to the
third Kronecker power of state variables (in DR-order), followed by
exogenous (in declaration order). Note that the third Kronecker power
is stored in a folded way, i.e. symmetric elements are stored only
once, which implies that the matrix has
After a run of stoch_simul
with the
conditional_variance_decomposition
option, contains a
three-dimensional array with the result of the decomposition. The
first dimension corresponds to forecast horizons (as declared with the
option), the second dimension corresponds to endogenous variables (in
the order of declaration), the third dimension corresponds to
exogenous variables (in the order of declaration).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by Build Daemon user on March 23, 2013 using texi2html 1.82.