|
|
# Dynare's use of auxiliary variables
|
|
|
|
|
|
The Dynare preprocessor modifies the model given by the user, under certain circumstances, by adding auxiliary variables to it.
|
|
|
The Dynare preprocessor modifies the model given by the user, under certain circumstances, by adding auxiliary variables to it. The aim is to bring the model into a canonical form and to simplify computations,
|
|
|
|
|
|
Auxiliary variables are created in the following cases:
|
|
|
- for endogenous variables with a lag or a lead of two or more (only in stochastic contexts in Dynare 4.1, in all cases in Dynare ≥ 4.2)
|
|
|
- for exogenous variables with a lag or a lead (only in stochastic contexts in Dynare ≤ 4.6, in all cases in Dynare ≥ 4.7)
|
|
|
- when the `EXPECTATION()` operator is used.
|
|
|
- when the `EXPECTATION()` operator is used
|
|
|
- when the `ramsey_model`-statement is used
|
|
|
- if the `diff`-operator is used.
|
|
|
|
|
|
Auxiliary variables are always endogenous variables. Internally, the indices of the original endogenous (as declared by the user) are in the range `1:M_.orig_endo_nbr`. Auxiliary variables have indices in the range `M_.orig_endo_nbr+1:M_.endo_nbr`.
|
|
|
|
... | ... | @@ -15,14 +17,14 @@ In order to get information about auxiliary variables and equations added by the |
|
|
|
|
|
# The `M_.aux_vars`-structure
|
|
|
|
|
|
The vector structure `M_.aux_vars` also contains information about auxiliary variables. For each auxiliary variable, the following fields are declared:
|
|
|
The matrix structure `M_.aux_vars` also contains information about auxiliary variables. For each auxiliary variable, the following fields are declared:
|
|
|
|
|
|
- `M_.aux_vars(i).endo_index`: the index of the auxiliary variable, in the range `M_.orig_endo_nbr+1:M_.endo_nbr`
|
|
|
- `M_.aux_vars(i).type`: an integer representing the type of the auxiliary variable (see below for the list of types).
|
|
|
|
|
|
The structure can also contain other information, depending on the type of the aux var:
|
|
|
|
|
|
- `M_.aux_vars(i).orig_index` contains the index of the endogenous or exogenous variable for which the auxiliary variables is a substitute
|
|
|
- `M_.aux_vars(i).orig_index` contains the index of the endogenous or exogenous variable for whose leads/lags the auxiliary variables is a substitute
|
|
|
- `M_.aux_vars(i).orig_lead_lag` contains the lag or lead number of the original variable (as a negative value for lags and a positive one for leads; it will be empty for no lag).
|
|
|
- `M_.aux_vars(i).eq_nbr` contains the associated equation in case of Lagrange multipliers
|
|
|
- `M_.aux_vars(i).orig_expr` contains the original expression to which the auxiliary variable is attached, for example in case of a lead of two on a Lagrange multiplier, there will be an auxiliary variable of type `0` for the lead on an auxiliary variable of type `6` (the multiplier). In this case, `orig_expr` may contain `MULT_1(1)` to indicate that the auxiliary variable for the lead refers to that leaded multiplier.
|
... | ... | @@ -73,7 +75,7 @@ This kind of aux var has `M_.aux_vars(i).type = 8` and substitutes for the `diff |
|
|
`M_.aux_vars(i).orig_index` contains the index of the variable contained in the `diff` operator. This field exists if the `diff` was taken of a variable, not of an expression.
|
|
|
`M_.aux_vars(i).orig_lead_lag` contains the lag of the variable contained in the `diff` operator. This field exists if the `diff` was taken of a variable, not of an expression.
|
|
|
|
|
|
## Type 9: lag on `diff` operator (since Dynare 4.6)
|
|
|
## Type 9: lag within `diff` operator (since Dynare 4.6)
|
|
|
|
|
|
This kind of aux var has `M_.aux_vars(i).type = 9` and accounts for applying the difference operator to a lag. If a `diff` operator is applied to a variable with lagged values (e.g. `diff(x(-3)`), a diff auxiliary variable is created for the `diff` operator applied to the variable with lag equal to zero (e.g. `diff(x)`) and auxiliary variables are created for the following sequence `diff(x(-1)`, `diff(x(-2))`, and `diff(x(-3)`). The name of such an auxiliary variable begins with `AUX_DIFF_LAG_`.
|
|
|
|
... | ... | @@ -84,6 +86,6 @@ This kind of aux var has `M_.aux_vars(i).type = 9` and accounts for applying the |
|
|
|
|
|
This kind of aux var has `M_.aux_vars(i).type = 10` and substitutes for certain unary operations in the context of employing `diff`-operators, namely: `exp`, `log`, `log10`, `cos`, `sin`, `tan`, `acos`, `asin`, `atan`, `cosh`, `sinh`, `tanh`, `acosh`, `asinh`, `atanh`, `sqrt`, `abs`, `sign`, and `erf`. The name of such an auxiliary variable begins with `AUX_UOP_`.
|
|
|
|
|
|
## Type 11: lead on `diff` operator (since Dynare 4.6)
|
|
|
## Type 11: lead within `diff` operator (since Dynare 4.6)
|
|
|
|
|
|
This kind of aux var has `M_.aux_vars(i).type = 11` and accounts for applying the difference operator to a lead. Similarly to Type 9, it will create a sequence of auxiliary variables, but for leads. |
|
|
\ No newline at end of file |