|
|
Since Dynare 4.1, the Dynare preprocessor modifies the model given by the user, under certain circumstances, by adding auxiliary variables to it.
|
|
|
# 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.
|
|
|
|
|
|
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
|
|
|
* when the EXPECTATION operator is used.
|
|
|
- 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.
|
|
|
|
|
|
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`.
|
|
|
|
|
|
In most cases, auxiliary equations are added along with auxiliary variables, in order to keep equal the number of equations and endogenous.
|
|
|
In most cases, auxiliary equations are appended along with auxiliary variables, so that the number of equations and endogenous variables stays constant.
|
|
|
|
|
|
In order to get information about auxiliary variables and equations added by the preprocessor, the `write_latex_dynamic_model` and `write_latex_static_model` commands can be useful tools.
|
|
|
|
|
|
The vector 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 informations depending on the type of the auxiliary variable.
|
|
|
|
|
|
# 0. Auxiliary variable for endogenous with lead >= 2
|
|
|
|
|
|
This is an auxiliary variable which is a substitute for an expression in the original model where a lead of 2 or more on an endogenous variable appears.
|
|
|
|
|
|
The name of such an auxiliary variable begins with `AUX_ENDO_LEAD_`.
|
|
|
|
|
|
This kind of auxiliary variable has `M_.aux_vars(i).type = 0`.
|
|
|
|
|
|
# 1. Auxiliary variable for endogenous with lag >= 2
|
|
|
|
|
|
This is an auxiliary variable which is a substitute for an endogenous variable in the original model which has a lag of 2 or more.
|
|
|
# The `M_.aux_vars`-structure
|
|
|
|
|
|
The name of such an auxiliary variable begins with `AUX_ENDO_LAG_`.
|
|
|
|
|
|
`M_.aux_vars(i).orig_index` contains the index of the endogenous variable for which it is a substitute, and `M_.aux_vars(i).orig_lead_lag` contains the lag of the original variable (as a negative value).
|
|
|
|
|
|
This kind of auxiliary variable has `M_.aux_vars(i).type = 1`.
|
|
|
|
|
|
# 2. Auxiliary variable for exogenous with a lead
|
|
|
The vector structure `M_.aux_vars` also contains information about auxiliary variables. For each auxiliary variable, the following fields are declared:
|
|
|
|
|
|
This is an auxiliary variable which is a substitute for an expression in the original model where a lead on an exogenous variable appears.
|
|
|
- `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 name of such an auxiliary variable begins with `AUX_EXO_LEAD_`.
|
|
|
The structure can also contain other information, depending on the type of the aux var:
|
|
|
|
|
|
This kind of auxiliary variable has `M_.aux_vars(i).type = 2`.
|
|
|
- `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_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.
|
|
|
|
|
|
# 3. Auxiliary variable for exogenous with a lag
|
|
|
# Types of auxiliary variables
|
|
|
|
|
|
This is an auxiliary variable which is a substitute for an exogenous variable in the original model which has a lag.
|
|
|
## Type 0: Leads of endogenous >=2
|
|
|
This kind of aux var has `M_.aux_vars(i).type = 0` and substitutes for an expression in the original model where a lead of 2 or more appears on an endogenous variable.
|
|
|
The name of such an aux var begins with `AUX_ENDO_LEAD_`.
|
|
|
|
|
|
The name of such an auxiliary variable begins with `AUX_EXO_LAG_`.
|
|
|
## Type 1: Lags of endogenous >=2
|
|
|
|
|
|
`M_.aux_vars(i).orig_index` contains the index of the exogenous variable for which it is a substitute, and `M_.aux_vars(i).orig_lead_lag` contains the lag of the original variable (as a negative value).
|
|
|
This kind of aux var has `M_.aux_vars(i).type = 1` and substitutes for an expression in the original model where a lag of 2 or more appears on an endogenous variable.
|
|
|
The name of such an aux var begins with `AUX_ENDO_LAG_`.
|
|
|
|
|
|
This kind of auxiliary variable has `M_.aux_vars(i).type = 3`.
|
|
|
## Type 2: Lead of exogenous
|
|
|
|
|
|
# 4. Aux var for expectation operator using the (full) information set of another period
|
|
|
This kind of aux var has `M_.aux_vars(i).type = 2` and substitutes for an expression in the original model where a lead on an exogenous variable appears. The name of such an aux var begins with `AUX_EXO_LEAD_`.
|
|
|
|
|
|
This is an auxiliary variable which is a substitute for an expression like `EXPECTATION(-1)(...)`.
|
|
|
## Type 3: Lag of exogenous
|
|
|
|
|
|
The name of such an auxiliary variable begins with `AUX_EXPECT_LEAD_` or `AUX_EXPECT_LAG_`.
|
|
|
This kind of aux var has `M_.aux_vars(i).type = 3` and substitutes for an expression in the original model where a lag on an exogenous variable appears. The name of such an aux var begins with `AUX_EXO_LAG_`.
|
|
|
|
|
|
This kind of auxiliary variable has `M_.aux_vars(i).type = 4`.
|
|
|
## Type 4: `EXPECTATION()`-operator
|
|
|
|
|
|
# 5. Auxiliary variable for the differentiate of a forward variable (since 4.4)
|
|
|
This kind of aux var has `M_.aux_vars(i).type = 4` and results from the `EXPECTATION()`-operator employing the (full) information set of another period. It substitutes for an expression like `EXPECTATION(-1)(...)`. The name of such an aux var begins with `AUX_EXPECT_LEAD_` or `AUX_EXPECT_LAG_`.
|
|
|
|
|
|
This is an auxiliary variable which is a substitute for a forward variable, when the `differentiate_forward_vars` option of `model` is used.
|
|
|
## Type 5: `differentiate_forward_vars`-option
|
|
|
|
|
|
The name of such an auxiliary variable begins with `AUX_DIFF_FWRD_`.
|
|
|
This kind of aux var has `M_.aux_vars(i).type = 5` and results from `differentiate_forward_vars`-option of `model` (since Dynare 4.4). In this case, forward variables are differentiated and and the difference replaced by an aux var, whose name begins with `AUX_DIFF_FWRD_`.
|
|
|
|
|
|
`M_.aux_vars(i).orig_index` contains the index of the endogenous variable of which it is the differentiate.
|
|
|
|
|
|
This kind of auxiliary variable has `M_.aux_vars(i).type = 5`.
|
|
|
## Type 6: Lagrange multipliers of the `ramsey_model`
|
|
|
|
|
|
# 6. Auxiliary variable for multipliers for first order conditions of the Ramsey problem (since 4.3)
|
|
|
|
|
|
This is an auxiliary variable which is created for a lagrange multiplier of the ramsey problem.
|
|
|
|
|
|
The name of such an auxiliary variable begins with `MULT_i`, where `i` is the equation number with which the multiplier is associated.
|
|
|
This kind of aux var has `M_.aux_vars(i).type = 6` and corresponds to the Lagrange multipliers attached to the first order conditions of the Ramsey problem (since Dynare 4.3). They will appear whenever `ramsey_model` is used. Their name begins is `MULT_i`, where `i` is the equation number with which the multiplier is associated.
|
|
|
|
|
|
`M_.aux_vars(i).eq_nbr` contains the number of the equation (constraint) with which the multiplier is associated.
|
|
|
|
|
|
This kind of auxiliary variable has `M_.aux_vars(i).type = 6`.
|
|
|
|
|
|
# 7. Auxiliary variable to account for difference between `var_model` order and max lag in model (since 4.6)
|
|
|
This is an auxiliary variable to account for the difference in lags between that declared in the `var_model` statement and those present in the model.
|
|
|
|
... | ... | |