From 7d17a4a0fe7b66e7c2175bcaaa1cbbd3ecb252ca Mon Sep 17 00:00:00 2001 From: sebastien Date: Wed, 30 Jul 2008 17:04:14 +0000 Subject: [PATCH] v4 manual.xml: * added description of options to "dynare" command * began description of valid mathematical expressions (inside and outside model block) * various minor changes git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1972 ac1d8469-bf42-47a9-8791-bf33cf982152 --- doc/manual.xml | 182 ++++++++++++++++++++++++++++++------------------- 1 file changed, 110 insertions(+), 72 deletions(-) diff --git a/doc/manual.xml b/doc/manual.xml index 7eee4ac3b..fd7229291 100644 --- a/doc/manual.xml +++ b/doc/manual.xml @@ -124,15 +124,15 @@ Currently the development team of Dynare is composed of S. Adjemian, M. Juillard changed the default for nonlinear solver in added a mention of the possibility to write explicitly a steady state function in , , and added a brief Ouput section in -corrected misleading description of option prefilter in -added variance decomposition among the statistics computed with option moments_varendo in +corrected misleading description of option in +added variance decomposition among the statistics computed with option in tex option in isn't yet implemented May 3, 2005 -added option noprint in -modified option irf in -modified option simul_seed in +added option in +modified option in +modified option in March 6, 2005 @@ -284,7 +284,7 @@ you can put them in a file called .octaverc in your home di Dynare invocation -You invoke Dynare by typing the dynare at the Matlab® or Octave prompt. +You invoke Dynare by using the dynare at the Matlab® or Octave prompt. @@ -299,35 +299,45 @@ you can put them in a file called .octaverc in your home di dynare - + FILENAME[.mod] - noclearall - savemacro - debug + + + Description -dynare executes instruction included in filename.mod. -filename.mod is the name of the model file containing the -model and the processing instructions. +dynare executes instruction included in FILENAME.mod. +This user-supplied file contains the model and the processing instructions, as described in . Details -dynare creates three intermediary files: +dynare begins by launching the preprocessor on the *.mod file. + +By default (unless any of , or options have been given to ), the preprocessor creates three intermediary files: - filename.m with the instructions for the simulations - filename_dynamic.m with the dynamic model equations - filename_static.m with the long run static model equations + FILENAME.m: contains variable declarations, and computing tasks + FILENAME_dynamic.m: contains the dynamic model equations + FILENAME_static.m: contains the long run static model equations - - These files may be looked at to understand errors reported at the simulation stage. +dynare will then run the computing tasks by executing FILENAME.m. + + +Options + + + : by default, dynare will issue a clear all command to Matlab® or Octave, thereby deleting all workspace variables; this options instructs dynare not to clear the workspace + : instructs dynare to save the intermediary file which is obtained after macro-processing (see ); the saved output will go in FILENAME-macroexp.mod + : instructs the preprocessor to write some debugging information about the scanning and parsing of the *.mod file + + Output @@ -336,41 +346,40 @@ Depending on the computing tasks requested in the *.mod file, executing command -Under Matlab, some results are also saved in a file called FILENAME_results.mat. Currently, this file contains when available the structures dr_ and oo_. +The oo_ structure is also saved in a file called FILENAME_results.mat. Examples dynare ramst - -or - dynare ramst.mod savemacro -Model file commands +The Model file -Dynare commands are either single instructions or a block of instructions. Each single instructions or block elements are terminated by ;. Block of instructions are terminated by end;. +Dynare commands are either single instructions or a block of instructions. Each single instruction and each element of a block is terminated by a semicolon (;). Blocks of instructions are terminated by end;. Most Dynare commands have arguments and several accept options, indicated in parentheses after the command keyword. - + + In the description of Dynare commands, the following conventions are observed: optional arguments or options are indicated between square brackets [] repreated arguments are indicated by ellipses ... -INTEGER indicates an integer number -DOUBLE indicates a double precision number. The following syntaxes are valid: 1.1e3, 1.1E3, 1.1d3, 1.1D3. -EXPRESSION indicates a mathematical expression valid in the underlying language (Matlab® or GNU Octave) -VARIABLE_NAME indicates a variable name starting with an alphabetical character and can't contain ()+-*/^=!;:@#. or accentuated characters -PARAMETER_NAME indicates a parameter name starting with an alphabetical charcater and can't contain ()+-*/^=!;:@#. or accentuated characters -FILENAME indicates a file name valid under your operating system (Windows®, GNU/Linux, ...) +INTEGER indicates an integer number +DOUBLE indicates a double precision number. The following syntaxes are valid: 1.1e3, 1.1E3, 1.1d3, 1.1D3 +EXPRESSION indicates a mathematical expression valid outside the model description (see ) +MODEL_EXPRESSION indicates a mathematical expression valid in the model description (see and ) +VARIABLE_NAME indicates a variable name starting with an alphabetical character and can't contain ()+-*/^=!;:@#. or accentuated characters +PARAMETER_NAME indicates a parameter name starting with an alphabetical character and can't contain ()+-*/^=!;:@#. or accentuated characters +FILENAME indicates a file name valid in the underlying operating system (Windows®, GNU/Linux, ...) @@ -398,24 +407,18 @@ In the description of Dynare commands, the following conventions are observed: var - VARIABLE_NAME + VARIABLE_NAME - - , + , + VARIABLE_NAME - - VARIABLE_NAME - - ; + ; Description -This required command declares the endogenous variables in the model. The variable names must start with a letter and can't contain the following characters : ()+-*/^=!;:@#. or accentuated characters. - - -In Gauss, setting _longname = 1 allows the use of more than 8 characters in the variable names and makes a distinction between lower and upper case letters. +This required command declares the endogenous variables in the model. See for the syntax of VARIABLE_NAME. @@ -440,13 +443,10 @@ var c gnp q1 q2; varexo - VARIABLE_NAME + VARIABLE_NAME - - , - - - VARIABLE_NAME + , + VARIABLE_NAME ; @@ -454,7 +454,7 @@ var c gnp q1 q2; Description -This optional command declares the exogenous variables in the model. See command for the syntax of VARIABLE_NAME. +This optional command declares the exogenous variables in the model. See for the syntax of VARIABLE_NAME. Exogenous variables are required if the user wants to be able to apply shocks to her model. @@ -482,23 +482,20 @@ varexo m gov; varexo_det - VARIABLE_NAME + VARIABLE_NAME - - , + , + VARIABLE_NAME - - VARIABLE_NAME - - ; + ; Description -This optional command declares exogenous deterministic variables in a stochastic model. See command for the syntax of VARIABLE_NAME. +This optional command declares exogenous deterministic variables in a stochastic model. See for the syntax of VARIABLE_NAME. -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 will compute the rational expectation solution adding future information to the state space (nothing is shown in the output of ) and will compute a simulation conditional on initial conditions and future information. +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 will compute the rational expectation solution adding future information to the state space (nothing is shown in the output of ) and will compute a simulation conditional on initial conditions and future information. @@ -524,21 +521,20 @@ varexo_det tau; parameters - PARAMETER_NAME + PARAMETER_NAME - - , + , + PARAMETER_NAME - - PARAMETER_NAME - - ; + ; Description -This optional command declares parameters used in the model, in variable initialization or in shock declarations. The parameters must then be assigned values using standard syntax of underlying matrix programming language. Be careful not to use names reserved by Dynare or the underlying language (Matlab® or GNU Octave). +This optional command declares parameters used in the model, in variable initialization or in shock declarations. See for the syntax of PARAMETER_NAME. + +The parameters must then be assigned values, see . @@ -569,7 +565,7 @@ bet = sqrt(2); dsample - reduces the number of periods considered in following output commands + reduces the number of periods considered in subsequent output commands @@ -593,10 +589,10 @@ bet = sqrt(2); Description -This command is now deprecated (but will still work for older model files). It is not necessary when no simulation is performed and is replaced by an option PERIODS in SIMUL and STOCH_SIMUL. +This command is now deprecated (but will still work for older model files). It is not necessary when no simulation is performed and is replaced by an option in and . -Set the number of periods in the simulation. The periods are numbered from 1 to INTEGER. In perfect foresight simulations, it is assumed that all future events are perfectly known at the beginning of period 1. +Sets the number of periods in the simulation. The periods are numbered from 1 to INTEGER. In perfect foresight simulations, it is assumed that all future events are perfectly known at the beginning of period 1. @@ -631,6 +627,48 @@ periods 100; +Expressions + +You can specify mathematical expression at two kinds of places in the *.mod file: inside some commands and inside the model description. These expressions are respectively represented by EXPRESSION and MODEL_EXPRESSION in this manual. + +Unlike Matlab® or Octave expressions, these expressions are necessarily scalar ones, and cannot construct or contain matricesNote that you can also put arbitrary Matlab® or Octave expressions in your *.mod file, but those expressions have to be on separate lines, generally at the end of the file for post-processing purposes. These constructions are not addresses in these section.. + +You can construct these expressions using integers (INTEGER), floating point numbers (DOUBLE), parameters, variables, operators and functions. + +Parameters and variables +Lead and lags allowed only in model expressions. + +Describe the semantic difference for endogenous/exogenous between the two kinds of expressions. + + +Operators + + +Functions +Unknown functions allowed (under some conditions) in expressions outside model block. + + + + +Initializing parameters + +The syntax is the following: + + PARAMETER_NAME = EXPRESSION; + + +Examples: + + +parameters alpha, bet; + +beta = 0.99; +alpha = 0.36; +A = 1-alpha*beta; + + + + Model declaration The model is declared inside a block. @@ -693,7 +731,7 @@ periods 100; The equations of the model are written in a block delimited by model; and end;. -There must be as many equations as there are endogenous variables in the model, except when used to compute the unconstrained optimal policy with planner_objective. The lead and lag of the variables are written in parenthesis immediately after the variable name. Leads or lags of more than one period are allowed. All the functions available in Matlab, Scilab or Gauss, respectively, are recognized. Each equation must be terminated by a semicolon (;). +There must be as many equations as there are endogenous variables in the model, except when used to compute the unconstrained optimal policy with . The lead and lag of the variables are written in parenthesis immediately after the variable name. Leads or lags of more than one period are allowed. Only some elementary functions are allowed. Each equation must be terminated by a semicolon (;). When the equations are written in homogenous form, it is possible to omit the "= 0" part and write only the left hand side of the equation. @@ -2554,7 +2592,7 @@ In Matlab, variables saved with the dynasave command can be r -Macro-processing language +Macro-processing language It is possible to use "macro" commands in the *.mod file for doing the following tasks: source file inclusion, replicating blocks of equations through loops, conditional inclusion of code... Technically, this macro language is totally independent of the basic Dynare language, and is processed by a separate component of the Dynare pre-processor. The macro processor transforms a *.mod file with macros into a *.mod file without macros (doing expansions/inclusions), and then feeds it to the Dynare parser.