Dynare now incorporates new features which significantly speed-up deterministic simulation and steady state computation in middle and large scale models.

The speed-up is achieved by the combination of three new features:

Note that at this time it is not possible to combine all possible variants of these three families of algorithms; this is documented at the end of this page.

Block decomposition of the model

Description of the steps of the algorithm

Model simplification

In a first step to get ride of nearly zero elements in the jacobian a threshold is used to determine whether a jacobian element has to be considered as null or not. If the absolute value of a jacobian element is below the threshold then it is considered as null and is discarded form the sparse representation of the jacobian. Eliminating nearly zero elements improves the sparsity of the model and hence the simulation time. Note that if the cutoff value is too high then the model properties could be strongly modified and the simulation could fail.

Prologue and Epilogue determination

In a second step, the equations and the variables of the model could be reordered to get purely recursive initial and final blocks. The purely recursive equations are easily found.

Model normalization

To get a block decomposition of the model, each endogenous variable has to be assigned unambiguously to an equation or equivalently the model has to be normalized: this normalization is performed using the maximum cardinality matching with Edmonds’ matching algorithm (Boost-graph library). Attention has to be paid to potential singularity in the matching process (to avoid for example a normalisation where the variable $x$ is assigned to the following equation: $y+0\cdot x=2z$). The matching algorithm is applied iteratively using the normalized Jacobian matrix (each row is divided by its maximum absolute value component) with a decreasing cutoff (all the elements in the Jacobian matrix below the cutoff are set to zero) until a matching is found.

Equations renormalization

Once the model has been normalized, the preprocessor tries to rewrite the equations in a normalized form: for the variable $x_i$ associated to the equation $i$, the equation has of the following form $x_i = f(x_1, \ldots, x_{i-1}, x_{i+1}, \ldots, x_n)$. For equations belonging to a recursive block, the normalized equation has not to be solved but only evaluated. For equations normalized belonging to a simultaneous block, they could be simply evaluated if they belong to the recursive set of the block in the feedback variables determination.

Block decomposition

The simultaneous block composed of equations and endogenous variables that do not belong to the prologue or the epilogue could be split sub recursive blocks. Those sub recursive blocks form the strong component of the graph representation of the model. To find them a depth search Tarjan algorithm is used.

Splitting the variables of a simultaneous block in feedback and recursive variables

The simultaneous blocks computed in the previous step are rewritten in a quasi triangular form. The non normalized equations that could not be evaluated are forced to belong to the feedback variables set. In addition, for dynamic model the static variables associated with non static equation or the non static variables are imposed in the feedback variables set. The equations of the block are reordered as follow:

Dynare syntax

Computing block decomposition

The block decomposition of the model is triggered by the option block of the model keyword:

model(block);
...
end;

Controlling the normalization

To get ride of nearly zero elements in the jacobian a threshold is used to determine whether a jacobian element has to be considered as null or not. If the absolute value of a jacobian element is below the threshold then it is considered as null and is discarded form the sparse representation of the jacobian. Eliminating nearly zero elements improves the sparsity of the model and hence the simulation time. Note that if the cutoff value is too high then the model properties could be strongly modified and the simulation could failed.

The default value of the cutoff is $10^{-15}$.

Example:

model(block,cutoff=1e-13);
...
end;

/!\ Note that the jacobian is evaluated considering the initial value of the parameters provided in the mod file. If the parameters value are modified (the model is estimated for example) before the simul command, some components of the jacobian could be wrongly discarded. To prevent such a result you have to set the cutoff to 0.

Controlling the set of feedback variables

Each block of the model can be rewritten in a quasi recursive form. The endogenous variables are split in two different groups: the recursive variables and the feedback variables. The recursive variables are simply evaluated conditional to the feedback variables. The system is solved only for the feedback variables. The set of feedback variables is determined according to the mfs option:

Example:

model(block,mfs=2);
...
end;

sparse model options and model_info command

sparse_dll

Dynare performs also a block-decomposition of the model and the preprocessor creates two C-files or a binary file containing the model code according to the "Compiler option" containing the code of the deterministic simulation.

model(sparse_dll);
...
end;

/!\ in the current version of Dynare this option is not compatible with the check command.

Compiler options

These options have to be used in conjunction with sparse_dll option. Two values could be used GCC_compiler or NO_compiler (default value).

model(sparse_dll,GCC_compiler);
...
end;

/!\ if you use GCC_compiler Gnumex has to be installed on your computer.

cutoff

markowitz

At each iteration of the deterministic simulation, if the linear approximation of the model is solve using a sparse gaussian elimination, two criterion could be used to select the variable to substitute:

Markowitz option

The pivot is selected according to the highest value among j=1,…,N (where N is the number of possible pivots) of the following criteria:

        \[
          \frac{\frac{\left | \lambda_j\right |}{Sup_{i} \left | \lambda_i\right |} }{\left ( \frac{ n_j }{ Sup_{i} n_i} \right )^\mu}
    \]

With:

As $\mu \rightarrow \infty $ the Markowitz criteria prevails. At the opposite if $\mu \rightarrow 0 $ the usual maximum pivot criteria prevails.

The default value is 0.5

model(sparse_dll,markowitz=2);
...
end;

/!\ This option is only used in conjunction with sparse_dll option.

model_info command

The model_info command provides information about

There are five different types of blocks depending on the simulation method used:

model(sparse);
...
end;

model_info;

simulate options

method

This option indicates which linear solver will be implemented at each step of the Newton simulation of the stacked systems formed by the simultaneous blocks containing leads and lags on the endogenous variables. There are three values for this option if the sparse option is used in model command:

When sparse_dll option is used only SGE (for Sparse Gaussian Elimination) is available. It is the unique and default value of method in this case.

datafile

If the variables of the model are not constant over time, their initial values, stored in a text file, could be loaded, using the datafile option, as initial values before a deteministic simulation.

model;
...
end;

simul(periods=80,datafile=mark3);