stoch_simul

stoch_simul — computes the solution and simulates the model

Synopsis

stoch_simul [(OPTION [, OPTION...])] [VARIABLE_NAME...];

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 = INTEGER

Uses HP filter with λ = INTEGER 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

relative_irf

Requests the computation of normalized IRFs in percentage of the standard error of each shock

linear

Indicates that the original model is linear (put it rather in the model command)

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

...

noprint

Don't print anything. Useful for loops

print

...

order = INTEGER

Order of Taylor approximation. Acceptable values are 1 and 2. Default: 2

periods = INTEGER

Specifies the number of periods to use in simulations. If order=1, no simulation is necessary to compute theoretical moments and IRFs. A number of periods larger than one triggers automatically option simul. Default: 0

qz_criterium = DOUBLE

Value used to split stable from unstable eigenvalues in reordering the Generalized Schur decomposition used for solving 1st order problems. Default: 1.000001

replic = INTEGER

Number of simulated series used to compute the IRFs. Default: 1 if order=1, and 50 otherwise

simul

Computes a stochastic simulation of the model for the number of periods specified in the periods option. Uses initval values, possibly recomputed by steady, as initial values 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. The variables in the oo_.endo_simul matrix, in their order of declaration (as in M_.endo_names). Default: no simulation

simul_seed = INTEGER

Specifies a seed for the random generator so as to obtain the same random sample at each run of the program. Otherwise a different sample is used for each run. Default: seed not specified

simul_algo = INTEGER

...

solve_algo = INTEGER

See steady for the possible values and their meaning

Description

stoch_simul computes a Taylor approximation of the decision and transition functions for the model, 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. If you know how to compute the steady state for your model, you can provide a Matlab® function doing the computation instead of using the nonlinear solver. The function should be called with the name of the .mod file followed by _steadystate. See fs2000a_steadystate.m in examples/fs2000 directory.

Variance decomposition, correlation, autocorrelation are only displayed for variables with positive variance. Impulse response functions are only plotted for variables with response larger than 10-10.

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.

Currently, the HP filter is only available when computing theoretical moments, not for for moments of simulated variables.

The covariance matrix of the shocks is specified either with the shocks command or with the Sigma_e command.

When a list of VARIABLE_NAME is specified, results are displayed only for these variables.

Decision rules

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.

First order approximation

yt = ys + A yht-1 + B ut

where ys is the steady state value of y and yht=yt-ys.

Second order approximation

yt = ys + 0.5Δ2 + A yht-1 + B ut + 0.5C(yht-1⊗yht-1) + 0.5D(ut⊗ut) + E(yht-1⊗ut)

where ys is the steady state value of y, yht=yt-ys, and Δ2 is the shift effect of the variance of future shocks.

Output variables

stoch_simul sets several fields in global variable oo_. The descriptive statistics are theoretical moments when no simulation is requested and otherwise represent the moments of the simulated variables.

  • the coefficients of the decision rules are stored in global structure oo_.dr. Here is the correspondance with the symbols used in the above description of the decision rules:

    Decision rule coefficients

    • ys: oo_.dr.ys. The vector rows correspond to variables in alphabetical order of the variable names.

    • Δ2: oo_.dr.ghs2. The vector rows correspond to re-ordered variables (see below).

    • A: oo_.dr.ghx. The matrix rows correspond to re-ordered variables. The matrix columns correspond to state variables (see below).

    • B: oo_.dr.ghu. The matrix rows correspond to re-ordered variables (see below). The matrix columns correspond to exogenous variables in alphabetical order.

    • C: oo_.dr.ghxx. The matrix rows correspond to re-ordered variables. The matrix columns correspond to the Kronecker product of the vector of state variables (see below).

    • D: oo_.dr.ghuu. The matrix rows correspond to re-ordered variables (see below). The matrix columns correspond to the Kronecker product of exogenous variables in alphabetical order.

    • E: oo_.dr.ghxu. The matrix rows correspond to re-ordered variables. The matrix columns correspond to the Kronecker product of the vector of state variables (see below) by the vector of exogenous variables in alphabetical order.

    When reordered, the variables are stored in the following order: static variables, purely predetermined variables (variables that appear only at the current and lagged periods in the model), variables that are both predetermined and forward-looking (variables that appear at the current, future and lagged periods in the model), purely forward-looking variables (variables that appear only at the current and future periods in the model). In each category, the variables are arranged alphabetically.

    The state variables of the model are purely predetermined variables and variables that are both predetermined and forward-looking. They are ordered in that order. When there are lags on more than one period, the state variables are ordered first according to their lag: first variables from the previous period, then variables from two periods before and so on. Note also that when a variable appears in the model at a lag larger than one period, it is automatically included at all inferior lags.

  • The mean of the endogenous variables is available in the vector oo_.mean. The variables are arranged in alphabetical order.

  • The matrix of variance-covariance of the endogenous variables in the matrix oo_.var. The variables are arranged in alphabetical order.

  • The matrix of autocorrelation of the endogenous variables are made available in cell array oo_.autocorr. 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.

  • Simulated variables, when they have been computed, are available in Matlab® vectors with the same name as the endogenous variables.

  • Impulse responses, when they have been computed, are available in Matlab® vectors with the following naming convention VARIABLE_NAME_SHOCK_NAME.

    Example: gnp_ea contains the effect on gnp of a one standard deviation shock on ea.

Examples

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(linear,irf=60) y k;

Performs the simulation of a linear model and displays impulse response functions on 60 periods for variables y and k.