/usr/share/doc/dynare/dynare.html/Model-declaration.html is in dynare-doc 4.5.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1996-2017, Dynare Team.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 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. -->
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Model declaration (Dynare Reference Manual)</title>
<meta name="description" content="Model declaration (Dynare Reference Manual)">
<meta name="keywords" content="Model declaration (Dynare Reference Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2any">
<link href="index.html#Top" rel="start" title="Top">
<link href="Command-and-Function-Index.html#Command-and-Function-Index" rel="index" title="Command and Function Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="The-Model-file.html#The-Model-file" rel="up" title="The Model file">
<link href="Auxiliary-variables.html#Auxiliary-variables" rel="next" title="Auxiliary variables">
<link href="Parameter-initialization.html#Parameter-initialization" rel="prev" title="Parameter initialization">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Model-declaration"></a>
<div class="header">
<p>
Next: <a href="Auxiliary-variables.html#Auxiliary-variables" accesskey="n" rel="next">Auxiliary variables</a>, Previous: <a href="Parameter-initialization.html#Parameter-initialization" accesskey="p" rel="prev">Parameter initialization</a>, Up: <a href="The-Model-file.html#The-Model-file" accesskey="u" rel="up">The Model file</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Command-and-Function-Index.html#Command-and-Function-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Model-declaration-1"></a>
<h3 class="section">4.5 Model declaration</h3>
<p>The model is declared inside a <code>model</code> block:
</p>
<dl>
<dt><a name="index-model"></a>Block: <strong>model</strong> <em>;</em></dt>
<dt><a name="index-model-1"></a>Block: <strong>model</strong> <em>(<var>OPTIONS</var>…);</em></dt>
<dd>
<p><em>Description</em>
</p>
<p>The equations of the model are written in a block delimited by
<code>model</code> and <code>end</code> keywords.
</p>
<p>There must be as many equations as there are endogenous variables in the
model, except when computing the unconstrained optimal policy with
<code>ramsey_model</code>, <code>ramsey_policy</code> or <code>discretionary_policy</code>.
</p>
<p>The syntax of equations must follow the conventions for
<var>MODEL_EXPRESSION</var> as described in <a href="Expressions.html#Expressions">Expressions</a>. Each equation
must be terminated by a semicolon (‘<samp>;</samp>’). A normal equation looks
like:
</p><div class="example">
<pre class="example"><var>MODEL_EXPRESSION</var> = <var>MODEL_EXPRESSION</var>;
</pre></div>
<p>When the equations are written in homogenous form, it is possible to
omit the ‘<samp>=0</samp>’ part and write only the left hand side of the
equation. A homogenous equation looks like:
</p><div class="example">
<pre class="example"><var>MODEL_EXPRESSION</var>;
</pre></div>
<p>Inside the model block, Dynare allows the creation of <em>model-local
variables</em>, which constitute a simple way to share a common expression
between several equations. The syntax consists of a pound sign
(<code>#</code>) followed by the name of the new model local variable (which
must <strong>not</strong> be declared as in <a href="Variable-declarations.html#Variable-declarations">Variable declarations</a>), an equal
sign, and the expression for which this new variable will stand. Later
on, every time this variable appears in the model, Dynare will
substitute it by the expression assigned to the variable. Note that the
scope of this variable is restricted to the model block; it cannot be
used outside. A model local variable declaration looks like:
</p><div class="example">
<pre class="example"># <var>VARIABLE_NAME</var> = <var>MODEL_EXPRESSION</var>;
</pre></div>
<p>It is possible to tag equations written in the model block. A tag can serve
different purposes by allowing the user to attach arbitrary informations to each
equation and to recover them at runtime. For instance, it is possible to name the
equations with a <code>name</code>-tag, using a syntax like:
</p><div class="example">
<pre class="example">model;
...
[name = 'Budget constraint']
c + k = k^theta*A;
...
end;
</pre></div>
<p>Here, <code>name</code> is the keyword indicating that the tag names the equation. If an equation
of the model is tagged with a name, the <code>resid</code> command
will display the name of the equations (which may be more informative than the
equation numbers) in addition to the equation number. Several tags for one equation can be separated using a comma.
</p><div class="example">
<pre class="example">model;
...
[name='Taylor rule',mcp = 'r > -1.94478']
r = rho*r(-1) + (1-rho)*(gpi*Infl+gy*YGap) + e;
...
end;
</pre></div>
<p>More information on tags is available on the <a href="http://www.dynare.org/DynareWiki/EquationsTags">DynareWiki
wiki</a>.
</p>
<p><em>Options</em>
</p>
<dl compact="compact">
<dt><code>linear</code></dt>
<dd><p>Declares the model as being linear. It spares oneself from having to
declare initial values for computing the steady state of a stationary
linear model. This option can’t be used with non-linear models, it will
NOT trigger linearization of the model.
</p>
</dd>
<dt><code>use_dll</code></dt>
<dd><a name="use_005fdll"></a><p>Instructs the preprocessor to create dynamic loadable libraries (DLL)
containing the model equations and derivatives, instead of writing those
in M-files. You need a working compilation environment, <i>i.e.</i>
a working <code>mex</code> command (see <a href="Compiler-installation.html#Compiler-installation">Compiler installation</a> for more
details). On MATLAB for Windows, you will need to also pass the compiler name at
the command line. Using this option can result in faster simulations or
estimations, at the expense of some initial compilation
time.<a name="DOCF2" href="#FOOT2"><sup>2</sup></a>
</p>
</dd>
<dt><code>block</code></dt>
<dd><a name="block"></a><p>Perform the block decomposition of the model, and exploit it in
computations (steady-state, deterministic simulation,
stochastic simulation with first order approximation and estimation). See
<a href="http://www.dynare.org/DynareWiki/FastDeterministicSimulationAndSteadyStateComputation">Dynare
wiki</a> for details on the algorithms used in deterministic simulation and steady-state computation.
</p>
</dd>
<dt><code>bytecode</code></dt>
<dd><a name="bytecode"></a><p>Instead of M-files, use a bytecode representation of the model, <i>i.e.</i>
a binary file containing a compact representation of all the equations.
</p>
</dd>
<dt><code>cutoff = <var>DOUBLE</var></code></dt>
<dd><p>Threshold under which a jacobian element is considered as null during
the model normalization. Only available with option
<code>block</code>. Default: <code>1e-15</code>
</p>
</dd>
<dt><code>mfs = <var>INTEGER</var></code></dt>
<dd><p>Controls the handling of minimum feedback set of endogenous
variables. Only available with option <code>block</code>. Possible values:
</p>
<dl compact="compact">
<dt><code>0</code></dt>
<dd><p>All the endogenous variables are considered as feedback variables (Default).
</p>
</dd>
<dt><code>1</code></dt>
<dd><p>The endogenous variables assigned to equation naturally normalized
(<i>i.e.</i> of the form <SPAN CLASS="MATH"><IMG
WIDTH="70" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
SRC="dynare.html_9.png"
ALT="$x=f(Y)$"></SPAN> where <SPAN CLASS="MATH"><IMG
WIDTH="14" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="dynare.html_10.png"
ALT="$x$"></SPAN> does not appear in
<SPAN CLASS="MATH"><IMG
WIDTH="17" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="dynare.html_11.png"
ALT="$Y$"></SPAN>) are potentially recursive variables. All the other variables
are forced to belong to the set of feedback variables.
</p>
</dd>
<dt><code>2</code></dt>
<dd><p>In addition of variables with <code>mfs = 1</code> the endogenous variables
related to linear equations which could be normalized are potential
recursive variables. All the other variables are forced to belong to
the set of feedback variables.
</p>
</dd>
<dt><code>3</code></dt>
<dd><p>In addition of variables with <code>mfs = 2</code> the endogenous variables
related to non-linear equations which could be normalized are
potential recursive variables. All the other variables are forced to
belong to the set of feedback variables.
</p></dd>
</dl>
</dd>
<dt><code>no_static</code></dt>
<dd><p>Don’t create the static model file. This can be useful for models which
don’t have a steady state.
</p>
</dd>
<dt><code>differentiate_forward_vars</code></dt>
<dt><code>differentiate_forward_vars = ( <var>VARIABLE_NAME</var> [<var>VARIABLE_NAME</var> …] )</code></dt>
<dd><p>Tells Dynare to create a new auxiliary variable for each endogenous
variable that appears with a lead, such that the new variable is the
time differentiate of the original one. More precisely, if the model
contains <code>x(+1)</code>, then a variable <code>AUX_DIFF_VAR</code> will be
created such that <code>AUX_DIFF_VAR=x-x(-1)</code>, and <code>x(+1)</code> will
be replaced with <code>x+AUX_DIFF_VAR(+1)</code>.
</p>
<p>The transformation is applied to all endogenous variables with a lead
if the option is given without a list of variables. If there is a
list, the transformation is restricted to endogenous with a lead that
also appear in the list.
</p>
<p>This option can useful for some deterministic simulations where
convergence is hard to obtain. Bad values for terminal conditions in
the case of very persistent dynamics or permanent shocks can hinder
correct solutions or any convergence. The new differentiated variables
have obvious zero terminal conditions (if the terminal condition is a
steady state) and this in many cases helps convergence of simulations.
</p>
</dd>
<dt><code>parallel_local_files = ( <var>FILENAME</var> [, <var>FILENAME</var>]… )</code></dt>
<dd><p>Declares a list of extra files that should be transferred to slave
nodes when doing a parallel computation (see <a href="Parallel-Configuration.html#Parallel-Configuration">Parallel Configuration</a>).
</p>
</dd>
</dl>
<p><em>Example 1: elementary RBC model</em>
</p>
<div class="example">
<pre class="example">var c k;
varexo x;
parameters aa alph bet delt gam;
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;
</pre></div>
<p><em>Example 2: use of model local variables</em>
</p>
<p>The following program:
</p>
<div class="example">
<pre class="example">model;
# gamma = 1 - 1/sigma;
u1 = c1^gamma/gamma;
u2 = c2^gamma/gamma;
end;
</pre></div>
<p>…is formally equivalent to:
</p>
<div class="example">
<pre class="example">model;
u1 = c1^(1-1/sigma)/(1-1/sigma);
u2 = c2^(1-1/sigma)/(1-1/sigma);
end;
</pre></div>
<p><em>Example 3: a linear model</em>
</p>
<div class="example">
<pre class="example">model(linear);
x = a*x(-1)+b*y(+1)+e_x;
y = d*y(-1)+e_y;
end;
</pre></div>
</dd></dl>
<p>Dynare has the ability to output the original list of model equations
to a LaTeX file, using the <code>write_latex_original_model</code>
command, the list of transformed model equations using the
<code>write_latex_dynamic_model</code> command, and the list of static model
equations using the <code>write_latex_static_model</code> command.
</p>
<a name="write_005flatex_005foriginal_005fmodel"></a>
<dl>
<dt><a name="index-write_005flatex_005foriginal_005fmodel"></a>Command: <strong>write_latex_original_model</strong> <em>;</em></dt>
<dd>
<p><em>Description</em>
</p>
<p>This command creates two LaTeX files: one containing the model as
defined in the model block and one containing the LaTeX document
header information.
</p>
<p>If your <samp>.mod</samp> file is <samp><var>FILENAME</var>.mod</samp>, then Dynare
will create a file called <samp><var>FILENAME</var>_original.tex</samp>, which
includes a file called <samp><var>FILENAME</var>_original_content.tex</samp>
(also created by Dynare) containing the list of all the original model
equations.
</p>
<p>If LaTeX names were given for variables and parameters
(see <a href="Variable-declarations.html#Variable-declarations">Variable declarations</a>), then those will be used; otherwise,
the plain text names will be used.
</p>
<p>Time subscripts (<code>t</code>, <code>t+1</code>, <code>t-1</code>, …) will be
appended to the variable names, as LaTeX subscripts.
</p>
<p>Compiling the TeX file requires the following LaTeX packages:
<code>geometry</code>, <code>fullpage</code>, <code>breqn</code>.
</p>
</dd></dl>
<a name="write_005flatex_005fdynamic_005fmodel"></a>
<dl>
<dt><a name="index-write_005flatex_005fdynamic_005fmodel"></a>Command: <strong>write_latex_dynamic_model</strong> <em>;</em></dt>
<dt><a name="index-write_005flatex_005fdynamic_005fmodel-1"></a>Command: <strong>write_latex_dynamic_model</strong> <em>(<var>OPTIONS</var>) ;</em></dt>
<dd>
<p><em>Description</em>
</p>
<p>This command creates two LaTeX files: one containing the dynamic
model and one containing the LaTeX document header information.
</p>
<p>If your <samp>.mod</samp> file is <samp><var>FILENAME</var>.mod</samp>, then Dynare
will create a file called <samp><var>FILENAME</var>_dynamic.tex</samp>, which
includes a file called <samp><var>FILENAME</var>_dynamic_content.tex</samp>
(also created by Dynare) containing the list of all the dynamic model
equations.
</p>
<p>If LaTeX names were given for variables and parameters
(see <a href="Variable-declarations.html#Variable-declarations">Variable declarations</a>), then those will be used; otherwise,
the plain text names will be used.
</p>
<p>Time subscripts (<code>t</code>, <code>t+1</code>, <code>t-1</code>, …) will be
appended to the variable names, as LaTeX subscripts.
</p>
<p>Note that the model written in the TeX file will differ from the
model declared by the user in the following dimensions:
</p>
<ul>
<li> the timing convention of predetermined variables
(see <a href="Variable-declarations.html#predetermined_005fvariables">predetermined_variables</a>) will have been changed to the
default Dynare timing convention; in other words, variables declared
as predetermined will be lagged on period back,
</li><li> the expectation operators (see <a href="Expressions.html#expectation">expectation</a>) will have
been removed, replaced by auxiliary variables and new equations as
explained in the documentation of the operator,
</li><li> endogenous variables with leads or lags greater or equal than two will
have been removed, replaced by new auxiliary variables and equations,
</li><li> for a stochastic model, exogenous variables with leads or lags will
also have been replaced by new auxiliary variables and equations.
</li></ul>
<p>For the required LaTeX packages, see <a href="#write_005flatex_005foriginal_005fmodel">write_latex_original_model</a>.
</p>
<p><em>Options</em>
</p>
<dl compact="compact">
<dt><code>write_equation_tags</code></dt>
<dd><p>Write the equation tags in the LaTeX output. NB: the equation tags will be
interpreted with LaTeX markups.
</p>
</dd>
</dl>
</dd></dl>
<dl>
<dt><a name="index-write_005flatex_005fstatic_005fmodel"></a>Command: <strong>write_latex_static_model</strong> <em>;</em></dt>
<dd>
<p><em>Description</em>
</p>
<p>This command creates two LaTeX files: one containing the static
model and one containing the LaTeX document header information.
</p>
<p>If your <samp>.mod</samp> file is <samp><var>FILENAME</var>.mod</samp>, then Dynare
will create a file called <samp><var>FILENAME</var>_static.tex</samp>, which
includes a file called <samp><var>FILENAME</var>_static_content.tex</samp> (also
created by Dynare) containing the list of all the steady state model
equations.
</p>
<p>If LaTeX names were given for variables and parameters
(see <a href="Variable-declarations.html#Variable-declarations">Variable declarations</a>), then those will be used; otherwise,
the plain text names will be used.
</p>
<p>Note that the model written in the TeX file will differ from the
model declared by the user in the some dimensions
(see <a href="#write_005flatex_005fdynamic_005fmodel">write_latex_dynamic_model</a> for details).
</p>
<p>Also note that this command will not output the contents of the
optional <code>steady_state_model</code> block (see <a href="Steady-state.html#steady_005fstate_005fmodel">steady_state_model</a>);
it will rather output a static version (<i>i.e.</i> without leads and
lags) of the dynamic model declared in the <code>model</code> block.
</p>
<p>For the required LaTeX packages, see <a href="#write_005flatex_005foriginal_005fmodel">write_latex_original_model</a>.
</p>
</dd></dl>
<div class="footnote">
<hr>
<h4 class="footnotes-heading">Footnotes</h4>
<h3><a name="FOOT2" href="#DOCF2">(2)</a></h3>
<p>In particular, for big models, the compilation step can
be very time-consuming, and use of this option may be counter-productive
in those cases.</p>
</div>
<hr>
<div class="header">
<p>
Next: <a href="Auxiliary-variables.html#Auxiliary-variables" accesskey="n" rel="next">Auxiliary variables</a>, Previous: <a href="Parameter-initialization.html#Parameter-initialization" accesskey="p" rel="prev">Parameter initialization</a>, Up: <a href="The-Model-file.html#The-Model-file" accesskey="u" rel="up">The Model file</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Command-and-Function-Index.html#Command-and-Function-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|