[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2 Variable declarations

While Dynare allows the user to choose their own variable names, there are some restrictions to be kept in mind. First, variables and parameters must not have the same name as Dynare commands or built-in functions. In this respect, Dynare is not case-sensitive. For example, do not use Ln or Sigma_e to name your variable. Not conforming to this rule might yield hard-to-debug error messages or crashes. Second, to minimize interference with MATLAB or Octave functions that may be called by Dynare or user-defined steady state files, it is recommended to avoid using the name of MATLAB functions. In particular when working with steady state files, do not use correctly-spelled greek names like alpha, because there are Matlab functions of the same name. Rather go for alppha or so. Lastly, please do not name a variable or parameter i. This may interfere with the imaginary number i and the index in many loops. Rather, name investment invest.

Declarations of variables and parameters are made with the following commands:

Command: var VARIABLE_NAME [$LATEX_NAME$] [(long_name=QUOTED_STRING|NAME=QUOTED_STRING…)]…;
Command: var (deflator = MODEL_EXPRESSION) VARIABLE_NAME [$LATEX_NAME$] [(long_name=QUOTED_STRING|NAME=QUOTED_STRING…)]…;
Command: var (log_deflator = MODEL_EXPRESSION) VARIABLE_NAME [$LATEX_NAME$] [(long_name=QUOTED_STRING|NAME=QUOTED_STRING…)]…;

Description

This required command declares the endogenous variables in the model. See section Conventions, for the syntax of VARIABLE_NAME and MODEL_EXPRESSION. Optionally it is possible to give a LaTeX name to the variable or, if it is nonstationary, provide information regarding its deflator.

var commands can appear several times in the file and Dynare will concatenate them.

Options

If the model is nonstationary and is to be written as such in the model block, Dynare will need the trend deflator for the appropriate endogenous variables in order to stationarize the model. The trend deflator must be provided alongside the variables that follow this trend.

deflator = MODEL_EXPRESSION

The expression used to detrend an endogenous variable. All trend variables, endogenous variables and parameters referenced in MODEL_EXPRESSION must already have been declared by the trend_var, log_trend_var, var and parameters commands. The deflator is assumed to be multiplicative; for an additive deflator, use log_deflator.

log_deflator = MODEL_EXPRESSION

Same as deflator, except that the deflator is assumed to be additive instead of multiplicative (or, to put it otherwise, the declared variable is equal to the log of a variable with a multiplicative trend).

long_name = QUOTED_STRING

This is the long version of the variable name. Its value is stored in M_.endo_names_long. In case multiple long_name options are provided, the last one will be used. Default: VARIABLE_NAME

NAME = QUOTED_STRING

This is used to create a partitioning of variables. It results in the direct output in the ‘.m’ file analogous to: M_.endo_partitions.NAME = QUOTED_STRING;.

Example

 
var c gnp cva (country=`US', state=`VA')
          cca (country=`US', state=`CA', long_name=`Consumption CA');
var(deflator=A) i b;
var c $C$ (long_name=`Consumption');
Command: varexo VARIABLE_NAME [$LATEX_NAME$] [(long_name=QUOTED_STRING|NAME=QUOTED_STRING…)]…;

Description

This optional command declares the exogenous variables in the model. See section Conventions, for the syntax of VARIABLE_NAME. Optionally it is possible to give a LaTeX name to the variable.

Exogenous variables are required if the user wants to be able to apply shocks to her model.

varexo commands can appear several times in the file and Dynare will concatenate them.

Options

long_name = QUOTED_STRING

Like long_name but value stored in M_.exo_names_long.

NAME = QUOTED_STRING

Like partitioning but QUOTED_STRING stored in M_.exo_partitions.NAME.

Example

 
varexo m gov;
Command: varexo_det VARIABLE_NAME [$LATEX_NAME$] [(long_name=QUOTED_STRING|NAME=QUOTED_STRING…)]…;

Description

This optional command declares exogenous deterministic variables in a stochastic model. See Conventions, for the syntax of VARIABLE_NAME. Optionally it is possible to give a LaTeX name to the variable.

It is possible to mix deterministic and stochastic shocks to build models where agents know from the start of the simulation about future exogenous changes. In that case stoch_simul will compute the rational expectation solution adding future information to the state space (nothing is shown in the output of stoch_simul) and forecast will compute a simulation conditional on initial conditions and future information.

varexo_det commands can appear several times in the file and Dynare will concatenate them.

Options

long_name = QUOTED_STRING

Like long_name but value stored in M_.exo_det_names_long.

NAME = QUOTED_STRING

Like partitioning but QUOTED_STRING stored in M_.exo_det_partitions.NAME.

Example

 
varexo m gov;
varexo_det tau;

Command: parameters PARAMETER_NAME [$LATEX_NAME$] [(long_name=QUOTED_STRING|NAME=QUOTED_STRING…)]…;

Description

This command declares parameters used in the model, in variable initialization or in shocks declarations. See Conventions, for the syntax of PARAMETER_NAME. Optionally it is possible to give a LaTeX name to the parameter.

The parameters must subsequently be assigned values (see section Parameter initialization).

parameters commands can appear several times in the file and Dynare will concatenate them.

Options

long_name = QUOTED_STRING

Like long_name but value stored in M_.param_names_long.

NAME = QUOTED_STRING

Like partitioning but QUOTED_STRING stored in M_.param_partitions.NAME.

Example

 
parameters alpha, bet;
Command: change_type (var | varexo | varexo_det | parameters) VARIABLE_NAME | PARAMETER_NAME…;

Description

Changes the types of the specified variables/parameters to another type: endogenous, exogenous, exogenous deterministic or parameter.

It is important to understand that this command has a global effect on the ‘.mod’ file: the type change is effective after, but also before, the change_type command. This command is typically used when flipping some variables for steady state calibration: typically a separate model file is used for calibration, which includes the list of variable declarations with the macro-processor, and flips some variable.

Example

 
var y, w;
parameters alpha, bet;
…
change_type(var) alpha, bet;
change_type(parameters) y, w;

Here, in the whole model file, alpha and beta will be endogenous and y and w will be parameters.

Command: predetermined_variables VARIABLE_NAME…;

Description

In Dynare, the default convention is that the timing of a variable reflects when this variable is decided. The typical example is for capital stock: since the capital stock used at current period is actually decided at the previous period, then the capital stock entering the production function is k(-1), and the law of motion of capital must be written:

 
k = i + (1-delta)*k(-1)

Put another way, for stock variables, the default in Dynare is to use a “stock at the end of the period” concept, instead of a “stock at the beginning of the period” convention.

The predetermined_variables is used to change that convention. The endogenous variables declared as predetermined variables are supposed to be decided one period ahead of all other endogenous variables. For stock variables, they are supposed to follow a “stock at the beginning of the period” convention.

Note that Dynare internally always uses the “stock at the end of the period” concept, even when the model has been entered using the predetermined_variables-command. Thus, when plotting, computing or simulating variables, Dynare will follow the convention to use variables that are decided in the current period. For example, when generating impulse response functions for capital, Dynare will plot k, which is the capital stock decided upon by investment today (and which will be used in tomorrow’s production function). This is the reason that capital is shown to be moving on impact, because it is k and not the predetermined k(-1) that is displayed. It is important to remember that this also affects simulated time series and output from smoother routines for predetermined variables. Compared to non-predetermined variables they might otherwise appear to be falsely shifted to the future by one period. Example

The following two program snippets are strictly equivalent.

Using default Dynare timing convention:

 
var y, k, i;
…
model;
y = k(-1)^alpha;
k = i + (1-delta)*k(-1);
…
end;

Using the alternative timing convention:

 
var y, k, i;
predetermined_variables k;
…
model;
y = k^alpha;
k(+1) = i + (1-delta)*k;
…
end;
Command: trend_var (growth_factor = MODEL_EXPRESSION) VARIABLE_NAME [$LATEX_NAME$]…;

Description

This optional command declares the trend variables in the model. See section Conventions, for the syntax of MODEL_EXPRESSION and VARIABLE_NAME. Optionally it is possible to give a LaTeX name to the variable.

The variable is assumed to have a multiplicative growth trend. For an additive growth trend, use log_trend_var instead.

Trend variables are required if the user wants to be able to write a nonstationary model in the model block. The trend_var command must appear before the var command that references the trend variable.

trend_var commands can appear several times in the file and Dynare will concatenate them.

If the model is nonstationary and is to be written as such in the model block, Dynare will need the growth factor of every trend variable in order to stationarize the model. The growth factor must be provided within the declaration of the trend variable, using the growth_factor keyword. All endogenous variables and parameters referenced in MODEL_EXPRESSION must already have been declared by the var and parameters commands.

Example

 
trend_var (growth_factor=gA) A;
Command: log_trend_var (log_growth_factor = MODEL_EXPRESSION) VARIABLE_NAME [$LATEX_NAME$]…;

Description

Same as trend_var, except that the variable is supposed to have an additive trend (or, to put it otherwise, to be equal to the log of a variable with a multiplicative trend).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Stéphane Adjemian on June 11, 2017 using texi2html 1.82.