DYNARE MANUAL Version 4 DYNARE MichelJuillard CEPREMAP and University Paris 8 michel.juillard@ens.fr
48 bd Jourdan 75014ParisFrance
1996, 2008 Dynare Team Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license can be found at: http://www.gnu.org/licenses/fdl.txt dynare var varexo varexo_det parameters model initval endval histval shocks periods simul check stoch_simul estimated_params estimated_params_init estimated_params_bounds varobs observation_trends estimation rplot dynasave dynatype unit_root_vars optim_weights osr osr_params forecast
Preface Dynare is a pre-processor and a collection of Matlab® and GNU Octave routines which solve, simulate and estimate non-linear models with forward looking variables. It is the result of research carried at CEPREMAP by several people (see Laffargue, 1990, Boucekkine, 1995, and Juillard, 1996, Collard and Juillard 2001a and 2001b). When the framework is deterministic, Dynare can be used for models with the assumption of perfect foresight. Typically, the system is supposed to be in a state of equilibrium before a period ``1'' when the news of a contemporaneous or of a future shock is learned by the agents in the model. The purpose of the simulation is to describe the reaction in anticipation of, then in reaction to the shock, until the system returns to the old or to a new state of equilibrium. In most models, this return to equilibrium is only an asymptotic phenomenon, which one must approximate by an horizon of simulation far enough in the future. Another exercise for which Dynare is well suited is to study the transition path to a new equilibrium following a permanent shock. For deterministic simulations, Dynare uses a Newton-type algorithm, first proposed by Laffargue (1990), instead of a first order technique like the one proposed by Fair and Taylor (1983), and used in earlier generation simulation programs. We believe this approach to be in general both faster and more robust. The details of the algorithm used in Dynare can be found in Juillard (1996). In a stochastic context, Dynare computes one or several simulations corresponding to a random draw of the shocks. Starting with version 2.3, Dynare uses a second order Taylor approximation of the expectation functions (see Judd, 1996, Collard and Juillard, 2001a, 2001b, and Schmitt-Grohe and Uribe, 2002). Starting with version 3.0, it is possible to use Dynare to estimate model parameters either by maximum likelihood as in Ireland (2004) or using a Bayesian approach as in Rabanal and Rubio-Ramirez (2002), Schorfheide (2000) or Smets and Wouters (2002). Currently the development team of Dynare is composed of S. Adjemian, M. Juillard, O. Kamenik, F. Mihoubi and S. Villemot. Several parts of Dynare use or have strongly benefited from publicly available programs by F. Collard, L. Ingber, P. Klein, M. Ratto, S. Sakata, F. Schorfheide, C. Sims, P. Soederlind and R. Wouters.
Changes
Version 4 December 26, 2006 added option mh_recover
Version 3 December 30, 2005 added details about parameter transformation in and in added conditional compilation commands and if_elseif_else_end enhanced output section of command added exogenous deterministic shocks in stochastic models. See , , , added a forecast command for calibrated models. See . October 14, 2005 added syntax for computing optimal policy. See olr, olr_inst, , , . added syntax for estimating correlation between two shocks or two measurment errors in , and July 20, 2005 Expanded description of statement 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 in added variance decomposition among the statistics computed with option in tex option in isn't yet implemented May 3, 2005 added option in modified option in modified option in March 6, 2005 corrected typos in equations for 1st and 2nd order approximation formulas in . temporarily removed description of output variables in as old content was outdated and the new one isn't ready yet. added cross-references
Introduction In order to give instructions to Dynare, the user has to write a model file whose file name must terminate by ".mod". This file contains the description of the model and the computing tasks required by the user. In practice, the handling of your model file is done in two steps: in the first one, the model and the processing instructions written by the user in a model file are interpreted and the proper Matlab® or GNU Octave instructions are generated; in the second step, the program actually runs the computations. Both steps are triggered by a single keyword: dynare. Software requirements Packaged versions of Dynare are available for Windows® 98/NT/2000/XP/Vista, Debian GNU/Linux and Ubuntu, on Intel/AMD x86 architectures. Dynare should work on other systems and architectures, but some compilation steps are necessary in that case. The Matlab® version is written for Matlab® version 6.5 and above. The Octave version is written for GNU Octave version 3.0.0 and above. Installation and configuration After installation, Dynare can be used in any directory on your computer. It is best practive to keep your model files in directories different from the one containing the Dynare toolbox. That way you can upgrade Dynare and discard the previous version without having to worry about your own files. Installation of GNU Octave You can skip this step if you are planning to use only Matlab® with Dynare. Please refer to DynareOctave on Dynare Wiki for detailed instructions. Installation of Dynare On Windows® Execute the automated installer called dynare-4.x.y-win32.exe (where 4.x.y is the version number), and follow the instructions. The default installation directory is c:\dynare\4.x.y. After installation, this directory will contain several sub-directories, among which matlab, mex and doc. The installer will also add an entry in your Start Menu with a shortcut to documentation files and to the uninstaller. You can have several versions of Dynare coexisting (for example in c:\dynare), as long as you correctly adjust your path settings (see ). Note that no installer is currently avaible for Windows® on 64 bits platforms. For the time being, please follow the instructions given in if you have such a system. On Debian GNU/Linux and Ubuntu Please refer to InstallOnDebianOrUbuntu on Dynare Wiki for detailed instructions. Dynare will be installed under /usr/lib/dynare. Documentation will be under /usr/share/doc/dynare. For other systems You need to download Dynare source code from the Dynare website and unpack it somewhere. Then you will need to recompile the pre-processor and the dynamic loadable libraries. Please refer to BuildingPreprocessor and BuildingDlls on Dynare Wiki. Configuration For Matlab® You need to add the matlab subdirectory of your Dynare installation to Matlab® path. You have two options for doing that: Using the addpath command in the Matlab® command window: Under Windows®, assuming that you have installed Dynare at the standard location, and replacing "4.x.y" by correct version number, type: addpath c:\dynare\4.x.y\matlab Under Debian GNU/Linux or Ubuntu, type: addpath /usr/lib/dynare/matlab Matlab® will not remember this setting next time you run it, and you will have to do it again. Via the menu entries: Select the "Set Path" entry in the "File" menu, then click on "Add Folder...", and select the matlab subdirectory of your Dynare installation. Note that you SHOULD NOT use "Add with Subfolders...". Apply the settings by clicking on "Save". Note that Matlab will remember this setting next time you run it. For GNU Octave You need to add the matlab subdirectory of your Dynare installation to Octave path, using the addpath at the Octave command prompt. Under Windows®, assuming that you have installed Dynare at the standard location, and replacing "4.x.y" by correct version number, type: addpath c:\dynare\4.x.y\matlab Under Debian GNU/Linux or Ubuntu, type: addpath /usr/lib/dynare/matlab You will also want to tell to Octave to accept the short syntax (without parentheses and quotes) for the dynare command, by typing: mark_as_command dynare If you don't want to type these two commands every time you run Octave, you can put them in a file called .octaverc in your home directory (under Windows® this will generally by c:\Document and Settings\USERNAME\). This file is run by Octave at every startup. Some words of warning You should be very careful about the content of you Matlab® or Octave path. You can display its content by simply typing path in the command window. The path should normally contain system directories of Matlab® or Octave, and the matlab subdirectory of your Dynare installation. It should not contain any other Dynare-related directory, from another Dynare version of from the version you are using. However, note that Dynare will automatically add one (and only one) of the mex/2007a, mex/2007b, and mex/octave subdirectories, depending on your installation. You have to be aware that adding other directories to your path can potentially create problems, if some of your M-files have the same names than Dynare files. Your files would then override Dynare files, and make Dynare unusable. Dynare invocation You invoke Dynare by using the dynare at the Matlab® or Octave prompt. dynare dynare executes Dynare dynare FILENAME[.mod] Description dynare executes instruction included in FILENAME.mod. This user-supplied file contains the model and the processing instructions, as described in . Details 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: 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 Depending on the computing tasks requested in the *.mod file, executing command dynare will leave in the workspace variables containing results available for further processing. More details are given under the relevant computing tasks. The oo_ structure is also saved in a file called FILENAME_results.mat. Examples dynare ramst dynare ramst.mod savemacro The Model file 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 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, ...) Variable declarations Declarations of variables and parameters are made with the following commands: var var declares endogenous variables var VARIABLE_NAME , VARIABLE_NAME ; Description This required command declares the endogenous variables in the model. See for the syntax of VARIABLE_NAME. Example var c gnp q1 q2; varexo varexo declares exogenous variables varexo VARIABLE_NAME , VARIABLE_NAME ; Description 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. Example varexo m gov; varexo_det varexo_det declares exogenous deterministic variables in a stochastic model varexo_det VARIABLE_NAME , VARIABLE_NAME ; Description 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. Example varexo m gov; varexo_det tau; parameters parameters declares parameters parameters PARAMETER_NAME , PARAMETER_NAME ; Description 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 . Example parameters alpha, bet; alpha = 0.3; bet = sqrt(2); Other general declarations (deprecated) dsample dsample reduces the number of periods considered in subsequent output commands periods periods specifies the number of simulation periods periods INTEGER; 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 in and . 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. Example periods 100; cutoff cutoff declares the cutoff for fast deterministic simulations markowitz markowitz declares the markowitz criterion for fast deterministic simulations 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. model model declares the model equations model (linear) ; MATLAB EXPRESSION; MATLAB EXPRESSION; end; EQUATION; EQUATION; end; #EXPRESSION = #EXPRESSION ; EXPRESSION = EXPRESSION ; Description 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 . 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. It is possible to include arbitrary Matlab expressions in a model. It must be preceeded by a pound sign (#) as the first character of the line. This is particularily usefull to declare tansformation of parameters for estimation purpose (see ). The option linear declares the model as being linear. It avoids to have to declare initial values for computing the steady state and it sets automatically order=1 in stoch_simul. Example 1 model; c = - k + aa*x*k(-1)^alph + (1-delt)*k(-1); c^(-gam) = (aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam)/(1+bet); end; Example 2 model; c + k - aa*x*k(-1)^alph - (1-delt)*k(-1); c^(-gam) - (aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam)/(1+bet); end; Example 3 model(linear); # b = 1/c; x = a*x(-1)+b*y(+1)+e_x; y = d*y(-1)+e_y; end; Initial and terminal conditions In many contexts, it is necessary to compute the steady state of a non-linear model specifies then numerical initial values for the non-linear solver. Used in perfect foresight mode, the types of forward-loking models for which Dynare was designed require both initial and terminal conditions. Most often these initial and terminal conditions are static equilibria, but not necessarily. One typical application is to consider an economy at the equilibrium, trigger a shock in first period, and study the trajectory of return at the initial equilbrium. To do that, one needs and (see next section). Another one is to study, how an economy, starting from arbitrary initial conditions converges toward equilibrium. To do that, one needs and ; For models with lags on more than one period, the command permits to specify different historical initial values in different periods. initval initval specifies numerical starting values for finding the steady state and/or initial values for simulations initval; VARIABLE_NAME = EXPRESSION; VARIABLE_NAME = EXPRESSION; end; Description EXPRESSION is any valid expression returning a numerical value and can contain already initialized variable names. The initval; ... end; block serves two purposes. It set the initial and, possibly, terminal conditions for the simulation and provides numerical initialization for various computation tasks (, , ). Theoreticaly, initial conditions are only necessary for lagged variables. However, as initval provides also numerical initialization, it is necessary to provide values for all variables in the model, except if the model is declared as linear. For stochastic models, it isn't necessary to delcare 0 as initial values for exogneous stochastic variables as it is the only possible value. When the initval block is followed by the command , it is not necessary to provide exact initialization values for the endogenous variables. will use the values provided in the initval block as initial guess in the non-linear equation solver and computes exact values for the endogenous variables at the steady state. The steady state is defined by keeping constant the value of the exogenous variables. Example initval; c = 1.2; k = 12; x = 1; end; steady; initval_file initval_file use an external file for specifying initial values (for steady-state computation or for simulations) endval endval specifies terminal values for deterministic simulations endval; VARIABLE_NAME = EXPRESSION; VARIABLE_NAME = EXPRESSION; end; Description EXPRESSION is any valid expression returning a numerical value and can contain already initialized variable names. The optional endval; ... end; block serves two purposes. It set the terminal conditions for the simulation with the LBJ alogrithm, when those differ from the initial conditions. When it is the case, the endval block also provides the numerical initialization for various computation tasks (, ), starting in period 1. Theoreticaly, terminal conditions are required in the LBJ algorithm only for forward variables. However, as endval provides also numerical initialization, it is necessary to provide values for all variables in the model. When the endval block is followed by the command , it is not necessary to provide exact values for the endogenous variables. will use the values provided in the endval block as initial guess in the non-linear equation solver and computes exact values for the endogenous variables at the steady state. The steady state is defined by keeping constant the value of the exogenous variables. Example var c k; varexo x; ... initval; c = 1.2; k = 12; x = 1; end; steady; endval; c = 2; k = 20; x = 2; end; steady; The initial equilibrium is comptuted by for x=1, and the terminal one, for x=2. histval histval specifies historical values before the start of a simulation histval; VARIABLE_NAME (INTEGER) = EXPRESSION; VARIABLE_NAME (INTEGER) = EXPRESSION; end; Description EXPRESSION is any valid expression returning a numerical value and can contain already initialized variable names. In models with lags on more than one period, the optional histval; ... end; block permits to specify different historical initial values for different periods. By convention in Dynare, period 1 is the first period of the simulation. Going backward in time, the first period before the start of the simulation is period 0, then period -1, and so on. If your lagged variables are linked by identities, be careful to satisfy these identities when you set historical initial values. Example var x y; varexo e; model; x = y(-1)^alpha*y(-2)^(1-alpha)+e; ... end; initval; x = 1; y = 1; e = 0.5; end; steady; histval; y(0) = 1.1; y(-1) = 0.9; end; Shocks on exogenous variables In a deterministic context, when one wants to study the transition of one equilibrium position to another, it is equivalent to analyze the consequences of a permanent shock and this in done in Dynare through the proper use of and . Another typical experiment is to study the effects of a temporary shock after which the system goes back to the original equilibrium (if the model is stable ...). A temporary shock is a temporary change of value of one or several exogenous variables in the model. Temporary shocks are specified with the command . In a stochastic framework, the exogenous variables take random values in each period. In Dynare, these random values follow a normal distribution with zero mean, but it belongs to the user to specify the variability of these shocks. The non-zero elements of the matrix of variance-covariance of the shocks can be entered with the command. Or, the entire matrix can be direclty entered with . Note that, starting with version 2.5.2, the direct specification of the internal matrix Sigma_e_, prone to errors, is discouraged. If the variance of an exogenous variable is set to zero, this variable will appear in the report on policy and transition functions, but isn't used in the computation of moments and of Impulse Response Functions. Setting a variance to zero is an easy way of removing an exogenous shock. (deprecated) shocks shocks specifies shocks on deterministic or stochastic exogenous variables shocks (OPTION,); DETERMINISTIC SHOCK STATEMENT STOCHASTIC SHOCK STATEMENT DETERMINISTIC SHOCK STATEMENT STOCHASTIC SHOCK STATEMENT end; var VARIABLE_NAME; periods PERIOD STATEMENT; values EXPRESSION; INTEGER : INTEGER INTEGER : INTEGER ; VARIANCE STATEMENT COVARIANCE STATEMENT STANDARD ERROR STATEMENT var VARIABLE_NAME = EXPRESSION; var VARIABLE_NAME , VARIABLE_NAME = EXPRESSION; var VARIABLE_NAME; stderr EXPRESSION; Options shocks_file = FILENAME: reads sequence of deterministic shocks from FILENAME. It can be either a *.m or a *.mat file. The file must create vectors with the same names as the deterministic exogenous variables. Description In deterministic context For deterministic simulations, the shocks block specifies temporary changes in the value of an exogenous variables. For permanent shocks, use an block. When specifying shocks on several periods, the values EXPRESSION must return either a scalar value common to all periods with a shock or a column vector with as many elements as there are periods in the periods statement just before it. Example shocks; var e; periods 1; values 0.5; var u; periods 4:5; values 0; var v; periods 4 5 6; values 0; var u; periods 4 5 6; values 1 1.1 0.9; end; In stochastic context For stochastic simulations (available only in the Matlab or Scilab versions), the shocks block specifies the non zero elements of the covariance matrix of the shocks. Example shocks; var e = 0.000081; var e,u = phi*0.009*0.009; var u = 0.000081; var v; stderr 0.009; end; See also Sigma_e Mixing determininistic and stochastic shocks 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. Example varexo_det tau; varexo e; ... shocks; var e; stderr 0.01; var tau; periods 1:9; values -0.15; end; stoch_simul(irf=0); forecast; mshocks mshocks specifies multiplicative shocks on deterministic or stochastic exogenous variables Sigma_e Sigma_e specifies directly the covariance matrix of the stochastic shocks Sigma_e = [MATRIX ELEMENT ,MATRIX ELEMENT ;MATRIX ELEMENT]; INTEGER DOUBLE (EXPRESSION) WARNING: the matrix elements are actually written beween square brackets ([]). Here, the initial [ and final ] don't have the meaning of "optional element" as elsewhere. Description The matrix of variance-covariance of the shocks can be directly specified as a upper (or lower) triangular matrix. Dynare builds the corresponding symmetrix matrix. Each row of the triangular matrix, except the last one, must be terminated by a semi-colon ';'. For a given element, an EXPRESSION using predefined parameters is allowed but must be placed between parentheses. THE ORDER OF THE COVARIANCES IN THE MATRIX IS THE SAME AS THE ONE USED IN THE VAREXO DECLARATION. In previous versions, it was possible to directly set Dynare's internal covariance matrix Sigma_e_. This is still possible for compatibility with older .mod files, but STRONGLY DISCOURAGED as too prone to error. When setting Sigma_e_ directly, the order of the exogenous shocks is the ALPHABETICAL order of their names. Example varexo u, e; ... Sigma_e = [ 0.81 (phi*0.9*0.009); 0.000081]; where the variance of u is 0.81, the variance of e, 0.000081, and the correlation between e and u is phi. Solving and simulating Dynare has special commands for the computation of the static equilibrium of the model (, of the eigenvalues of the linearized model () for dynamics local analysis, of a deterministic simulation () and for solving and/or simulating a stochastic model (). steady steady copmutes the steady state of a model steady (solve_algo = 0 1 2 ) ; Options solve_algo = 0: uses Matlab Optimization Toolbox FSOLVE solve_algo = 1: uses Dynare's own nonlinear equation solver solve_algo = 2: splits the model into recursive blocks and solves each block in turn. (Thanks to Manfred Gilli for showing me Matlab's function DMPERM) (this is the default since Dynare version 3.046). Description Computes the equilibrium value of the endogenous variables for the value of the exogenous variables specified in the previous or block. steady uses an iterative procedure and takes as initial guess the value of the endogenous variables set in the previous or block. For complicated models, finding good numerical initial values for the endogenous variables is the trickiest part of finding the equilibrium of that model. Often, it is better to start with a smaller model and add new variables one by one. If you know how to compute the steady state for your model, you can provide a Matlab function doing the computation instead of using steady. The function should be called with the name of the .mod file followed by _steadystate. See fs2000a_steadystate.m in examples/fs2000 directory. Output variables The steeady state is available in ys_. Endogenous variables are ordered alphabeticaly as in lgy_. Examples See and . homotopy_setup homotopy_setup instructs to use homotopy methods check check computes the eigenvalues of the (linearized) model check ; Description Computes the eigenvalues of the model linearized around the values specified by the last , or statement. Generally, the eigenvalues are only meaningfull if the linearization is done around a steady state of the model. It is a device for local analysis in the neighborhood of this steady state. A necessary condition for the uniqueness of a stable equilibrium in the neighborhood of the steady state is that there are as many eigenvalues larger than one in modulus as there are forward looking variables in the system. An additional rank condition requires that the square submatrix of the right Schur vectors corresponding to the forward looking variables (jumpers) and to the explosive eigenvalues must have full rank. Output variables check returns the eigenvalues in the global variable eigenvalues_. forecast forecast computes a simulation of a stochastic model from a given state forecast (OPTION,) VARIABLE_NAME VARIABLE_NAME ; Options periods = INTEGER: number of periods of the forecast (default = 40) conf_sig = DOUBLE: level of significance for confidence interval (default = 0.90) Description forecast computes a simulation of a stochastic model from an arbitrary initial point. When the model also contains deterministic exogenous shocks, the simulation is computed conditionaly to the agents knowing the future values of the deterministic exogenous variables. forecast must be called after . forecast plots the trajectory of endogenous variables. When a list of variable names follows the command, only those variables are ploted. A 90% confidence interval is ploted around the mean trajectory. Use option conf_sig to change the level of the confidence interval. Output variables The following variables are set in structure oo_: oo_.forecast.Mean.VARIABLE NAME: mean forecast of endogenous variables oo_.forecast.HPDinf.VARIABLE NAME: lower bound of a confidence interval around the forecast oo_.forecast.HPDsup.VARIABLE NAME: upper bound of a confidence interval around the forecast oo_.forecast.Exogenous.VARIABLE NAME: trajectory of the deterministic exogenous variables Example varexo_det tau; varexo e; ... shocks; var e; stderr 0.01; var tau; periods 1:9; values -0.15; end; stoch_simul(irf=0); forecast; simul simul simulates a deterministic model simul (periods=INTEGER) ; Description Triggers the computation of a deterministic simulation of the model for the number of periods set in the option periods=. simul uses a Newton method to solve simultaneously all the equations for every period (see Juillard, 1996). Output variables the simulated variables are available in global matrix y_. The variables are arranged row by row, in alphabetical order. stoch_simul stoch_simul computes the solution and simulates the model stoch_simul (OPTION,) VARIABLE_NAME VARIABLE_NAME ; Options ar = INTEGER: Order of autocorrelation coefficients to compute and to print (default = 5) n dr_algo = 0 | 1: specifies the algorithm used for computing the quadratic approximation of the decision rules: 0: uses a pure perturbation approach as in Schmitt-Grohe and Uribe (2002) (default) 1: moves the point around which the Taylor expansion is computed toward the means of the distribution as in Collard and Juillard (2001) drop = INTEGER: number of points dropped at the beginning of simulation before computing the summary statistics (default = 100) hp_filter = INTEGER: uses HP filter with lambda = INTEGER before computing moments (default: no filter) hp_ngrid = INTEGER: number of points in the grid for the discreet Inverse Fast Fourier Transform used in the HP filter computation. It may be necessary to increase it for highly autocorrelated processes (default = 512) irf = INTEGER: number of periods on which to compute the IRFs (default = 40). Setting IRF=0, suppresses the plotting of IRF's. relative_irf requests the computation of normalized IRFs in percentage of the standard error of each shock linear: indicates that the original model is linear (put it rather in the MODEL command). nocorr: doesn't print the correlation matrix (printing them is the default) nofunctions: doesn't print the coefficients of the approximated solution (printing them is the default) nomoments: doesn't print moments of the endogenous variables (printing them is the default) noprint: cancel any printing. Usefull for loops. order = 1 | 2 : order of Taylor approximation (default = 2) periods = INTEGER: specifies the number of periods to use in simulations. At order=1, no simulation is necessary to compute theoretical moments and IRFs. A number of periods larger than one triggers automatically option simul (default = 0). qz_criterium = INTEGER | DOUBLE: value used to split stable from unstable eigenvalues in reordering the Generalized Schur decomposition used for solving 1st order problems (default 1.000001) replic = INTEGER: number of simulated series used to compute the IRFs (default = 1, if order = 1, and 50 otherwise) simul: computes a stochastic simulation of the model for the number of periods specified in the periods statement. Uses values, possibly recomputed by , as initial values for the simulation. The simulated endogenous variables are made available to the user in a vector for each variable and in the global matrix y_. The variables are ordered alphabeticaly in the y_ matrix (default: no simulation) simul_seed = INTEGER|DOUBLE|(EXPRESSION): specifies a seed for the random generator so as to obtain the same random sample at each run of the program. Otherwise a different sample is used for each run (default: seed not specified). Note that if you use an EXPRESSION rather than an INTEGER or a DOUBLE, the EXPRESSION must be in parenthesis. all steady options (see ) When a list of VARIABLE_NAMEs is specified, results are displayed only for these variables. Description stoch_simul computes a Taylor approximation of the decision and transition functions for the model, impulse response functions and various descriptive statistics (moments, variance decomposition, correlation and autocorrelation coefficients). For correlated shocks, the variance decomposition is computed as in the VAR literature through a Cholesky decomposition of the covariance matrix of the exogenous variables. When the shocks are correlated, the variance decomposition depends upon the order of the variables in the command. The Taylor approximation is computed around the steady state (except whith option dr_algo=1). If you know how to compute the steady state for your model, you can provide a Matlab function doing the computation instead of using the nonlinear solver. The function should be called with the name of the .mod file followed by _steadystate. See fs2000a_steadystate.m in examples/fs2000 directory. Variance decomposition, correlation, autocorrelation are only displayed for variables with positive variance. Impulse response functions are only ploted for variables with response larger than 1e-10. Currently, the IRF's are only ploted for 12 variables. Select the ones you want to see, if your model contains more than 12 endogenous variables. Currently, the HP filter is only available when computing theoretical moments, not for for moments of simulated variables. The covariance matrix of the shocks is specified either with the command or with the command. Decision rules The approximated solution of a model takes the form of a set of decision rules or transition equations expressing the current value of the endogenous variables of the model as function of the previous state of the model and shocks oberved at the beginning of the period. First order approximation
yt = ys + A yht-1 + B ut where ys is the steady state value of y and yht=yt-ys.
Second order approximation
yt = ys + 0.5Δ2 + A yht-1 + B ut + 0.5C(yht-1⊗yht-1) + 0.5D(ut⊗ut) + E(yht-1⊗ut) where ys is the steady state value of y, yht=yt-ys, and Δ2 is the shift effect of the variance of future shocks.
Output variables stoch_simul sets several fields in global variable oo_. The descriptive statistics are theoretical moments when no simulation is requested and otherwise represent the moments of the simulated variables. the coefficients of the decision rules are stored in global structuredr_. Here is the correspondance with the symbols used in the above description of the decision rules: Decision rule coefficients ys: dr_.ys. The vector rows correspond to variables in alphabetical order of the variable names. Δ2: dr_.ghs2. The vector rows correspond to re-ordered variables (see below). A: dr_.ghx. The matrix rows correspond to re-ordered variables. The matrix columns correspond to state variables (see below). B: dr_.ghu. The matrix rows correspond to re-ordered variables (see below). The matrix columns correspond to exogenous variables in alphabetical order. C: dr_.ghxx. The matrix rows correspond to re-ordered variables. The matrix columns correspond to the Kronecker product of the vector of state variables (see below). D: dr_.ghuu. The matrix rows correspond to re-ordered variables (see below). The matrix columns correspond to the Kronecker product of exogenous variables in alphabetical order. E: dr_.ghxu. The matrix rows correspond to re-ordered variables. The matrix columns correspond to the Kronecker product of the vector of state variables (see below) by the vector of exogenous variables in alphabetical order. When reordered, the variables are stored in the following order: static variables, purely predetermined variables (variables that appear only at the current and lagged periods in the model), variables that are both predetermined and forward-looking (variables that appear at the current, future and lagged periods in the model), purely forward-looking variables (variables that appear only at the current and future periods in the model). In each category, the variables are arranged alphabetically. The state variables of the model are purely predetermined variables and variables that are both predetermined and forward-looking. They are ordered in that order. When there are lags on more than one period, the state variables are ordered first according to their lag: first variables from the previous period, then variables from two periods before and so on. Note also that when a variable appears in the model at a lag larger than one period, it is automatically included at all inferior lags. The mean of the endogenous variables is available in the vector oo_.mean. The variables are arranged in alphabetical order. The matrix of variance-covariance of the endogenous variables in the matrix oo_.var. The variables are arranged in alphabetical order. The matrix of autocorrelation of the endogenous variables are made available in cell array oo_.autocorr. The element number of the matrix in the cell array corresponds to the order of autocorrelation. The option AR (default ar=5) specifies the number of autocorrelation matrices available. Simulated variables, when they have been computed, are available in Matlab vectors with the same name as the endogenous variables. Impulse responses, when they have been computed, are available in Matlab vectors witht the following naming convention VARIABLE_NAME_shock name. gnp_ea contains the effect on gnp of a one standard deviation shock on ea. Example 1 shocks; var e; stderr 0.0348; end; stoch_simul; performs the simulation of the 2nd order approximation of a model with a single stochastic shock, e, with a standard error of 0.0348. Example 2 stoch_simul(linear,irf=60) y k; performs the simulation of a linear model and displays impulse response functions on 60 periods for variables y and k.
Estimation Provided that you have observations on some endogenous variables, it is possible to use Dynare to estimate some or all parameters. Both maximum likelihood and Bayesian techniques are available. Note that in order to avoid stochastic singularity, you must have at least as many shocks or measurement errors in your model as you have observed variables. varobs varobs lists the observed variables varobs VARIABLE_NAME VARIABLE_NAME ; Description varobs lists the name of observed endogenous variables for the estimation procedure. These variables must be available in the data file (see ). Example varobs C y rr; observation_trends observation_trends specifies linear trends for observed variables observation_trends; VARIABLE_NAME (EXPRESSION); end; Description observation_trends specifies trends for observed variables as functions of model parameters. In most cases, variables shouldn't be centered when observation_trends is used. Example observation_trends; Y (eta); P (mu/eta); end; estimated_params estimated_params specifies the estimated parameters and their prior Syntax I (maximum likelihood estimation) estimated_params; stderr VARIABLE_NAME corr VARIABLE_NAME_1, VARIABLE_NAME_2 PARAMETER_NAME , INITIAL_VALUE , LOWER_BOUND , UPPER_BOUND ; ... end; Syntax II (Bayesian estimation) estimated_params; stderr VARIABLE_NAME corr VARIABLE_NAME_1, VARIABLE_NAME_2 PARAMETER_NAME , PRIOR_SHAPE , PRIOR_MEAN , PRIOR_STANDARD_ERROR , PRIOR_3RD_PARAMETER , PRIOR_4TH_PARAMETER , SCALE_PARAMETER ; ... end; Description The estimated_params;....end; block lists all parameters to be estimated and specifies bounds and priors as necessary. Estimated parameter specification Each line corresponds to an estimated parameter and follows this syntax: stderr is a keyword indicating that the standard error of the exogenous variable, VARIABLE_NAME, or of the observation error associated with endogenous observed variable, VARIABLE_NAME, is to be estimated corr is a keyword indicating that the correlation between the exogenous variables, VARIABLE_NAME_1 and VARIABLE_NAME_2, or the correlation of the observation errors associated with endogenous observed variables, VARIABLE_NAME_1 and VARIABLE_NAME_2, is to be estimated PARAMETER_NAME is the name of a model parameter to be estimated INITIAL_VALUE specifies a starting value for maximum likelihood estimation LOWER_BOUND specifies a lower bound for the parameter value in maximum likelihood estimation UPPER_BOUND specifies an upper bound for the parameter value in maximum likelihood estimation PRIOR_SHAPE is prior density among beta_pdf, gamma_pdf, normal_pdf, inv_gamma_pdf, inv_gamma1_pdf, inv_gamma2_pdf, uniform_pdf PRIOR_MEAN is the mean of the prior distribution PRIOR_STANDARD_ERROR is the standard error of the prior distribution PRIOR_3RD_PARAMETER is a third parameter of the prior used for generalized beta distribution, generalized gamma and for the uniform distribution (default 0) PRIOR_4TH_PARAMETER is a fourth parameter of the prior used for generalized beta distribution, generalized gamma and for the uniform distribution (default 1) SCALE_PARAMETER is the scale parameter to be used for the jump distribution of the Metropolis-Hasting algorithm At minimum, one must specify the name of the parameter and an initial guess. That will trigger unconstrained maximum likelihood estimation. As one uses options more towards the end of the list, all previous options must be filled: if you want to specify jscale, you must specify prior_p3 and prior_p4. Use default values, if these parameters don't apply. Parameter transformation Sometimes, it is desirable to estimate a transformation of a parameter appearing in the model, rather than the parameter itself. It is of course possible to replace the original parameter by a function of the estimated parameter everywhere is the model, but it is often unpractical. In such a case, it is possible to declare the parameter to be estimated in the statement and to define the transformation at the top of the section, as a Matlab expression. The first character of the line must be a pound sign (#). Example parameters bet; model; # sig = 1/bet; c = sig*c(+1)*mpk; end; estimated_params; bet,normal_pdf,1,0.05; end; estimated_params_init estimated_params_init specifies initial values for optimization estimated_params_init; stderr VARIABLE_NAME corr VARIABLE_NAME_1, VARIABLE_NAME_2 PARAMETER_NAME , INITIAL_VALUE ; ... end; Description The estimated_params_init;....end; block declares numerical initial values for the optimizer when these ones are different from the prior mean Estimated parameter initial value specification Each line corresponds to an estimated parameter and follows this syntax: stderr is a keyword indicating that the standard error of the exogenous variable, VARIABLE_NAME, or of the observation error associated with endogenous observed variable, VARIABLE_NAME, is to be estimated corr is a keyword indicating that the correlation between the exogenous variables, VARIABLE_NAME_1 and VARIABLE_NAME_2, or the correlation of the observation errors associated with endogenous observed variables, VARIABLE_NAME_1 and VARIABLE_NAME_2, is to be estimated PARAMETER_NAME is the name of a model parameter to be estimated INITIAL_VALUE specifies a starting value for maximum likelihood estimation estimated_params_bounds estimated_params_bounds specifies lower and upper bounds for the estimated parameters estimated_params_bounds; stderr VARIABLE_NAME corr VARIABLE_NAME_1, VARIABLE_NAME_2 PARAMETER_NAME , LOWER_BOUND , UPPER_BOUND ; ... end; Description The estimated_params;....end; block lists all parameter to be estimated and specifies bounds and priors when required. Estimated parameter specification Each line corresponds to an estimated parameter and follows this syntax: stderr is a keyword indicating that the standard error of the exogenous variable, VARIABLE_NAME, or of the observation error associated with endogenous observed variable, VARIABLE_NAME, is to be estimated corr is a keyword indicating that the correlation between the exogenous variables, VARIABLE_NAME_1 and VARIABLE_NAME_2, or the correlation of the observation errors associated with endogenous observed variables, VARIABLE_NAME_1 and VARIABLE_NAME_2, is to be estimated PARAMETER_NAME is the name of a model parameter to be estimated LOWER_BOUND specifies a lower bound for the parameter value in maximum likelihood estimation UPPER_BOUND specifies an upper bound for the parameter value in maximum likelihood estimation estimation estimation computes estimation. estimation (OPTIONS) ; OPTIONS datafile = FILENAME: the datafile (a .m file, a .mat file or a .xls file) xls_sheet = NAME: the name of the sheet with the data in an Excel file xls_range = RANGE: the range with the data in an Excel file nobs = INTEGER: the number of observations to be used (default: all observations in the file) nobs = ([INTEGER_1:INTEGER_2]): runs a recursive estimation and forecast for samples of size ranging of INTEGER_1 to INTEGER_2. Option FORECAST must also be specified. first_obs = INTEGER: the number of the first observation to be used (default = 1) prefilter = 1: the estimation procedure demeans the data (default=0, no prefiltering) presample = INTEGER: the number of observations to be skipped before evaluating the likelihood (default = 0) loglinear: computes a log--linear approximation of the model instead of a linear (default) approximation. The data must correspond to the definition of the variables used in the modelx. nograph: no graphs should be plotted lik_init: INTEGER: type of initialization of Kalman filter. 1 (default): for stationary models, the initial matrix of variance of the error of forecast is set equal to the unconditional variance of the state variables. 2: for nonstationary models: a wide prior is used with an initial matrix of variance of the error of forecast diagonal with 10 on the diagonal. conf_sig = {INTEGER | DOUBLE}: the level for the confidence intervals reported in the results (default = 0.90) mh_replic = INTEGER: number of replication for Metropolis Hasting algorithm. For the time being, mh_replic should be larger than 1200 (default = 20000.) mh_nblocks = INTEGER: number of paralletl chains for Metropolis Hasting algorithm (default = 2). mh_drop = DOUBLE: the fraction of initially generated parameter vectors to be dropped before using posterior simulations (default = 0.5) mh_jscale = DOUBLE: the scale to be used for the jumping distribution in MH algorithm. The default value is rarely satisfactory. This option must be tune to obtain, ideally, an accpetation rate of 25% in the Metropolis-Hastings algorithm (default = 0.2). mh_init_scale=DOUBLE: the scale to be used for drawing the initial value of the Metropolis-Hastings chain (default=2*mh_scale). mh_recover attempts to recover a Metropolis simulation that crashed prematurely. Shouldn't be used together with load_mh_file mode_file=FILENAME: name of the file containing previous value for the mode. When computing the mode, Dynare stores the mode (xparam1) and the hessian (hh) in a file called MODEL NAME_mode. mode_compute=INTEGER: specifies the optimizer for the mode computation. 0: the mode isn't computed. mode_file must be specified 1: uses Matlab fmincon. 2: uses Lester Ingber's Adaptive Simulated Annealing. 3: uses Matlab fminunc. 4 (default): uses Chris Sim's csminwel. mode_check: when mode_check is set, Dynare plots the posterior density for values around the computed mode for each estimated parameter in turn. This is helpful to diagnose problems with the optimizer. prior_trunc=DOUBLE: probability of extreme values of the prior density that is ignored when computing bounds for the parameters (default=1e-32). load_mh_file: when load_mh_file is declared, Dynare adds to previous Metropolis-Hastings simulations instead of starting from scratch. Shouldn't be used together with mh_recover. optim=(fmincon options): can be used to set options for fmincon, the optimizing function of Matlab Optimizaiton toolbox. Use Matlab syntax for these options (default: ('display','iter','LargeScale','off','MaxFunEvals',100000,'TolFun',1e-8,'TolX',1e-6)) nodiagnostic: doesn't compute the convergence diagnostics for Metropolis (default: diagnostics are computed and displayed). bayesian_irf triggers the computation of the posterior distribution of IRFs. The length of the IRFs are controlled by the irf option moments_varendo triggers the computation of the posterior distribution of the theoretical moments of the endogenous variables filtered_vars triggers the computation of the posterior distribution of filtered endogenous variables and shocks smoother triggers the computation of the posterior distribution of smoothered endogenous variables and shocks forecast = INTEGER computes the posterior distribution of a forecast on INTEGER periods after the end of the sample used in estimation tex requests the printing of results and graphs in TeX tables and graphics that can be later directly included in Latex files (not yet implemented) All options for If no mh_jscale parameter is used in estimated_params, the procedure uses mh_jscale for all parameters. If mh_jscale option isn't set, the procedure uses 0.2 for all parameters. Results results from posterior optimization (also for maximum likelihood) marginal log density mean and shortest confidence interval from posterior simulation Metropolis-Hastings convergence graphs that still need to be documented graphs with prior, posterior and mode graphs of smoothed shocks, smoothed observation errors, smoothed and historical variables Output After running estimation, the parameters and the variance matrix of the shocks are set to the mode for maximum likelihood estimation or posterior mode computation without Metropolis iterations. After estimation with Metropolis iterations (option mh_replic > 0 or option load_mh_file set) the parameters and the variance matrix of the shocks are set to the posterior mean. Depending on the options, estimation stores results in the following fields of structure oo_: Content of <varname>oo_</varname> Field 1Field 2Field 3Field 4Field 5Required optionsForecastSee Variable nameMarginalDensityLaplaceApproximationAlways providedModifiedHarmonicMeanmh_replic> 0 or load_mh_filePosteriorFilteredVariablesSee Variable namefiltered_varsPosteriorIRFDsgeSee IRF name: name of endogenous variable '_' name of shockbayesian_irfPosteriorSmoothedObservationErrorsSee Variable namePosteriorSmoothedShocksSee Variable namePosteriorSmoothedVariablesSee Variable namePosteriorTheoreticalMomentsSee See See Variable namemoments_varendoposterior_densityParameter namemh_replic> 0 or load_mh_fileposterior_hpdinfSee Variable namemh_replic> 0 or load_mh_fileposterior_hpdsupSee Variable namemh_replic> 0 or load_mh_fileposterior_meanSee Variable namemh_replic> 0 or load_mh_fileposterior_modeSee Variable namemh_replic> 0 or load_mh_fileposterior_stdSee Variable namemh_replic> 0 or load_mh_file
Moments of forecasts Field nameDescriptionHPDinfLower bound of a 90% HPD intervalSee option conf_sig to change the size of the HPD interval of forecast due to parameter uncertaintyHPDsupLower bound of a 90% HPD interval due to parameter uncertaintyHPDTotalinfLower bound of a 90% HPD interval of forecast due to parameter uncertainty and future shocksHPDTotalsupLower bound of a 90% HPD interval due to parameter uncertainty and future shocksMeanMean of the posterior distribution of forecastsMedianMedian of the posterior distribution of forecastsStd Standard deviation of the posterior distribution of forecasts
Moments Names Field nameDescriptionHPDinfLower bound of a 90% HPD intervalSee option conf_sig to change the size of the HPD intervalHPDsupUpper bound of a 90% HPD interval MeanMean of the posterior distributionMedianMedian of the posterior distributionStd Standard deviation of the posterior distribution
Theoretical Moments Field nameDescriptionAutocorrelationAutocorrelation of endogenous variablesThe autocorrlation coefficients are computed for the number of periods specified in option .CorrelationCorrelation between two endogenous variablesDecompDecomposition of varianceWhen the shocks are correlated, it is the decomposition of orthogonalized shocks via Cholesky decompostion according to the order of declaration of shocks (see ). ExpectationExpectation of endogenous variablesVariance(co-)variance of endogenous variables
Estimated objects Field nameDescriptionmeasurement_errors_corrCorrelation between two measurement errorsmeasurement_errors_stdStandard deviation of measurement errorsparametersParametersshocks_corrCorrelation between two structural shocksshocks_stdStandard deviation of structural shocks
Examples oo_.posterior_mode.parameters.alp oo_.posterior_mean.shocks_std.ex oo_.posterior_hpdsup.measurement_errors_corr.gdp_conso
Note on steady state computation If you know how to compute the steady state for your model, you can provide a Matlab function doing the computation instead of using steady. The function should be called with the name of the .mod file followed by _steadystate. See fs2000a_steadystate.m in examples/fs2000 directory.
prior_analysis prior_analysis Prior distribution analysis posterior_analysis posterior_analysis Posterior distribution analysis unit_root_vars unit_root_vars declares unit-root variables for estimation unit_root_vars VARIABLE_NAME VARIABLE_NAME ; Description unit_root_vars is used to declare unit-root variables of a model so that a diffuse prior can be used in the initialization of the Kalman filter for these variables only. For stationary variables, the unconditional covariance matrix of these variables is used for initialization. The algorithm to compute a true diffuse prior is taken from Durbin and Koopman (2001, 2003). When unit_root_vars is used the lik_init option of has no effect. When there are nonstationary variables in a model, there is no unique deterministic steady state. The user must supply a Matlab function that computes the steady state values of the stationary variables in the model and returns dummy values for the nonstationary ones. The function should be called with the name of the .mod file followed by _steadystate. See fs2000a_steadystate.m in examples/fs2000 directory. Note that the nonstationary variables in the model must be integrated processes(their first difference or k-difference must be stationary).
Optimal policy Dynare has tools to compute optimal policies for quadratic objectives. You can either solve for optimal policy under commitment with planner_objective or for optimal simple rule with . optim_weights optim_weights specifies quadratic objectives for optimal policy problems optim_weights; VARIANCE STATEMENT COVARIANCE STATEMENT STANDARD ERROR STATEMENT end; var VARIABLE_NAME = EXPRESSION; var VARIABLE_NAME , VARIABLE_NAME = EXPRESSION; var VARIABLE_NAME; stderr EXPRESSION; Description optim_weights secifies the nonzero elements of the quadratic weight matrices for the objectives in osr osr computes optimal simple policy rules osr (OPTION,) VARIABLE_NAME VARIABLE_NAME ; OPTIONS All options for Description osr computes optimal simple policy rules for linear--quadratic problems of the form
maxγ E(y'tWyt) s.t. A1Et(yt+1)+A2yt+A3yt-1+Cet=0
with γ: parameters to be optimized. They must be elements of matrices A1, A2, A3. y: endogenous variables e: exogenous stochastic shocks The parameters to be optimized must be listed with . The quadratic objectives must be listed with . This problem is solved using a numerical optimizer.
osr_params osr_params declares the parameters to be optimized for optimal simple rules osr_params PARAMETER_NAME PARAMETER_NAME ; Description osr_params declares parameters to be optimized by . planner_objective planner_objective declares the policy maker objective, for use with ramsey_policy ramsey_policy computes the first order approximation of the policy that maximizes the policy maker objective function (see ) submitted to the constraints provided by the equilibrium path of the economy
Sensitivity analysis dynare_sensitivity dynare_sensitivity interface to the global sensitivity analysis (GSA) toolbox developed by the Joint Research Center of the European Commission Displaying and saving results Dynare has comments to plot the results of a simulation and to save the results. rplot rplot plot variables rplot VARIABLE_NAME VARIABLE_NAME ; Description Plots one or several variables dynatype dynatype print simulated variables dynatype (FILENAME) VARIABLE_NAME VARIABLE_NAME ; Description dynatype prints the listed variables in a text file named FILENAME. If no VARIABLE_NAME are listed, all endogenous variables are printed. dynasave dynasave save simulated variables in a binary file dynasave (FILENAME) VARIABLE_NAME VARIABLE_NAME ; Description dynasave saves the listed variables in a binary file named FILENAME. If no VARIABLE_NAME are listed, all endogenous variables are saved. In Matlab, variables saved with the dynasave command can be retrieved by the Matlab command load -mat FILENAME. 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. @#include @#include includes another file @#define @#define defines a macro-variable @#if ... @#else ... @#endif @#if ... @#else ... @#endif conditional inclusion of some part of the *.mod file @#for ... @#endfor @#for ... @#endfor loop for replications of portions of the *.mod file @#echo @#echo asks the preprocessor to display some message on standard output @#error @#error asks the preprocessor to display some error message on standard output and to abort Misc commands bvar_density bvar_density computes the marginal density of an estimated BVAR model, using Minnesota priors bvar_forecast bvar_forecast computes in-sample or out-sample forecasts for an estimated BVAR model, using Minnesota priors
Examples Fabrice Collard (GREMAQ, University of Toulouse) has written a guide to stochastic simulations with Dynare entitled "Dynare in Practice" which is in guide.pdf. Boucekkine Raouf 1995 An alternative methodology for solving nonlinear forward-looking models Journal of Economic Dynamics and Control 19 711-734 Collard Fabrice Juillard Michel 2001 Accuracy of stochastic perturbation methods: The case of asset pricing models Journal of Economic Dynamics and Control 25 979-999 Collard Fabrice Juillard Michel 2001 A Higher-Order Taylor Expansion Approach to Simulation of Stochastic Forward-Looking Models with an Application to a Non-Linear Phillips Curve Computational Economics 17 125-139 Durbin J. Koopman S.J. 2001 Time Series Analysis by State Space Methods Oxford University Press Fair Ray Taylor John 1983 Solution and Maximum Likelihood Estimation of Dynamic Nonlinear Rational Expectation Models Econometrica 51 1169-1185 Fernandez-Villaverde Jesus Rubio-Ramirez Juan 2004 Comparing Dynamic Equilibrium Economies to Data: A Bayesian Approach Journal of Econometrics 123 153-187 Ireland Peter 2004 A Method for Taking Models to the Data Journal of Economic Dynamics and Control 28 1205-26 Judd Kenneth 1996 Approximation, Perturbation, and Projection Methods in Economic Analysis Amman Hans Kendrick David Rust John Handbook of Computational Economics 1996 North Holland Press 511-585 Juillard Michel 1996 Dynare: A program for the resolution and simulation of dynamic models with forward variables through the use of a relaxation algorithm CEPREMAP Couverture Orange 9602 Koopman S.J. Durbin J. 2003 Filtering and Smoothing of State Vector for Diffuse State Space Models Journal of Time Series Analysis 24 85-98 Laffargue Jean-Pierre Résolution d'un modèle macroéconomique avec anticipations rationnelles 1990 Annales d'Economie et Statistique 17 97-119 Lubik Thomas Schorfheide Frank 2003 Do Central Banks Target Exchange Rates? A Structural Investigation University of Pennsylvania Rabanal Pau Rubio-Ramirez Juan 2003 Comparing New Keynesian Models of the Business Cycle: A Bayesian Approach Atlanta Fed Working Paper 2001-22a, rev 2003 Schorfheide Frank 2000 Loss Function-based evaluation of DSGE models Journal of Applied Econometrics 15 645-70 Schmitt-Grohe Stephanie Uribe Martin 2002 Solving Dynamic General Equilibrium Models Using a Second-Order Approximation to the Policy Function Rutgers University Smets Frank Wouters Rafael 2002 An Estimated Stochastic Dynamic General Equilibrium Model of the Euro Area European Central Bank ECB Working Paper 171