The feature was introduced in Dynare 4.1. It allows user to attach arbitrary information to each equation and to recover them at runtime. It is particularly useful to specify names of equations, but can also be used to introduce other information in the model.
Equations tags are used by Dynare for several purposes:
name-tags are used to identify equations i) for the display of residuals when using
resid, ii) when specifying several iterations of the same equation for different regimes for Occbin (from Dynare 4.7 onwards), or iii) when selecting equations using
exclude_eqs/include_eqs-command line directives.
relax/bind-tags are used to specify Occbin regimes.
dynamic/static-tags allow to specify dynamic and static version of the same equation.
mcp-tags are used to specify mixed complementarity conditions.
- Type tags
parametercan be used for on-the-fly variable/parameter declarations
They can be very useful for custom algorithms.
Example: flagging equations with tags
Before each equation in the mod-file, the user can specify a list pairs (key,values) were key is any identifier and value a single-quoted string. The only exception are
dynamic/static-tags that don't have a
This is demonstrated by the following example :
var c k A; varexo epsilon; parameters theta sigma rho beta; model; [name = 'Budget constraint'] c + k = k^theta*A; [name = 'Euler condition', euler_var='k', type='expectation'] beta*(c(1)/c)^(-sigma)*theta*k^(theta-1)*A(1) = 1; [name = 'Specification of shocks', type='exogenous'] log(A) = rho*log(A(-1)) + epsilon; end;
In this simple example, we have given a name to each equation. We have also added the name of the variable used to derive the Euler equation and have specified that the last equation is exogenous.
The tags are stored in a 3-column cell. Each line correspond to a tag (n,key,value) where n is the number of the equation.
The table is stored in
M_.equations_tags. It can be queried directly or using one of the helper functions.
Here are some examples.
Find the equation having a given key or a given value for a given key
The function select_from_table.m can be used to find equations satisfying given properties.
For the example model
select_from_table(M_.equations_tags,'type') will return the indices of equations for which a key 'type' has been specified :
ans = 2 3
select_from_table(M_.equations_tags,'type','expectation') will return the list of equations which have the type 'expectation' :
ans = 2