Codebase list dynare / c854f0c
New upstream version 4.6.1 Sébastien Villemot 4 years ago
66 changed file(s) with 1149 addition(s) and 416 deletion(s). Raw diff Collapse all Expand all
3535 mkdir -p $(abs_srcdir)/matlab/preprocessor$$ARCH && \
3636 $(LN_S) -f $(abs_builddir)/preprocessor/src/dynare_m$(EXEEXT) $(abs_srcdir)/matlab/preprocessor$$ARCH
3737
38 clean-local:
39 rm -rf $(abs_srcdir)/matlab/preprocessor32 $(abs_srcdir)/matlab/preprocessor64
40
3841 dist-hook:
3942 rm -rf `find $(distdir)/matlab $(distdir)/examples -name *~`
4043 rm -rf $(distdir)/matlab/preprocessor* $(distdir)/matlab/dynare_version.m
746746 @echo "it deletes files that may require special tools to rebuild."
747747 clean: clean-recursive
748748
749 clean-am: clean-generic mostlyclean-am
749 clean-am: clean-generic clean-local mostlyclean-am
750750
751751 distclean: distclean-recursive
752752 -rm -f $(am__CONFIG_DISTCLEAN_FILES)
817817
818818 .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am all-local \
819819 am--refresh check check-am clean clean-cscope clean-generic \
820 cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
821 dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \
822 dist-zip distcheck distclean distclean-generic distclean-tags \
823 distcleancheck distdir distuninstallcheck dvi dvi-am html \
824 html-am info info-am install install-am install-data \
825 install-data-am install-dvi install-dvi-am install-exec \
826 install-exec-am install-exec-local install-html \
820 clean-local cscope cscopelist-am ctags ctags-am dist dist-all \
821 dist-bzip2 dist-gzip dist-hook dist-lzip dist-shar dist-tarZ \
822 dist-xz dist-zip distcheck distclean distclean-generic \
823 distclean-tags distcleancheck distdir distuninstallcheck dvi \
824 dvi-am html html-am info info-am install install-am \
825 install-data install-data-am install-dvi install-dvi-am \
826 install-exec install-exec-am install-exec-local install-html \
827827 install-html-am install-info install-info-am install-man \
828828 install-pdf install-pdf-am install-ps install-ps-am \
829829 install-strip installcheck installcheck-am installdirs \
842842 fi; \
843843 mkdir -p $(abs_srcdir)/matlab/preprocessor$$ARCH && \
844844 $(LN_S) -f $(abs_builddir)/preprocessor/src/dynare_m$(EXEEXT) $(abs_srcdir)/matlab/preprocessor$$ARCH
845
846 clean-local:
847 rm -rf $(abs_srcdir)/matlab/preprocessor32 $(abs_srcdir)/matlab/preprocessor64
845848
846849 dist-hook:
847850 rm -rf `find $(distdir)/matlab $(distdir)/examples -name *~`
0 Announcement for Dynare 4.6.0 (in February 2020)
1 ================================================
0 Announcement for Dynare 4.6.1 (on 2020-03-13)
1 =============================================
2
3 We are pleased to announce the release of Dynare 4.6.1.
4
5 This maintenance release fixes various bugs.
6
7 The Windows, macOS and source packages are already available for download at
8 [the Dynare website](https://www.dynare.org/download/).
9
10 All users are strongly encouraged to upgrade.
11
12 This release is compatible with MATLAB versions ranging from 7.9 (R2009b) to
13 9.7 (R2019b), and with GNU Octave versions 5.2.0 (under Windows) and 4.4.1
14 (under macOS).
15
16 Here is a list of the problems identified in version 4.6.0 and that have been
17 fixed in version 4.6.1:
18
19 * Installation on macOS would fail if the GCC compiler was supposed to be
20 installed and `www.google.com` was not reachable or blocked
21 * Dynare++ was missing the `dynare_simul.m` file
22 * The parameter vector `M_.params` would not be correctly updated after calls
23 to `stoch_simul` and `discretionary_policy` if parameters had been modified
24 in a steady state file
25 * The `stoch_simul` command with both the `nograph` and `TeX` options would
26 crash
27 * The `stoch_simul` command with the `noprint` option would crash
28 * The `prior moments` command would crash if the used parameter vector
29 triggered an error code
30 * In case of problem, the `discretionary_policy` command would crash instead of
31 aborting with a proper error code
32 * Computing of prior/posterior statistics would not work in parallel
33 * Closing of parallel estimation on GNU/Linux could crash
34 * The `histval` command would not work in combination with the
35 `predetermined_variables` command
36 * Ramsey optimal policy with multiple instruments would crash if a steady state
37 file returned complex values, instead of providing an error message
38 * The `model_diagnostics` command would not correctly update the parameter
39 vector if the latter was set in a steady state file
40 * The `model_diagnostics` command would ignore the `nocheck` steady state flag
41
42
43 Announcement for Dynare 4.6.0 (on 2020-02-20)
44 =============================================
245
346 We are pleased to announce the release of Dynare 4.6.0.
447
161204
162205 - `@#for` loops can iterate over several variables at the same time (*e.g.*
163206 `@#for (i,j) in X`, where `X` is an array containing tuples of size 2).
207
208 - Added the possibility to exclude some elements when iterating over `@#for`
209 loops (*e.g.* `@#for i in 1:5 when mod(i,2) == 0` iterates over all even
210 numbers between 1 and 5).
164211
165212 - A `defined()` function allows testing whether macro variables have been
166213 defined.
283283 ```
284284 where the path and version of MATLAB are specified. Note that you should use
285285 the MSYS2 notation and not put spaces in the MATLAB path, so you probably want
286 to use something like `/c/Progra~1/MATLAB/…`.
286 to use something like `/c/Progra~1/MATLAB/…`. Alternatively, if your filesystem
287 does not have short filenames (8dot3), then you can run `mkdir -p
288 /usr/local/MATLAB && mount c:/Program\ Files/MATLAB /usr/local/MATLAB`, and
289 then pass `/usr/local/MATLAB/…` as MATLAB path to the configure script.
287290 - Compile:
288291 ```
289292 make
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.69 for dynare 4.6.0.
2 # Generated by GNU Autoconf 2.69 for dynare 4.6.1.
33 #
44 #
55 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
576576 # Identity of this package.
577577 PACKAGE_NAME='dynare'
578578 PACKAGE_TARNAME='dynare'
579 PACKAGE_VERSION='4.6.0'
580 PACKAGE_STRING='dynare 4.6.0'
579 PACKAGE_VERSION='4.6.1'
580 PACKAGE_STRING='dynare 4.6.1'
581581 PACKAGE_BUGREPORT=''
582582 PACKAGE_URL=''
583583
13471347 # Omit some internal or obsolete options to make the list less imposing.
13481348 # This message is too long to be a string in the A/UX 3.1 sh.
13491349 cat <<_ACEOF
1350 \`configure' configures dynare 4.6.0 to adapt to many kinds of systems.
1350 \`configure' configures dynare 4.6.1 to adapt to many kinds of systems.
13511351
13521352 Usage: $0 [OPTION]... [VAR=VALUE]...
13531353
14181418
14191419 if test -n "$ac_init_help"; then
14201420 case $ac_init_help in
1421 short | recursive ) echo "Configuration of dynare 4.6.0:";;
1421 short | recursive ) echo "Configuration of dynare 4.6.1:";;
14221422 esac
14231423 cat <<\_ACEOF
14241424
15291529 test -n "$ac_init_help" && exit $ac_status
15301530 if $ac_init_version; then
15311531 cat <<\_ACEOF
1532 dynare configure 4.6.0
1532 dynare configure 4.6.1
15331533 generated by GNU Autoconf 2.69
15341534
15351535 Copyright (C) 2012 Free Software Foundation, Inc.
20242024 This file contains any messages produced by compilers while
20252025 running configure, to aid debugging if configure makes a mistake.
20262026
2027 It was created by dynare $as_me 4.6.0, which was
2027 It was created by dynare $as_me 4.6.1, which was
20282028 generated by GNU Autoconf 2.69. Invocation command line was
20292029
20302030 $ $0 $@
28882888
28892889 # Define the identity of the package.
28902890 PACKAGE='dynare'
2891 VERSION='4.6.0'
2891 VERSION='4.6.1'
28922892
28932893
28942894 cat >>confdefs.h <<_ACEOF
1115311153 # report actual input values of CONFIG_FILES etc. instead of their
1115411154 # values after options handling.
1115511155 ac_log="
11156 This file was extended by dynare $as_me 4.6.0, which was
11156 This file was extended by dynare $as_me 4.6.1, which was
1115711157 generated by GNU Autoconf 2.69. Invocation command line was
1115811158
1115911159 CONFIG_FILES = $CONFIG_FILES
1121011210 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1121111211 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1121211212 ac_cs_version="\\
11213 dynare config.status 4.6.0
11213 dynare config.status 4.6.1
1121411214 configured by $0, generated by GNU Autoconf 2.69,
1121511215 with options \\"\$ac_cs_config\\"
1121611216
1717 dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>.
1818
1919 AC_PREREQ([2.62])
20 AC_INIT([dynare], [4.6.0])
20 AC_INIT([dynare], [4.6.1])
2121 AC_CONFIG_SRCDIR([preprocessor/src/DynareMain.cc])
2222 AM_INIT_AUTOMAKE([1.11 -Wall -Wno-portability foreign no-dist-gzip dist-xz tar-pax])
2323
1515
1616 clean-local:
1717 rm -rf build
18 rm -rf utils/__pycache__
467467
468468 clean-local:
469469 rm -rf build
470 rm -rf utils/__pycache__
470471
471472 # Tell versions [3.59,3.63) of GNU make to not export all variables.
472473 # Otherwise a system limit (for SysV at least) may be exceeded.
3030
3131 html_static_path = ['_static']
3232
33 mathjax_path = 'mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
3433
3534 master_doc = 'index'
3635
103103 Octave, it also means that the ``.mod`` file cannot be named
104104 ``test.mod`` or ``example.mod``.
105105
106 .. _quote-note:
107
108 .. note::
109 Note on Quotes
110
111 When passing command line options that contains a space (or, under
112 Octave, a double quote), you must surround the entire option (keyword
113 and argument) with single quotes, as in the following example.
114
115 *Example*
116
117 Call Dynare with options containing spaces
118
119 .. code-block:: matlab
120
121 >> dynare <<modfile.mod>> '-DA=[ i in [1,2,3] when i > 1 ]' 'conffile=C:\User\My Documents\config.txt'
122
106123 *Options*
107124
108125 .. option:: noclearall
139156
140157 .. option:: savemacro[=FILENAME]
141158
142 Instructs ``dynare`` to save the intermediary file which is
143 obtained after macro processing (see :ref:`macro-proc-lang`);
144 the saved output will go in the file specified, or if no file
145 is specified in ``FILENAME-macroexp.mod``
159 Instructs ``dynare`` to save the intermediary file which is obtained
160 after macro processing (see :ref:`macro-proc-lang`); the saved output
161 will go in the file specified, or if no file is specified in
162 ``FILENAME-macroexp.mod``. See the :ref:`note on quotes<quote-note>`
163 for info on passing a ``FILENAME`` argument containing spaces.
146164
147165 .. option:: onlymacro
148166
297315
298316 .. option:: matlabroot=<<path>>
299317
300 The path to the MATLAB installation for use with
301 :opt:`use_dll`. Dynare is able to set this automatically,
302 so you should not need to set it yourself.
318 The path to the MATLAB installation for use with :opt:`use_dll`. Dynare
319 is able to set this automatically, so you should not need to set it
320 yourself. See the :ref:`note on quotes<quote-note>` for info on
321 passing a ``<<path>>`` argument containing spaces.
303322
304323 .. option:: parallel[=CLUSTER_NAME]
305324
312331
313332 .. option:: conffile=FILENAME
314333
315 Specifies the location of the configuration file if it differs
316 from the default. See :ref:`conf-file`, for more information
317 about the configuration file and its default location.
334 Specifies the location of the configuration file if it differs from the
335 default. See :ref:`conf-file`, for more information about the
336 configuration file and its default location. See the :ref:`note on
337 quotes<quote-note>` for info on passing a ``FILENAME`` argument
338 containing spaces.
318339
319340 .. option:: parallel_slave_open_mode
320341
332353
333354 Defines a macro-variable from the command line (the same effect as
334355 using the Macro directive ``@#define`` in a model file, see
335 :ref:`macro-proc-lang`). Note that when passing a MACRO_EXPRESSION that
336 contains a space (or, under Octave, a double quote), you must surround
337 the entire ``-D`` flag with single quotes, as in the following example.
338 Also note that an expression passed on the command line can reference
339 variables defined before it.
356 :ref:`macro-proc-lang`). See the :ref:`note on quotes<quote-note>` for
357 info on passing a ``MACRO_EXPRESSION`` argument containing spaces. Note
358 that an expression passed on the command line can reference variables
359 defined before it.
340360
341361 *Example*
342362
348368
349369 .. option:: -I<<path>>
350370
351 Defines a path to search for files to be included by the
352 macro processor (using the ``@#include`` command). Multiple
353 ``-I`` flags can be passed on the command line. The paths will
354 be searched in the order that the ``-I`` flags are passed and
355 the first matching file will be used. The flags passed here
356 take priority over those passed to ``@#includepath``.
371 Defines a path to search for files to be included by the macro
372 processor (using the ``@#include`` command). Multiple ``-I`` flags can
373 be passed on the command line. The paths will be searched in the order
374 that the ``-I`` flags are passed and the first matching file will be
375 used. The flags passed here take priority over those passed to
376 ``@#includepath``. See the :ref:`note on quotes<quote-note>` for info
377 on passing a ``<<path>>`` argument containing spaces.
357378
358379 .. option:: nostrict
359380
00 SUBDIRS = utils/cc sylv parser/cc tl doc integ kord src tests
1
2 EXTRA_DIST = dynare_simul
3
4 install-exec-local:
5 $(MKDIR_P) $(DESTDIR)$(pkglibdir)/dynare++
6 cp -r dynare_simul/* $(DESTDIR)$(pkglibdir)/dynare++
7
8 uninstall-local:
9 rm -rf $(DESTDIR)$(pkglibdir)/dynare++
10
323323 top_builddir = @top_builddir@
324324 top_srcdir = @top_srcdir@
325325 SUBDIRS = utils/cc sylv parser/cc tl doc integ kord src tests
326 EXTRA_DIST = dynare_simul
326327 all: all-recursive
327328
328329 .SUFFIXES:
574575
575576 install-dvi-am:
576577
577 install-exec-am:
578 install-exec-am: install-exec-local
578579
579580 install-html: install-html-recursive
580581
612613
613614 ps-am:
614615
615 uninstall-am:
616 uninstall-am: uninstall-local
616617
617618 .MAKE: $(am__recursive_targets) install-am install-strip
618619
621622 distclean distclean-generic distclean-tags distdir dvi dvi-am \
622623 html html-am info info-am install install-am install-data \
623624 install-data-am install-dvi install-dvi-am install-exec \
624 install-exec-am install-html install-html-am install-info \
625 install-info-am install-man install-pdf install-pdf-am \
626 install-ps install-ps-am install-strip installcheck \
627 installcheck-am installdirs installdirs-am maintainer-clean \
628 maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
629 pdf-am ps ps-am tags tags-am uninstall uninstall-am
625 install-exec-am install-exec-local install-html \
626 install-html-am install-info install-info-am install-man \
627 install-pdf install-pdf-am install-ps install-ps-am \
628 install-strip installcheck installcheck-am installdirs \
629 installdirs-am maintainer-clean maintainer-clean-generic \
630 mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
631 tags-am uninstall uninstall-am uninstall-local
630632
631633 .PRECIOUS: Makefile
632634
635
636 install-exec-local:
637 $(MKDIR_P) $(DESTDIR)$(pkglibdir)/dynare++
638 cp -r dynare_simul/* $(DESTDIR)$(pkglibdir)/dynare++
639
640 uninstall-local:
641 rm -rf $(DESTDIR)$(pkglibdir)/dynare++
633642
634643 # Tell versions [3.59,3.63) of GNU make to not export all variables.
635644 # Otherwise a system limit (for SysV at least) may be exceeded.
0 %
1 % SYNOPSIS
2 %
3 % r = dynare_simul(name, shocks)
4 % r = dynare_simul(name, prefix, shocks)
5 % r = dynare_simul(name, shocks, start)
6 % r = dynare_simul(name, prefix, shocks, start)
7 %
8 % name name of MAT-file produced by dynare++
9 % prefix prefix of variables in the MAT-file
10 % shocks matrix of shocks
11 % start zero period value
12 %
13 % Note that this file requires the dynare_simul_ DLL to be in the path.
14 % This DLL is distributed with Dynare, under the mex/matlab or mex/octave
15 % subdirectory.
16 %
17 % SEMANTICS
18 %
19 % The command reads a decision rule from the MAT-file having the given
20 % prefix. Then it starts simulating the decision rule with zero time value
21 % equal to the given start. It uses the given shocks for the simulation. If
22 % the start is not given, the state about which the decision rule is
23 % centralized is taken (called fix point, or stochastic steady state, take
24 % your pick).
25 %
26 % prefix Use the prefix with which you called dynare++, the default
27 % prefix in dynare++ is 'dyn'.
28 % shocks Number of rows must be a number of exogenous shocks,
29 % number of columns gives the number of simulated
30 % periods. NaNs and Infs in the matrix are substitued by
31 % draws from the normal distribution using the covariance
32 % matrix given in the model file.
33 % start Vector of endogenous variables in the ordering given by
34 % <prefix>_vars.
35 %
36 % Seed for random generator is derived from calling rand(1,1). Therefore,
37 % seeding can be controlled with rand('state') and rand('state',some_seed).
38 %
39 % EXAMPLES
40 %
41 % All examples suppose that the prefix is 'dyn' and that your_model.mat
42 % has been loaded into Matlab.
43 %
44 % 1. response to permanent negative shock to the third exo var EPS3 for
45 % 100 periods
46 %
47 % shocks = zeros(4,100); % 4 exogenous variables in the model
48 % shocks(dyn_i_EPS3,:) = -0.1; % the permanent shock to EPS3
49 % r = dynare_simul('your_model.mat',shocks);
50 %
51 % 2. one stochastic simulation for 100 periods
52 %
53 % shocks = zeros(4,100)./0; % put NaNs everywhere
54 % r = dynare_simul('your_model.mat',shocks);
55 %
56 % 3. one stochastic simulation starting at 75% undercapitalized economy
57 %
58 % shocks = zeros(4,100)./0; % put NaNs everywhere
59 % ystart = dyn_ss; % get copy of DR fix point
60 % ystart(dyn_i_K) = 0.75*dyn_ss(dyn_i_K); % scale down the capital
61 % r = dynare_simul('your_model.mat',shocks,ystart);
62 %
63 %
64 % SEE ALSO
65 %
66 % "DSGE Models with Dynare++. A Tutorial.", Ondra Kamenik, 2005
67
68 % Copyright (C) 2005-2011, Ondra Kamenik
69 % Copyright (C) 2020, Dynare Team
70
71
72 function r = dynare_simul(varargin)
73
74 if ~exist('dynare_simul_','file')
75 error('Can''t find dynare_simul_ DLL in the path. The simplest way to add it is to run Dynare once in this session.')
76 end
77
78 % get the file name and load data
79 fname = varargin{1};
80 load(fname);
81
82 % set prefix, shocks, ystart
83 if ischar(varargin{2})
84 prefix = varargin{2};
85 if length(varargin) == 3
86 shocks = varargin{3};
87 ystart = NaN;
88 elseif length(varargin) == 4
89 shocks = varargin{3};
90 ystart = varargin{4};
91 else
92 error('Wrong number of parameters.');
93 end
94 else
95 prefix = 'dyn';
96 if length(varargin) == 2
97 shocks = varargin{2};
98 ystart = NaN;
99 elseif length(varargin) == 3
100 shocks = varargin{2};
101 ystart = varargin{3};
102 else
103 error('Wrong number of parameters.');
104 end
105 end
106
107 % load all needed variables but prefix_g_*
108 if exist([prefix '_nstat'],'var')
109 nstat = eval([prefix '_nstat']);
110 else
111 error(['Could not find variable ' prefix '_nstat in workspace']);
112 end
113 if exist([prefix '_npred'],'var')
114 npred = eval([prefix '_npred']);
115 else
116 error(['Could not find variable ' prefix '_npred in workspace']);
117 end
118 if exist([prefix '_nboth'],'var')
119 nboth = eval([prefix '_nboth']);
120 else
121 error(['Could not find variable ' prefix '_nboth in workspace']);
122 end
123 if exist([prefix '_nforw'],'var')
124 nforw = eval([prefix '_nforw']);
125 else
126 error(['Could not find variable ' prefix '_nforw in workspace']);
127 end
128 if exist([prefix '_ss'],'var')
129 ss = eval([prefix '_ss']);
130 else
131 error(['Could not find variable ' prefix '_ss in workspace']);
132 end
133 if exist([prefix '_vcov_exo'],'var')
134 vcov_exo = eval([prefix '_vcov_exo']);
135 else
136 error(['Could not find variable ' prefix '_vcov_exo in workspace']);
137 end
138 nexog = size(vcov_exo,1);
139
140 if isnan(ystart)
141 ystart = ss;
142 end
143
144 % newer version of dynare++ doesn't return prefix_g_0, we make it here if
145 % it does not exist in workspace
146 g_zero = [prefix '_g_0'];
147 if ~exist(g_zero,'var')
148 dr.g_0=zeros(nstat+npred+nboth+nforw,1);
149 else
150 dr.g_0=eval(g_zero);
151 end
152
153 % make derstr a string of comma seperated existing prefix_g_*
154 order = 1;
155 cont = 1;
156 while cont == 1
157 g_ord = [prefix '_g_' num2str(order)];
158 if exist(g_ord,'var')
159 dr.(['g_' num2str(order)])=eval(g_ord);
160 order = order + 1;
161 else
162 cont = 0;
163 end
164 end
165
166 % set seed
167 seed = ceil(10000*rand(1,1));
168
169 % call dynare_simul_
170 [err,r]=dynare_simul_(order-1,nstat,npred,nboth,nforw,...
171 nexog,ystart,shocks,vcov_exo,seed,ss,dr);
172
173 if err
174 error('Simulation failed')
175 end
2828 *
2929 * Please note that the following copyright notice only applies to this Dynare
3030 * implementation of the model.
31
3231 */
3332
3433 /*
35 * Copyright (C) 2013-2016 Dynare Team
34 * Copyright (C) 2013-2020 Dynare Team
3635 *
3736 * This file is part of Dynare.
3837 *
5049 * along with Dynare. If not, see <http://www.gnu.org/licenses/>.
5150 */
5251
53 var d //preference shock
54 c //consumption
55 mu_z //trend growth rate of the economy (from neutral and investment specific technology)
56 mu_I //growth rate of investment-specific technology growth
57 mu_A //growth rate of neutral technology
58 lambda //Lagrange multiplier
59 R //Nominal Interest rate
60 PI //Inflation
61 r //rental rate of capital
62 x //investment
63 u //capacity utilization
64 q //Tobin's marginal q
65 f //variable for recursive formulation of wage setting
66 ld //aggregate labor demand
67 w //real wage
68 wstar //optimal real wage
69 PIstarw //optimal wage inflation
70 PIstar //optimal price inflation
71 g1 //variable 1 for recursive formulation of price setting
72 g2 //variable 2 for recursive formulation of price setting
73 yd //aggregate output
74 mc //marginal costs
75 k //capital
76 vp //price dispersion term
77 vw //wage dispersion term
78 l //aggregate labor bundle
79 phi //labor disutility shock
80 F; //firm profits
52 var d (long_name='preference shock')
53 c (long_name='consumption')
54 mu_z (long_name='trend growth rate of the economy (from neutral and investment specific technology)')
55 mu_I (long_name='growth rate of investment-specific technology growth')
56 mu_A (long_name='growth rate of neutral technology')
57 lambda (long_name='Lagrange multiplier')
58 R (long_name='Nominal Interest rate')
59 PI (long_name='Inflation')
60 r (long_name='rental rate of capital')
61 x (long_name='investment')
62 u (long_name='capacity utilization')
63 q (long_name='Tobin marginal q')
64 f (long_name='variable for recursive formulation of wage setting')
65 ld (long_name='aggregate labor demand')
66 w (long_name='real wage')
67 wstar (long_name='optimal real wage')
68 PIstarw (long_name='optimal wage inflation')
69 PIstar (long_name='optimal price inflation')
70 g1 (long_name='variable 1 for recursive formulation of price setting')
71 g2 (long_name='variable 2 for recursive formulation of price setting')
72 yd (long_name='aggregate output')
73 mc (long_name='marginal costs')
74 k (long_name='capital')
75 vp (long_name='price dispersion term')
76 vw (long_name='wage dispersion term')
77 l (long_name='aggregate labor bundle')
78 phi (long_name='labor disutility shock')
79 F (long_name='firm profits')
80 ;
8181
82 varexo epsd epsphi epsmu_I epsA epsm;
82 varexo epsd (long_name='Innovation preference shock')
83 epsphi (long_name='Innovation labor disutility shock')
84 epsmu_I (long_name='Innovation investment-specific technology')
85 epsA (long_name='Innovation neutral technology')
86 epsm (long_name='Innovation monetary policy shock')
87 ;
8388
8489 predetermined_variables k;
8590
86 parameters h //consumption habits
87 betta //discount factor
88 gammma1 //capital utilization, linear term
89 gammma2 //capital utilization, quadratic term
90 delta //depreciation rate
91 kappa //capital adjustment costs parameter
92 eta //elasticity of substitution between labor varieties
93 epsilon //elasticity of substitution between goods varieties
94 varpsi //labor disutility parameter
95 gammma //inverse Frisch elasticity
96 chiw //wage indexation parameter
97 chi //price indexation
98 thetap //Calvo parameter prices
99 thetaw //Calvo parameter wages
100 alppha //capital share
101 Rbar //steady state interest rate
102 PIbar //steady state inflation
103 gammmaR //interest smoothing coefficient Taylor rule
104 gammmaPI //feedback coefficient to inflation monetary policy rule
105 gammmay //feedback coefficient to output growth deviation in monetary policy rule
106 Phi //firms fixed costs
107 rhod //autocorrelation preference shock
108 rhophi //autocorrelation labor disutility shock
109 Lambdamu //steady state growth rate of investmentment-specific technology
110 LambdaA //steady state neutral technology growth
111 Lambdax //steady state growth rate of investment
112 LambdaYd //steady state growth rate of output
113 sigma_d //standard deviation preference shock
114 sigma_phi //standard deviation labor disutility shock
115 sigma_mu //standard deviation investment-specific technology
116 sigma_A //standard deviation neutral technology
117 sigma_m; //standard deviation preference shock
118
91 parameters h (long_name='consumption habits')
92 betta (long_name='discount factor')
93 gammma1 (long_name='capital utilization, linear term')
94 gammma2 (long_name='capital utilization, quadratic term')
95 delta (long_name='depreciation rate')
96 kappa (long_name='capital adjustment costs parameter')
97 eta (long_name='elasticity of substitution between labor varieties')
98 epsilon (long_name='elasticity of substitution between goods varieties')
99 varpsi (long_name='labor disutility parameter')
100 gammma (long_name='inverse Frisch elasticity')
101 chiw (long_name='wage indexation parameter')
102 chi (long_name='price indexation')
103 thetap (long_name='Calvo parameter prices')
104 thetaw (long_name='Calvo parameter wages')
105 alppha (long_name='capital share')
106 Rbar (long_name='steady state interest rate')
107 PIbar (long_name='steady state inflation')
108 gammmaR (long_name='interest smoothing coefficient Taylor rule')
109 gammmaPI (long_name='feedback coefficient to inflation monetary policy rule')
110 gammmay (long_name='feedback coefficient to output growth deviation in monetary policy rule')
111 Phi (long_name='firms fixed costs')
112 rhod (long_name='autocorrelation preference shock')
113 rhophi (long_name='autocorrelation labor disutility shock')
114 Lambdamu (long_name='steady state growth rate of investmentment-specific technology')
115 LambdaA (long_name='steady state neutral technology growth')
116 Lambdax (long_name='steady state growth rate of investment')
117 LambdaYd (long_name='steady state growth rate of output')
118 sigma_d (long_name='standard deviation preference shock')
119 sigma_phi (long_name='standard deviation labor disutility shock')
120 sigma_mu (long_name='standard deviation investment-specific technology')
121 sigma_A (long_name='standard deviation neutral technology')
122 sigma_m (long_name='standard deviation monetary policy shock')
123 ;
119124
120125 //Note that the parameter naming in FV(2010) differs from FV(2006)
121126 //Fixed parameters, taken from FV(2010), Table 2, p. 37
176181 */
177182
178183 model;
179 //1. FOC consumption
184 [name='FOC consumption']
180185 d*(c-h*c(-1)*mu_z^(-1))^(-1)-h*betta*d(+1)*(c(+1)*mu_z(+1)-h*c)^(-1)=lambda;
181 //2. Euler equation
186 [name='Euler equation']
182187 lambda=betta*lambda(+1)*mu_z(+1)^(-1)/PI(+1)*R;
183 //3. FOC capital utilization
188 [name='FOC capital utilization']
184189 r=gammma1+gammma2*(u-1);
185 //4. FOC capital
190 [name='FOC capital']
186191 q=betta*lambda(+1)/lambda*mu_z(+1)^(-1)*mu_I(+1)^(-1)*((1-delta)*q(+1)+r(+1)*u(+1)-(gammma1*(u(+1)-1)+gammma2/2*(u(+1)-1)^2));
187 //5. FOC investment
192 [name='FOC investment']
188193 1=q*(1-(kappa/2*(x/x(-1)*mu_z-Lambdax)^2)-(kappa*(x/x(-1)*mu_z-Lambdax)*x/x(-1)*mu_z))
189194 +betta*q(+1)*lambda(+1)/lambda*mu_z(+1)^(-1)*kappa*(x(+1)/x*mu_z(+1)-Lambdax)*(x(+1)/x*mu_z(+1))^2;
190 //6-7. Wage setting
195 [name='Wage setting 1']
191196 f=(eta-1)/eta*wstar^(1-eta)*lambda*w^eta*ld+betta*thetaw*(PI^chiw/PI(+1))^(1-eta)*(wstar(+1)/wstar*mu_z(+1))^(eta-1)*f(+1);
197 [name='Wage setting 2']
192198 f=varpsi*d*phi*PIstarw^(-eta*(1+gammma))*ld^(1+gammma)+betta*thetaw*(PI^chiw/PI(+1))^(-eta*(1+gammma))*(wstar(+1)/wstar*mu_z(+1))^(eta*(1+gammma))*f(+1);
193199
194 //8-10. firm's price setting
200 [name='Firm price setting 1']
195201 g1=lambda*mc*yd+betta*thetap*(PI^chi/PI(+1))^(-epsilon)*g1(+1);
202 [name='Firm price setting 2']
196203 g2=lambda*PIstar*yd+betta*thetap*(PI^chi/PI(+1))^(1-epsilon)*PIstar/PIstar(+1)*g2(+1);
204 [name='Firm price setting 3']
197205 epsilon*g1=(epsilon-1)*g2;
198 //11-12. optimal inputs
206 [name='Optimal capital labor ratio']
199207 u*k/ld=alppha/(1-alppha)*w/r*mu_z*mu_I;
208 [name='Marginal costs']
200209 mc=(1/(1-alppha))^(1-alppha)*(1/alppha)^alppha*w^(1-alppha)*r^alppha;
201 //13. law of motion wages
210 [name='law of motion wages']
202211 1=thetaw*(PI(-1)^chiw/PI)^(1-eta)*(w(-1)/w*mu_z^(-1))^(1-eta)+(1-thetaw)*PIstarw^(1-eta);
203 //14. law of motion prices
212 [name='law of motion prices']
204213 1=thetap*(PI(-1)^chi/PI)^(1-epsilon)+(1-thetap)*PIstar^(1-epsilon);
205214
206 //15. Taylor Rule
215 [name='Taylor Rule']
207216 R/Rbar=(R(-1)/Rbar)^gammmaR*((PI/PIbar)^gammmaPI*((yd/yd(-1)*mu_z)/exp(LambdaYd))^gammmay)^(1-gammmaR)*exp(epsm);
208217
209 //16-17. Market clearing
218 [name='Resource constraint']
210219 yd=c+x+mu_z^(-1)*mu_I^(-1)*(gammma1*(u-1)+gammma2/2*(u-1)^2)*k;
220 [name='Aggregate production']
211221 yd=(mu_A*mu_z^(-1)*(u*k)^alppha*ld^(1-alppha)-Phi)/vp;
212 //18-20. Price and wage dispersion terms
222 [name='Aggregate labor market']
213223 l=vw*ld;
224 [name='LOM Price dispersion term']
214225 vp=thetap*(PI(-1)^chi/PI)^(-epsilon)*vp(-1)+(1-thetap)*PIstar^(-epsilon);
226 [name='LOM Wage dispersion term']
215227 vw=thetaw*(w(-1)/w*mu_z^(-1)*PI(-1)^chiw/PI)^(-eta)*vw(-1)+(1-thetaw)*(PIstarw)^(-eta);
216 //21. Law of motion for capital
228 [name='Law of motion for capital']
217229 k(+1)*mu_z*mu_I-(1-delta)*k-mu_z*mu_I*(1-kappa/2*(x/x(-1)*mu_z-Lambdax)^2)*x=0;
218 //22. Profits
230 [name='Profits']
219231 F=yd-1/(1-alppha)*w*ld;
220 //23. definition optimal wage inflation
232 [name='definition optimal wage inflation']
221233 PIstarw=wstar/w;
222234
223235 //exogenous processes
224 //24. Preference Shock
236 [name='Preference Shock']
225237 log(d)=rhod*log(d(-1))+epsd;
226 //25. Labor disutility Shock
238 [name='Labor disutility Shock']
227239 log(phi)=rhophi*log(phi(-1))+epsphi;
228 //26. Investment specific technology
240 [name='Investment specific technology']
229241 log(mu_I)=Lambdamu+epsmu_I;
230 //27. Neutral technology
242 [name='Neutral technology']
231243 log(mu_A)=LambdaA+epsA;
232 //28. Defininition composite technology
244 [name='Defininition composite technology']
233245 mu_z=mu_A^(1/(1-alppha))*mu_I^(alppha/(1-alppha));
234246
235247 end;
1313 % - params [vector] vector of parameter values
1414 % - check [scalar] set to 0 if steady state computation worked and to
1515 % 1 of not (allows to impose restrictions on parameters)
16
17 % Copyright (C) 2013-2020 Dynare Team
18 %
19 % This file is part of Dynare.
20 %
21 % Dynare is free software: you can redistribute it and/or modify
22 % it under the terms of the GNU General Public License as published by
23 % the Free Software Foundation, either version 3 of the License, or
24 % (at your option) any later version.
25 %
26 % Dynare is distributed in the hope that it will be useful,
27 % but WITHOUT ANY WARRANTY; without even the implied warranty of
28 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 % GNU General Public License for more details.
30 %
31 % You should have received a copy of the GNU General Public License
32 % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
1633
1734 % read out parameters to access them with their name
1835 NumberOfParameters = M_.param_nbr;
246246 Copyright: 1996-2020 Dynare Team
247247 License: GFDL-NIV-1.3+
248248
249 Files: doc/dr.tex doc/dr.bib doc/bvar_a_la_sims.tex
249 Files: doc/dr.tex doc/dr.bib doc/bvar-a-la-sims.tex
250250 Copyright: 2007-2011 Sébastien Villemot
251251 License: GFDL-NIV-1.3+
252252
308308 License: BSD-2-clause
309309
310310 Files: preprocessor/m4/ax_boost_base.m4
311 preprocessor/m4/ax_boost_system.m4
312 preprocessor/m4/ax_boost_filesystem.m4
313311 Copyright: 2008-2009 Thomas Porschberg <thomas@randspringer.de>
314312 2009 Peter Adolphs
315 2008-2009 Michael Tindal
316 2008 Daniel Casimiro <dan.casimiro@gmail.com>
317 2009 Roman Rybalko <libtorrent@romanr.info>
318313 License: FSFAP
319314
320315 Files: preprocessor/m4/ax_cxx_compile_stdcxx.m4
343338 Copyright: 2007-2019 Dynare Team
344339 License: CC-BY-SA-4.0
345340
346 Files: contrib/jsonlab
341 Files: contrib/jsonlab/*
347342 Copyright: 2011-2018 Qianqian Fang <q.fang at neu.edu>
348343 License: BSD-2-clause or GPL-3+
349344
613608 material not subject to the license. This includes other CC-
614609 licensed material, or material used under an exception or
615610 limitation to copyright. More considerations for licensors:
616 wiki.creativecommons.org/Considerations_for_licensors
611 wiki.creativecommons.org/Considerations_for_licensors
617612 .
618613 Considerations for the public: By using one of our public
619614 licenses, a licensor grants the public permission to use the
629624 such as asking that all changes be marked or described.
630625 Although not required by our licenses, you are encouraged to
631626 respect those requests where reasonable. More_considerations
632 for the public:
633 wiki.creativecommons.org/Considerations_for_licensees
627 for the public:
628 wiki.creativecommons.org/Considerations_for_licensees
634629 .
635630 =======================================================================
636631 .
00 #!/usr/bin/env bash
11
2 # Copyright © 2019 Dynare Team
2 # Copyright © 2019-2020 Dynare Team
33 #
44 # This file is part of Dynare.
55 #
124124 cp "$ROOTDIR"/dynare++/doc/*.pdf "$PKGFILES"/doc/dynare++
125125
126126 cp "$ROOTDIR"/dynare++/src/dynare++ "$PKGFILES"/dynare++
127 cp "$ROOTDIR"/dynare++/dynare_simul/dynare_simul.m "$PKGFILES"/dynare++
127128
128129 mkdir -p "$PKGFILES"/matlab/modules/dseries/externals/x13/macOS/64
129130 cp -p "$ROOTDIR"/macOS/deps/lib64/x13as/x13as "$PKGFILES"/matlab/modules/dseries/externals/x13/macOS/64
1313 <choice id="org.dynare" title="Dynare" description="Dynare Required Files" start_enabled="false" enabled="false">
1414 <pkg-ref id="org.dynare" />
1515 </choice>
16 <choice id="org.dynare.gcc" title="GCC compiler for use_dll" description="This is necessary for the use of Dynare with the `use_dll` option. NB: This takes a few minutes and requires an active internet connection">
16 <choice id="org.dynare.gcc" title="GCC for `use_dll`" description="This is necessary for the use of Dynare with the `use_dll` option. NB: This takes a few minutes and requires an active internet connection.">
1717 <pkg-ref id="org.dynare.gcc" />
1818 </choice>
1919 <pkg-ref id="org.dynare" version="VERSION_NO_SPACE">dynare-VERSION_NO_SPACE.pkg</pkg-ref>
00 #!/usr/bin/env bash
11
2 # Copyright © 2019 Dynare Team
2 # Copyright © 2019-2020 Dynare Team
33 #
44 # This file is part of Dynare.
55 #
2828 rm -f "$2"/dummy
2929
3030 # Test for Internet connection
31 [[ -z $(curl -s -m 4 www.google.com) ]] && { echo "No internet connection found"; exit 1; }
31 [[ -z $(curl -s -m 4 https://github.com) ]] && \
32 { \
33 osascript -e 'display alert "Dynare Installation Error" message "Not able to connect to github.com. Either you are not connected to the internet or github.com is blocked where you are.\n\nAccess to GitHub is necessary to make Dynare work with the `use_dll` option on macOS.\n\nIf you cannot establish this connection or do not want to use the `use_dll` option of Dynare, please run the installer again and choose \"Customize\" from the \"Installation Type\" screen and uncheck the `GCC` option." as critical'; \
34 echo "No internet connection to github.com"; \
35 exit 1; \
36 }
3237
3338 # Install Command Line Tools
3439 if [[ -z $(/usr/bin/xcode-select -print-path) ]]; then
4853
4954 # If CLT installation didn't work, exit
5055 [[ -z $(/usr/bin/xcode-select -print-path) ]] && \
51 { echo "You must install Command Line Tools to proceed with installation of GCC"; exit 1; }
56 { \
57 osascript -e 'display alert "Dynare Installation Error" message "Not able to find Command Line Tools.\n\nCommand Line Tools is necessary to make Dynare work with the `use_dll` option on macOS.\n\nIf you cannot establish this connection or do not want to use the `use_dll` option of Dynare, please run the installer again and choose \"Customize\" from the \"Installation Type\" screen and uncheck the `GCC` option." as critical'; \
58 echo "Command Line Tools not installed"; \
59 exit 1; \
60 }
61
62 # Ensure git is in the path
63 [[ -z $(which git) ]] && \
64 { \
65 osascript -e 'display alert "Dynare Installation Error" message "Not able to find Git even though the Command Line Tools have already been installed. This is likely a problem with your PATH environment variable.\n\nGit is necessary to make Dynare work with the `use_dll` option on macOS.\n\nIf you cannot establish this connection or do not want to use the `use_dll` option of Dynare, please run the installer again and choose \"Customize\" from the \"Installation Type\" screen and uncheck the `GCC` option." as critical'; \
66 echo $PATH; \
67 echo "Git not found in PATH"; \
68 exit 1; \
69 }
5270
5371 # Install Homebrew
5472 BREWDIR="$2"/.brew
33 <p style="text-align: center;">Version VERSION_NO_SPACE</p>
44 <p style="text-align: center;">DATE</p>
55
6 <p><b>Just a few things to note</b>. This installation can be customized as you can choose not to install the GNU C Compiler (GCC). Installing GCC is necessary if you want to use the <tt>use_dll</tt> option in Dynare, but otherwise unnecessary.</p>
6 <p><b>Just a few things to note</b>. This installation can be customized as you can choose not to install the GNU Compiler Collection (GCC). Installing GCC is necessary if you want to use the <tt>use_dll</tt> option in Dynare, but otherwise unnecessary.</p>
77
88 <p>To install GCC we run a script that first installs the XCode Command Line Tools (an Apple product). The script then installs Homebrew, a package manager for macOS and, finally, GCC itself. Both Homebrew and GCC will be installed in your Dynare installation folder. So, when you delete this folder, they too will be deleted.</p>
99
10 <p>Installing GCC will require an active internet connection and will take a few minutes to a half an hour during the <i>Running package scripts</i> phase of Installation. The time it takes depends on your internet speed, the speed of your computer, and whether or not you already have XCode Command Line Tools installed. The progress bar will not advance during this phase. Please be patient.</p>
10 <p>Installing GCC will require an active internet connection with the ability to connect to the Apple servers and GitHub. The installation will take anywhere from a few minutes to a half an hour during the <i>Running package scripts</i> phase of Installation. The time it takes depends on your internet speed, the speed of your computer, and whether or not you already have XCode Command Line Tools installed. The progress bar will not advance during this phase. Please be patient.</p>
1111
1212 <p> You can choose not to install GCC by choosing <i>Customize</i> from the <i>Installation Type</i> screen and deselecting <i>GCC compiler</i>. If you already have <tt>GCC_BINARY</tt> installed under <tt>/usr/local</tt>, you can forgo the installation of GCC here as Dynare will find your system compiler when you use <tt>use_dll</tt>.</p>
1313 </body>
142142 end
143143 if info
144144 skipline()
145 message = get_error_message(info);
145 message = get_error_message(info,options_);
146146 fprintf('Cannot solve the model on the prior mode (info = %d, %s)\n', info(1), message);
147147 skipline()
148148 return
0 function [info, oo_, options_] = discretionary_policy(M_, options_, oo_, var_list)
1 % function [info, oo_, options_] = discretionary_policy(M_, options_, oo_, var_list)
0 function [info, oo_, options_, M_] = discretionary_policy(M_, options_, oo_, var_list)
1 % function [info, oo_, options_, M_] = discretionary_policy(M_, options_, oo_, var_list)
22 % INPUTS
33 % - M_ [structure] Matlab's structure describing the model (M_).
44 % - options_ [structure] Matlab's structure describing the current options (options_).
99 % - info [integer] scalar or vector, error code.
1010 % - oo_ [structure] Matlab's structure containing the results (oo_).
1111 % - options_ [structure] Matlab's structure describing the current options (options_).
12 % - M_ [structure] Matlab's structure describing the model (M_).
1213
13 % Copyright (C) 2007-2019 Dynare Team
14 % Copyright (C) 2007-2020 Dynare Team
1415 %
1516 % This file is part of Dynare.
1617 %
3233 origorder = options_.order;
3334 options_.discretionary_policy = 1;
3435 options_.order = 1;
35 [info, oo_] = stoch_simul(M_, options_, oo_, var_list);
36 [info, oo_, options_, M_] = stoch_simul(M_, options_, oo_, var_list);
3637
3738 if ~options_.noprint
3839 disp_steady_state(M_,oo_)
3232 persistent Hold
3333
3434 info = 0;
35
36 dr=oo_.dr; %initialize output argument
3537
3638 beta = get_optimal_policy_discount_factor(M_.params, M_.param_names);
3739
105107 [H,G,info]=discretionary_policy_engine(A.lag,A.contemp,A.lead,B,W,M_.instr_id,beta,options_.dp.maxit,options_.discretionary_tol,options_.qz_criterium);
106108 end
107109
108
109110 if info
110111 return
111112 else
114115 end
115116
116117 %write back solution to dr
117 dr=oo_.dr;
118118 dr.ys =zeros(M_.endo_nbr,1);
119119 dr=set_state_space(dr,M_,options_);
120120 T=H(dr.order_var,dr.order_var);
1818 % vartan [char] array of characters (with nvar rows).
1919 % NumberOfConditionalDecompFiles [integer] scalar, number of prior or posterior data files (for covariance).
2020
21 % Copyright (C) 2009-2015 Dynare Team
21 % Copyright (C) 2009-2020 Dynare Team
2222 %
2323 % This file is part of Dynare.
2424 %
3838
3939 % Get informations about the _posterior_draws files.
4040 if strcmpi(type,'posterior')
41 DrawsFiles = dir([M_.dname '/metropolis/' M_.fname '_' type '_draws*' ]);
41 NumberOfDrawsFiles = length(dir([M_.dname '/metropolis/' M_.fname '_' type '_draws*' ]));
4242 posterior = 1;
4343 elseif strcmpi(type,'prior')
44 DrawsFiles = dir([M_.dname '/prior/draws/' type '_draws*' ]);
44 NumberOfDrawsFiles = length(dir([M_.dname '/prior/draws/' type '_draws*' ]));
4545 CheckPath('prior/moments',M_.dname);
4646 posterior = 0;
4747 else
7777 nar = options_.ar;
7878 options_.ar = 0;
7979
80 NumberOfDrawsFiles = rows(DrawsFiles);
8180 NumberOfSavedElementsPerSimulation = nvar*M_.exo_nbr*length(Steps);
8281 MaXNumberOfConditionalDecompLines = ceil(options_.MaxNumberOfBytes/NumberOfSavedElementsPerSimulation/8);
8382
131130 linea_ME = 0;
132131 for file = 1:NumberOfDrawsFiles
133132 if posterior
134 load([M_.dname '/metropolis/' DrawsFiles(file).name ]);
133 load([M_.dname '/metropolis/' M_.fname '_' type '_draws' num2str(file) ]);
135134 else
136 load([M_.dname '/prior/draws/' DrawsFiles(file).name ]);
135 load([M_.dname '/prior/draws/' type '_draws' num2str(file) ]);
137136 end
138137 isdrsaved = columns(pdraws)-1;
139138 NumberOfDraws = rows(pdraws);
1616 % vartan [char] array of characters (with nvar rows).
1717 % CorrFileNumber [integer] scalar, number of prior or posterior data files (for correlation).
1818
19 % Copyright (C) 2007-2017 Dynare Team
19 % Copyright (C) 2007-2020 Dynare Team
2020 %
2121 % This file is part of Dynare.
2222 %
3737
3838 % Get informations about the _posterior_draws files.
3939 if strcmpi(type,'posterior')
40 DrawsFiles = dir([M_.dname '/metropolis/' M_.fname '_' type '_draws*' ]);
40 NumberOfDrawsFiles = length(dir([M_.dname '/metropolis/' M_.fname '_' type '_draws*' ]));
4141 posterior = 1;
4242 elseif strcmpi(type,'prior')
43 DrawsFiles = dir([M_.dname '/prior/draws/' type '_draws*' ]);
43 NumberOfDrawsFiles = length(dir([M_.dname '/prior/draws/' type '_draws*' ]));
4444 CheckPath('prior/moments',M_.dname);
4545 posterior = 0;
4646 else
4747 disp('dsge_simulated_theoretical_correlation:: Unknown type!');
4848 error()
4949 end
50 NumberOfDrawsFiles = length(DrawsFiles);
5150
5251 %delete old stale files before creating new ones
5352 if posterior
9493 linea = 0;
9594 for file = 1:NumberOfDrawsFiles
9695 if posterior
97 load([M_.dname '/metropolis/' DrawsFiles(file).name ]);
96 load([M_.dname '/metropolis/' M_.fname '_' type '_draws' num2str(file) ]);
9897 else
99 load([M_.dname '/prior/draws/' DrawsFiles(file).name]);
98 load([M_.dname '/prior/draws/' type '_draws' num2str(file) ]);
10099 end
101100 NumberOfDraws = rows(pdraws);
102101 isdrsaved = columns(pdraws)-1;
135134 end
136135 end
137136
138 options_.ar = oldnar;
137 options_.ar = oldnar;
1515 % vartan [char] array of characters (with nvar rows).
1616 % CovarFileNumber [integer] scalar, number of prior or posterior data files (for covariance).
1717
18 % Copyright (C) 2007-2017 Dynare Team
18 % Copyright (C) 2007-2020 Dynare Team
1919 %
2020 % This file is part of Dynare.
2121 %
3636
3737 % Get informations about the _posterior_draws files.
3838 if strcmpi(type,'posterior')
39 DrawsFiles = dir([M_.dname '/metropolis/' M_.fname '_' type '_draws*' ]);
39 NumberOfDrawsFiles = length(dir([M_.dname '/metropolis/' M_.fname '_' type '_draws*' ]));
4040 posterior = 1;
4141 elseif strcmpi(type,'prior')
42 DrawsFiles = dir([M_.dname '/prior/draws/' type '_draws*' ]);
42 NumberOfDrawsFiles = length(dir([M_.dname '/prior/draws/' type '_draws*' ]));
4343 CheckPath('prior/moments',M_.dname);
4444 posterior = 0;
4545 else
4646 disp('dsge_simulated_theoretical_covariance:: Unknown type!')
4747 error();
4848 end
49 NumberOfDrawsFiles = length(DrawsFiles);
5049
5150 %delete old stale files before creating new ones
5251 if posterior
9392 linea = 0;
9493 for file = 1:NumberOfDrawsFiles
9594 if posterior
96 load([M_.dname '/metropolis/' DrawsFiles(file).name ],'pdraws');
95 load([M_.dname '/metropolis/' M_.fname '_' type '_draws' num2str(file) ]);
9796 else
98 load([M_.dname '/prior/draws/' DrawsFiles(file).name ],'pdraws');
97 load([M_.dname '/prior/draws/' type '_draws' num2str(file) ]);
9998 end
10099 NumberOfDraws = rows(pdraws);
101100 isdrsaved = columns(pdraws)-1;
135134 end
136135 end
137136
138 options_.ar = nar;
137 options_.ar = nar;
1717 % vartan [char] array of characters (with nvar rows).
1818 % CovarFileNumber [integer] scalar, number of prior or posterior data files (for covariance).
1919
20 % Copyright (C) 2007-2017 Dynare Team
20 % Copyright (C) 2007-2020 Dynare Team
2121 %
2222 % This file is part of Dynare.
2323 %
3838
3939 % Get informations about the _posterior_draws files.
4040 if strcmpi(type,'posterior')
41 DrawsFiles = dir([M_.dname '/metropolis/' M_.fname '_' type '_draws*' ]);
41 NumberOfDrawsFiles = length(dir([M_.dname '/metropolis/' M_.fname '_' type '_draws*' ]));
4242 posterior = 1;
4343 elseif strcmpi(type,'prior')
44 DrawsFiles = dir([M_.dname '/prior/draws/' type '_draws*' ]);
44 NumberOfDrawsFiles = length(dir([M_.dname '/prior/draws/' type '_draws*' ]));
4545 CheckPath('prior/moments',M_.dname);
4646 posterior = 0;
4747 else
8080
8181 nexo = M_.exo_nbr;
8282
83 NumberOfDrawsFiles = rows(DrawsFiles);
8483 NumberOfSavedElementsPerSimulation = nvar*(nexo+1);
8584 MaXNumberOfDecompLines = ceil(options_.MaxNumberOfBytes/NumberOfSavedElementsPerSimulation/8);
8685
130129 only_non_stationary_vars=0;
131130 for file = 1:NumberOfDrawsFiles
132131 if posterior
133 load([M_.dname '/metropolis/' DrawsFiles(file).name ]);
132 load([M_.dname '/metropolis/' M_.fname '_' type '_draws' num2str(file) ]);
134133 else
135 load([M_.dname '/prior/draws/' DrawsFiles(file).name ]);
134 load([M_.dname '/prior/draws/' type '_draws' num2str(file) ]);
136135 end
137136 isdrsaved = columns(pdraws)-1;
138137 NumberOfDraws = rows(pdraws);
120120 oo.exo_det_steady_state], ...
121121 M,options_,~options_.steadystate.nocheck);
122122 if any(imag(x(1:M.orig_endo_nbr))) %return with penalty
123 resids=1+sum(abs(imag(x(1:M.orig_endo_nbr)))); %return with penalty
123 resids=ones(inst_nbr,1)+sum(abs(imag(x(1:M.orig_endo_nbr)))); %return with penalty
124124 steady_state=NaN(endo_nbr,1);
125125 return
126 end
127 if check %return
128 resids=ones(inst_nbr,1)+sum(abs(x(1:M.orig_endo_nbr))); %return with penalty
129 steady_state=NaN(endo_nbr,1);
130 return
126131 end
127132
128133 end
1111 % SPECIAL REQUIREMENTS
1212 % none
1313
14 % Copyright (C) 2003-2018 Dynare Team
14 % Copyright (C) 2003-2020 Dynare Team
1515 %
1616 % This file is part of Dynare.
1717 %
213213 end
214214 options_.mode_file = mode_file0;
215215 %reset stored mode-file to user defined one (and in case it was only set by the recursive estimation)
216 oo_.gui.ran_estimation = true;
217
438438 end
439439 % Tunes the jumping distribution's scale parameter
440440 if options_.mh_tune_jscale.status
441 if options_.posterior_sampler_options.posterior_sampling_method=='random_walk_metropolis_hastings'
441 if strcmp(options_.posterior_sampler_options.posterior_sampling_method, 'random_walk_metropolis_hastings')
442442 options = options_.mh_tune_jscale;
443443 options.rwmh = options_.posterior_sampler_options.rwmh;
444444 options_.mh_jscale = calibrate_mh_scale_parameter(objective_function, ...
460460 identification_analysis(params, indpmodel, indpstderr, indpcorr, options_ident, dataset_info, prior_exist, 1); %the 1 at the end implies initialization of persistent variables
461461 if info(1)~=0
462462 % there are errors in the solution algorithm
463 message = get_error_message(info,0,options_);
463 message = get_error_message(info,options_);
464464 fprintf('-----------\n');
465465 fprintf('The model does not solve for %s (info = %d: %s)\n', parameters, info(1), message);
466466 fprintf('-----------\n');
3636 % [1] This function use persistent variables for the dataset and the description of the missing observations. Consequently, if this function
3737 % is called more than once (by changing the value of parameters) the sample *must not* change.
3838
39 % Copyright (C) 2010-2017 Dynare Team
39 % Copyright (C) 2010-2020 Dynare Team
4040 %
4141 % This file is part of Dynare.
4242 %
110110
111111 %reset qz_criterium
112112 options_.qz_criterium=qz_criterium_old;
113 oo_.gui.ran_calib_smoother = true;
5858 % there are errors in the solution algorithm
5959 probl_par = get_the_name(j,varargin{5}.TeX,varargin{3},varargin{2},varargin{5});
6060 skipline()
61 message = get_error_message(info,0,varargin{5});
61 message = get_error_message(info,varargin{5});
6262 fprintf('Parameter error in numerical two-sided difference method:\n')
6363 fprintf('Cannot solve the model for %s (info = %d, %s)\n', probl_par, info(1), message);
6464 fprintf('Possible solutions:\n')
0 function message = get_error_message(info, noprint, DynareOptions)
0 function message = get_error_message(info, DynareOptions)
11 % Returns error messages
22 %
33 % INPUTS
44 % info [double] vector returned by resol.m
5 % noprint [integer] equal to 0 if the error message has to be printed.
65 % DynareOptions [structure] --> options_
76 % OUTPUTS
87 % message [string] corresponding error message
109 % SPECIAL REQUIREMENTS
1110 % none
1211
13 % Copyright (C) 2005-2019 Dynare Team
12 % Copyright (C) 2005-2020 Dynare Team
1413 %
1514 % This file is part of Dynare.
1615 %
2726 % You should have received a copy of the GNU General Public License
2827 % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
2928
30 if ~noprint
31 switch info(1)
32 case 0
33 message = '';
34 case 1
35 message = 'The model doesn''t determine the current variable uniquely.';
36 case 2
37 message = sprintf('The generalized Schur (QZ) decomposition failed. For more information, see the documentation for Lapack function dgges: info=%d, n=%d. You can also run model_diagnostics to get more information on what may cause this problem.', info(2), info(3));
38 case 3
39 message = 'Blanchard & Kahn conditions are not satisfied: no stable equilibrium.';
40 case 4
41 message = 'Blanchard & Kahn conditions are not satisfied: indeterminacy.';
42 case 5
43 message = 'Blanchard & Kahn conditions are not satisfied: indeterminacy due to rank failure.';
44 case 6
45 message = 'The Jacobian matrix evaluated at the steady state contains elements that are not real or are infinite.';
46 case 7
47 message = sprintf('One of the eigenvalues is close to 0/0 (the absolute value of numerator and denominator is smaller than %5.4f!\n If you believe that the model has a unique solution you can try to reduce the value of qz_zero_threshold.',DynareOptions.qz_zero_threshold);
48 case 8
49 if size(info,2)>=2
50 global M_;
51 disp_string = M_.param_names{info(2)};
52 for ii=1:length(info)-2
53 disp_string = [disp_string, ', ', M_.param_names{info(2+ii)}];
54 end
55 message = ['The Jacobian contains NaNs because the following parameters are NaN: ' disp_string];
56 else
57 message = 'The Jacobian contains NaNs. For more information, use options_.debug.';
29 switch info(1)
30 case 0
31 message = '';
32 case 1
33 message = 'The model doesn''t determine the current variable uniquely.';
34 case 2
35 message = sprintf('The generalized Schur (QZ) decomposition failed. For more information, see the documentation for Lapack function dgges: info=%d, n=%d. You can also run model_diagnostics to get more information on what may cause this problem.', info(2), info(3));
36 case 3
37 message = 'Blanchard & Kahn conditions are not satisfied: no stable equilibrium.';
38 case 4
39 message = 'Blanchard & Kahn conditions are not satisfied: indeterminacy.';
40 case 5
41 message = 'Blanchard & Kahn conditions are not satisfied: indeterminacy due to rank failure.';
42 case 6
43 message = 'The Jacobian matrix evaluated at the steady state contains elements that are not real or are infinite.';
44 case 7
45 message = sprintf('One of the eigenvalues is close to 0/0 (the absolute value of numerator and denominator is smaller than %5.4f!\n If you believe that the model has a unique solution you can try to reduce the value of qz_zero_threshold.',DynareOptions.qz_zero_threshold);
46 case 8
47 if size(info,2)>=2
48 global M_;
49 disp_string = M_.param_names{info(2)};
50 for ii=1:length(info)-2
51 disp_string = [disp_string, ', ', M_.param_names{info(2+ii)}];
5852 end
59 case 9
60 message = 'k_order_pert was unable to compute the solution';
61 case 10
62 message = 'The Jacobian of the dynamic model contains Inf. For more information, use options_.debug.';
63 case 11
64 message = 'The Hessian of the dynamic model used for second order solutions must not contain Inf';
65 case 12
66 message = 'The Hessian of the dynamic model used for second order solutions must not contain NaN';
67 case 19
68 message = 'The steadystate file did not compute the steady state';
69 case 20
70 if DynareOptions.linear
71 message = sprintf('Impossible to find the steady state (the sum of square residuals of the static equations is %5.4f). Either the model doesn''t have a steady state or there are an infinity of steady states Check whether your model is truly linear or whether there is a mistake in linearization.', info(2));
72 else
73 message = sprintf('Impossible to find the steady state (the sum of square residuals of the static equations is %5.4f). Either the model doesn''t have a steady state, there are an infinity of steady states, or the guess values are too far from the solution', info(2));
74 end
75 case 21
76 message = sprintf('The steady state is complex (the sum of square residuals of imaginary parts of the steady state is %5.4f)', info(2));
77 case 22
78 message = 'The steady state has NaNs or Inf.';
79 case 23
80 message = 'Parameters have been updated in the steadystate routine and some have complex values.';
81 case 24
82 message = 'Parameters have been updated in the steadystate routine and some are NaNs or Inf.';
83 case 25
84 message = 'The solution to the static equations is not a steady state of the dynamic model: verify that the equations tagged by [static] and [dynamic] are consistent';
85 case 26
86 message = 'The loglinearization of the model cannot be performed, because the steady state is not strictly positive.';
87 case 30
88 message = 'Ergodic variance can''t be computed.';
89 case 41
90 message = 'one (many) parameter(s) do(es) not satisfy the lower bound';
91 case 42
92 message = 'one (many) parameter(s) do(es) not satisfy the upper bound';
93 case 43
94 message = 'Covariance matrix of structural shocks is not positive definite';
95 case 44 %DsgeLikelihood_hh / dsge_likelihood
96 message = 'The covariance matrix of the measurement errors is not positive definite.';
97 case 45 %DsgeLikelihood_hh / dsge_likelihood
98 message = 'Likelihood is not a number (NaN) or a complex number';
99 case 46 %DsgeLikelihood_hh / dsge_likelihood
100 message = 'Likelihood is a complex number';
101 case 47 %DsgeLikelihood_hh / dsge_likelihood
102 message = 'Prior density is not a number (NaN)';
103 case 48 %DsgeLikelihood_hh / dsge_likelihood
104 message = 'Prior density is a complex number';
105 case 49
106 message = 'The model violates one (many) endogenous prior restriction(s)';
107 case 50
108 message = 'Likelihood is Inf';
109 case 51
110 message = sprintf('\n The dsge_prior_weight is dsge_var=%5.4f, but must be at least %5.4f for the prior to be proper.\n You are estimating a DSGE-VAR model, but the value of the dsge prior weight is too low!', info(2), info(3));
111 case 52 %dsge_var_likelihood
112 message = 'You are estimating a DSGE-VAR model, but the implied covariance matrix of the VAR''s innovations, based on artificial and actual sample is not positive definite!';
113 case 53 %dsge_var_likelihood
114 message = 'You are estimating a DSGE-VAR model, but the implied covariance matrix of the VAR''s innovations, based on the artificial sample, is not positive definite!';
115 case 55
116 message = 'Fast Kalman filter only works with stationary models [lik_init=1] or stationary observables for non-stationary models [lik_init=3]';
117 case 61 %Discretionary policy
118 message = 'Discretionary policy: maximum number of iterations has been reached. Procedure failed.';
119 case 62
120 message = 'Discretionary policy: some eigenvalues greater than options_.qz_criterium. Model potentially unstable.';
121 case 63
122 message = 'Discretionary policy: NaN elements are present in the solution. Procedure failed.';
123 case 64
124 message = 'discretionary_policy: the derivatives of the objective function contain NaN.';
125 case 65
126 message = 'discretionary_policy: the model must be written in deviation form and not have constant terms.';
127 case 66
128 message = 'discretionary_policy: the objective function must have zero first order derivatives.';
129 case 71
130 message = 'Calibrated covariance of the structural errors implies correlation larger than +-1.';
131 case 72
132 message = 'Calibrated covariance of the measurement errors implies correlation larger than +-1.';
133 % Aim Code Conversions by convertAimCodeToInfo.m
134 case 81
135 message = ['Ramsey: The solution to the static first order conditions for optimal policy could not be found. Either the model' ...
136 ' doesn''t have a steady state, there are an infinity of steady states, ' ...
137 ' or the guess values are too far from the solution'];
138 case 82
139 message = 'Ramsey: The steady state computation resulted in NaN in the static first order conditions for optimal policy';
140 case 83
141 message = 'Ramsey: The steady state computation resulted in NaN in the auxiliary equations for optimal policy';
142 case 84
143 message = 'Ramsey: The steady state file computation for the Ramsey problem resulted in NaNs at the initial values of the instruments';
144 case 85
145 message = 'Ramsey: The steady state file does not solve the static first order conditions conditional on the instruments.';
146 case 86
147 message = 'Ramsey: The steady state file provides complex numbers conditional on the instruments.';
148 case 87
149 message = 'Ramsey: The maximum number of iterations has been reached. Try increasing maxit.';
150 case 102
151 message = 'Aim: roots not correctly computed by real_schur';
152 case 103
153 message = 'Aim: too many explosive roots: no stable equilibrium';
154 case 135
155 message = 'Aim: too many explosive roots, and q(:,right) is singular';
156 case 104
157 message = 'Aim: too few explosive roots: indeterminacy';
158 case 145
159 message = 'Aim: too few explosive roots, and q(:,right) is singular';
160 case 105
161 message = 'Aim: q(:,right) is singular';
162 case 161
163 message = 'Aim: too many exact shiftrights';
164 case 162
165 message = 'Aim: too many numeric shiftrights';
166 case 163
167 message = 'Aim: A is NAN or INF.';
168 case 164
169 message = 'Aim: Problem in SPEIG.';
170 otherwise
171 message = 'This case shouldn''t happen. Contact the authors of Dynare';
172 end
53 message = ['The Jacobian contains NaNs because the following parameters are NaN: ' disp_string];
54 else
55 message = 'The Jacobian contains NaNs. For more information, use options_.debug.';
56 end
57 case 9
58 message = 'k_order_pert was unable to compute the solution';
59 case 10
60 message = 'The Jacobian of the dynamic model contains Inf. For more information, use options_.debug.';
61 case 11
62 message = 'The Hessian of the dynamic model used for second order solutions must not contain Inf';
63 case 12
64 message = 'The Hessian of the dynamic model used for second order solutions must not contain NaN';
65 case 19
66 message = 'The steadystate file did not compute the steady state';
67 case 20
68 if DynareOptions.linear
69 message = sprintf('Impossible to find the steady state (the sum of square residuals of the static equations is %5.4f). Either the model doesn''t have a steady state or there are an infinity of steady states Check whether your model is truly linear or whether there is a mistake in linearization.', info(2));
70 else
71 message = sprintf('Impossible to find the steady state (the sum of square residuals of the static equations is %5.4f). Either the model doesn''t have a steady state, there are an infinity of steady states, or the guess values are too far from the solution', info(2));
72 end
73 case 21
74 message = sprintf('The steady state is complex (the sum of square residuals of imaginary parts of the steady state is %5.4f)', info(2));
75 case 22
76 message = 'The steady state has NaNs or Inf.';
77 case 23
78 message = 'Parameters have been updated in the steadystate routine and some have complex values.';
79 case 24
80 message = 'Parameters have been updated in the steadystate routine and some are NaNs or Inf.';
81 case 25
82 message = 'The solution to the static equations is not a steady state of the dynamic model: verify that the equations tagged by [static] and [dynamic] are consistent';
83 case 26
84 message = 'The loglinearization of the model cannot be performed, because the steady state is not strictly positive.';
85 case 30
86 message = 'Ergodic variance can''t be computed.';
87 case 41
88 message = 'one (many) parameter(s) do(es) not satisfy the lower bound';
89 case 42
90 message = 'one (many) parameter(s) do(es) not satisfy the upper bound';
91 case 43
92 message = 'Covariance matrix of structural shocks is not positive definite';
93 case 44 %DsgeLikelihood_hh / dsge_likelihood
94 message = 'The covariance matrix of the measurement errors is not positive definite.';
95 case 45 %DsgeLikelihood_hh / dsge_likelihood
96 message = 'Likelihood is not a number (NaN) or a complex number';
97 case 46 %DsgeLikelihood_hh / dsge_likelihood
98 message = 'Likelihood is a complex number';
99 case 47 %DsgeLikelihood_hh / dsge_likelihood
100 message = 'Prior density is not a number (NaN)';
101 case 48 %DsgeLikelihood_hh / dsge_likelihood
102 message = 'Prior density is a complex number';
103 case 49
104 message = 'The model violates one (many) endogenous prior restriction(s)';
105 case 50
106 message = 'Likelihood is Inf';
107 case 51
108 message = sprintf('\n The dsge_prior_weight is dsge_var=%5.4f, but must be at least %5.4f for the prior to be proper.\n You are estimating a DSGE-VAR model, but the value of the dsge prior weight is too low!', info(2), info(3));
109 case 52 %dsge_var_likelihood
110 message = 'You are estimating a DSGE-VAR model, but the implied covariance matrix of the VAR''s innovations, based on artificial and actual sample is not positive definite!';
111 case 53 %dsge_var_likelihood
112 message = 'You are estimating a DSGE-VAR model, but the implied covariance matrix of the VAR''s innovations, based on the artificial sample, is not positive definite!';
113 case 55
114 message = 'Fast Kalman filter only works with stationary models [lik_init=1] or stationary observables for non-stationary models [lik_init=3]';
115 case 61 %Discretionary policy
116 message = 'Discretionary policy: maximum number of iterations has been reached. Procedure failed.';
117 case 62
118 message = 'Discretionary policy: some eigenvalues greater than options_.qz_criterium. Model potentially unstable.';
119 case 63
120 message = 'Discretionary policy: NaN elements are present in the solution. Procedure failed.';
121 case 64
122 message = 'discretionary_policy: the derivatives of the objective function contain NaN.';
123 case 65
124 message = 'discretionary_policy: the model must be written in deviation form and not have constant terms.';
125 case 66
126 message = 'discretionary_policy: the objective function must have zero first order derivatives.';
127 case 71
128 message = 'Calibrated covariance of the structural errors implies correlation larger than +-1.';
129 case 72
130 message = 'Calibrated covariance of the measurement errors implies correlation larger than +-1.';
131 % Aim Code Conversions by convertAimCodeToInfo.m
132 case 81
133 message = ['Ramsey: The solution to the static first order conditions for optimal policy could not be found. Either the model' ...
134 ' doesn''t have a steady state, there are an infinity of steady states, ' ...
135 ' or the guess values are too far from the solution'];
136 case 82
137 message = 'Ramsey: The steady state computation resulted in NaN in the static first order conditions for optimal policy';
138 case 83
139 message = 'Ramsey: The steady state computation resulted in NaN in the auxiliary equations for optimal policy';
140 case 84
141 message = 'Ramsey: The steady state file computation for the Ramsey problem resulted in NaNs at the initial values of the instruments';
142 case 85
143 message = 'Ramsey: The steady state file does not solve the static first order conditions conditional on the instruments.';
144 case 86
145 message = 'Ramsey: The steady state file provides complex numbers conditional on the instruments.';
146 case 87
147 message = 'Ramsey: The maximum number of iterations has been reached. Try increasing maxit.';
148 case 102
149 message = 'Aim: roots not correctly computed by real_schur';
150 case 103
151 message = 'Aim: too many explosive roots: no stable equilibrium';
152 case 135
153 message = 'Aim: too many explosive roots, and q(:,right) is singular';
154 case 104
155 message = 'Aim: too few explosive roots: indeterminacy';
156 case 145
157 message = 'Aim: too few explosive roots, and q(:,right) is singular';
158 case 105
159 message = 'Aim: q(:,right) is singular';
160 case 161
161 message = 'Aim: too many exact shiftrights';
162 case 162
163 message = 'Aim: too many numeric shiftrights';
164 case 163
165 message = 'Aim: A is NAN or INF.';
166 case 164
167 message = 'Aim: Problem in SPEIG.';
168 otherwise
169 message = 'This case shouldn''t happen. Contact the authors of Dynare';
173170 end
9292 oo_.exo_det_steady_state = [];
9393 oo_.exo_det_simul = [];
9494
95 oo_.gui.ran_estimation = false;
96 oo_.gui.ran_stoch_simul = false;
97 oo_.gui.ran_calib_smoother = false;
98 oo_.gui.ran_perfect_foresight = false;
99 oo_.gui.ran_shock_decomposition = false;
100 oo_.gui.ran_realtime_shock_decomposition = false;
101
95102 M_.params = [];
96103 M_.endo_histval = [];
97104 M_.exo_histval = [];
282282 end
283283 analytic_derivation = options_.analytic_derivation;
284284 options_.analytic_derivation = -2; %this sets asy_Hess=1 in dsge_likelihood.m
285 [info, oo_, options_] = stoch_simul(M_, options_, oo_, options_.varobs);
285 [info, oo_, options_, M_] = stoch_simul(M_, options_, oo_, options_.varobs);
286286 dataset_ = dseries(oo_.endo_simul(options_.varobs_id,100+1:end)',dates('1Q1'), options_.varobs); %get information on moments
287287 derivatives_info.no_DLIK = 1;
288288 bounds = prior_bounds(bayestopt_, options_.prior_trunc); %reset bounds as lb and ub must only be operational during mode-finding
7070
7171 % check if ys is steady state
7272 options.debug=1; %locally set debug option to 1
73 [dr.ys,params,check1]=evaluate_steady_state(oo.steady_state,M,options,oo,1);
73 [dr.ys,M.params,check1]=evaluate_steady_state(oo.steady_state,M,options,oo,options.steadystate.nocheck);
7474
7575 % testing for problem
7676 if check1(1)
6161 end
6262 osr_res = osr1(i_params,i_var,W);
6363
64 [~, oo_, options_] = stoch_simul(M_, options_, oo_, var_list);
64 [~, oo_, options_, M_] = stoch_simul(M_, options_, oo_, var_list);
1010 % None
1111 %
1212 %
13 % Copyright (C) 2009-2017 Dynare Team
13 % Copyright (C) 2009-2020 Dynare Team
1414 %
1515 % This file is part of Dynare.
1616 %
2727 % You should have received a copy of the GNU General Public License
2828 % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
2929
30 if nargin ==0
31 disp('dynareParallelDelete(fname)')
30 if nargin ~= 3
31 disp('dynareParallelDelete(fname,pname,Parallel)')
3232 return
3333 end
3434
35 if nargin ==1
36 pname='';
37 else
35 if ~isempty(pname)
3836 pname=[pname,filesep];
3937 end
4038
4139 for indPC=1:length(Parallel)
4240 if ~ispc || strcmpi('unix',Parallel(indPC).OperatingSystem)
4341 if ~isempty(Parallel(indPC).Port)
44 ssh_token = ['-p ',Parallel(indPC).Port];
42 ssh_token = ['-p ',Parallel(indPC).Port ' '];
4543 else
46 ssh_token = '';
44 ssh_token = ' ';
4745 end
48 [NonServeS NonServeD]=system(['ssh ',ssh_token,' ',Parallel(indPC).UserName,'@',Parallel(indPC).ComputerName,' rm -f ',Parallel(indPC).RemoteDirectory,'/',pname,fname]);
46 username = Parallel(indPC).UserName;
47 if ~isempty(username)
48 username = [username '@'];
49 end
50 directory = Parallel(indPC).RemoteDirectory;
51 if ~isempty(directory)
52 directory = [directory '/'];
53 end
54 [~, ~] = system(['ssh ',ssh_token,username,Parallel(indPC).ComputerName,' ''/bin/bash --norc -c "rm -f ',directory,pname,fname,'"''']);
4955 else
5056 fname_temp=['\\',Parallel(indPC).ComputerName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteDirectory,'\',pname,fname];
5157 if exist(fname_temp,'file')
1111 % SPECIAL REQUIREMENTS
1212 % none
1313
14 % Copyright (C) 1996-2019 Dynare Team
14 % Copyright (C) 1996-2020 Dynare Team
1515 %
1616 % This file is part of Dynare.
1717 %
225225
226226 ts = dseries(transpose(oo_.endo_simul), initial_period, M_.endo_names);
227227 assignin('base', 'Simulated_time_series', ts);
228 if oo_.deterministic_simulation.status
229 oo_.gui.ran_perfect_foresight = true;
230 end
1010 % SPECIAL REQUIREMENTS
1111 % none
1212
13 % Copyright (C) 2005-2019 Dynare Team
13 % Copyright (C) 2005-2020 Dynare Team
1414 %
1515 % This file is part of Dynare.
1616 %
2626 %
2727 % You should have received a copy of the GNU General Public License
2828 % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
29
30 message = get_error_message(info, noprint, DynareOptions);
31 error(message);
29 if ~noprint
30 message = get_error_message(info, DynareOptions);
31 error(message);
32 end
1818 % See the comments in the posterior_sampler.m funtion.
1919
2020
21 % Copyright (C) 2005-2018 Dynare Team
21 % Copyright (C) 2005-2020 Dynare Team
2222 %
2323 % This file is part of Dynare.
2424 %
293293 % which files have to be copied to run remotely
294294 NamFileInput(1,:) = {'',[M_.fname '.static.m']};
295295 NamFileInput(2,:) = {'',[M_.fname '.dynamic.m']};
296 if M.set_auxiliary_variables
296 if M_.set_auxiliary_variables
297297 NamFileInput(3,:) = {'',[M_.fname '.set_auxiliary_variables.m']};
298298 end
299299 if options_.steadystate_flag
3838 end
3939 end
4040
41 [info, oo_, options_] = stoch_simul(M_, options_, oo_, var_list);
41 [info, oo_, options_, M_] = stoch_simul(M_, options_, oo_, var_list);
4242
4343 oo_.steady_state = oo_.dr.ys;
4444
2121 % SPECIAL REQUIREMENTS
2222 % none
2323
24 % Copyright (C) 2009-2019 Dynare Team
24 % Copyright (C) 2009-2020 Dynare Team
2525 %
2626 % This file is part of Dynare.
2727 %
356356 if forecast_
357357 oo_.realtime_forecast_shock_decomposition.pool = zfrcst;
358358 end
359 oo_.gui.ran_realtime_shock_decomposition = true;
359360
360361 skipline()
2222 % SPECIAL REQUIREMENTS
2323 % none
2424
25 % Copyright (C) 2009-2019 Dynare Team
25 % Copyright (C) 2009-2020 Dynare Team
2626 %
2727 % This file is part of Dynare.
2828 %
140140 if ~options_.no_graph.shock_decomposition
141141 oo_ = plot_shock_decomposition(M_,oo_,options_,varlist);
142142 end
143
144 oo_.gui.ran_shock_decomposition = true;
0 function [info, oo_, options_] = stoch_simul(M_, options_, oo_, var_list)
0 function [info, oo_, options_, M_] = stoch_simul(M_, options_, oo_, var_list)
11
22 % Copyright (C) 2001-2020 Dynare Team
33 %
200200
201201 if options_.irf
202202 var_listTeX = M_.endo_names_tex(i_var);
203 if ~options_.nograph
203 if ~options_.nograph || (TeX && any(strcmp('eps',cellstr(options_.graph_format))))
204204 if ~exist([M_.fname '/graphs'],'dir')
205205 mkdir(M_.fname,'graphs');
206206 end
392392 options_ = options_old;
393393 % temporary fix waiting for local options
394394 options_.partial_information = 0;
395
396 oo_.gui.ran_stoch_simul = true;
725725 maintainer-clean-generic:
726726 @echo "This command is intended for maintainers to use"
727727 @echo "it deletes files that may require special tools to rebuild."
728 @HAVE_M2HTML_FALSE@clean-local:
728729 @HAVE_M2HTML_FALSE@html-local:
729 @HAVE_M2HTML_FALSE@clean-local:
730730 clean: clean-recursive
731731
732732 clean-am: clean-generic clean-local mostlyclean-am
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.69 for dynare 4.6.0.
2 # Generated by GNU Autoconf 2.69 for dynare 4.6.1.
33 #
44 #
55 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
576576 # Identity of this package.
577577 PACKAGE_NAME='dynare'
578578 PACKAGE_TARNAME='dynare'
579 PACKAGE_VERSION='4.6.0'
580 PACKAGE_STRING='dynare 4.6.0'
579 PACKAGE_VERSION='4.6.1'
580 PACKAGE_STRING='dynare 4.6.1'
581581 PACKAGE_BUGREPORT=''
582582 PACKAGE_URL=''
583583
13411341 # Omit some internal or obsolete options to make the list less imposing.
13421342 # This message is too long to be a string in the A/UX 3.1 sh.
13431343 cat <<_ACEOF
1344 \`configure' configures dynare 4.6.0 to adapt to many kinds of systems.
1344 \`configure' configures dynare 4.6.1 to adapt to many kinds of systems.
13451345
13461346 Usage: $0 [OPTION]... [VAR=VALUE]...
13471347
14121412
14131413 if test -n "$ac_init_help"; then
14141414 case $ac_init_help in
1415 short | recursive ) echo "Configuration of dynare 4.6.0:";;
1415 short | recursive ) echo "Configuration of dynare 4.6.1:";;
14161416 esac
14171417 cat <<\_ACEOF
14181418
15221522 test -n "$ac_init_help" && exit $ac_status
15231523 if $ac_init_version; then
15241524 cat <<\_ACEOF
1525 dynare configure 4.6.0
1525 dynare configure 4.6.1
15261526 generated by GNU Autoconf 2.69
15271527
15281528 Copyright (C) 2012 Free Software Foundation, Inc.
18961896 This file contains any messages produced by compilers while
18971897 running configure, to aid debugging if configure makes a mistake.
18981898
1899 It was created by dynare $as_me 4.6.0, which was
1899 It was created by dynare $as_me 4.6.1, which was
19001900 generated by GNU Autoconf 2.69. Invocation command line was
19011901
19021902 $ $0 $@
27602760
27612761 # Define the identity of the package.
27622762 PACKAGE='dynare'
2763 VERSION='4.6.0'
2763 VERSION='4.6.1'
27642764
27652765
27662766 cat >>confdefs.h <<_ACEOF
99169916 # report actual input values of CONFIG_FILES etc. instead of their
99179917 # values after options handling.
99189918 ac_log="
9919 This file was extended by dynare $as_me 4.6.0, which was
9919 This file was extended by dynare $as_me 4.6.1, which was
99209920 generated by GNU Autoconf 2.69. Invocation command line was
99219921
99229922 CONFIG_FILES = $CONFIG_FILES
99739973 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
99749974 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
99759975 ac_cs_version="\\
9976 dynare config.status 4.6.0
9976 dynare config.status 4.6.1
99779977 configured by $0, generated by GNU Autoconf 2.69,
99789978 with options \\"\$ac_cs_config\\"
99799979
1717 dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>.
1818
1919 AC_PREREQ([2.62])
20 AC_INIT([dynare], [4.6.0])
20 AC_INIT([dynare], [4.6.1])
2121 AC_CONFIG_SRCDIR([configure.ac])
2222 AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign])
2323
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.69 for dynare 4.6.0.
2 # Generated by GNU Autoconf 2.69 for dynare 4.6.1.
33 #
44 #
55 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
576576 # Identity of this package.
577577 PACKAGE_NAME='dynare'
578578 PACKAGE_TARNAME='dynare'
579 PACKAGE_VERSION='4.6.0'
580 PACKAGE_STRING='dynare 4.6.0'
579 PACKAGE_VERSION='4.6.1'
580 PACKAGE_STRING='dynare 4.6.1'
581581 PACKAGE_BUGREPORT=''
582582 PACKAGE_URL=''
583583
13251325 # Omit some internal or obsolete options to make the list less imposing.
13261326 # This message is too long to be a string in the A/UX 3.1 sh.
13271327 cat <<_ACEOF
1328 \`configure' configures dynare 4.6.0 to adapt to many kinds of systems.
1328 \`configure' configures dynare 4.6.1 to adapt to many kinds of systems.
13291329
13301330 Usage: $0 [OPTION]... [VAR=VALUE]...
13311331
13961396
13971397 if test -n "$ac_init_help"; then
13981398 case $ac_init_help in
1399 short | recursive ) echo "Configuration of dynare 4.6.0:";;
1399 short | recursive ) echo "Configuration of dynare 4.6.1:";;
14001400 esac
14011401 cat <<\_ACEOF
14021402
15021502 test -n "$ac_init_help" && exit $ac_status
15031503 if $ac_init_version; then
15041504 cat <<\_ACEOF
1505 dynare configure 4.6.0
1505 dynare configure 4.6.1
15061506 generated by GNU Autoconf 2.69
15071507
15081508 Copyright (C) 2012 Free Software Foundation, Inc.
18761876 This file contains any messages produced by compilers while
18771877 running configure, to aid debugging if configure makes a mistake.
18781878
1879 It was created by dynare $as_me 4.6.0, which was
1879 It was created by dynare $as_me 4.6.1, which was
18801880 generated by GNU Autoconf 2.69. Invocation command line was
18811881
18821882 $ $0 $@
27402740
27412741 # Define the identity of the package.
27422742 PACKAGE='dynare'
2743 VERSION='4.6.0'
2743 VERSION='4.6.1'
27442744
27452745
27462746 cat >>confdefs.h <<_ACEOF
93549354 # report actual input values of CONFIG_FILES etc. instead of their
93559355 # values after options handling.
93569356 ac_log="
9357 This file was extended by dynare $as_me 4.6.0, which was
9357 This file was extended by dynare $as_me 4.6.1, which was
93589358 generated by GNU Autoconf 2.69. Invocation command line was
93599359
93609360 CONFIG_FILES = $CONFIG_FILES
94119411 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
94129412 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
94139413 ac_cs_version="\\
9414 dynare config.status 4.6.0
9414 dynare config.status 4.6.1
94159415 configured by $0, generated by GNU Autoconf 2.69,
94169416 with options \\"\$ac_cs_config\\"
94179417
1717 dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>.
1818
1919 AC_PREREQ([2.62])
20 AC_INIT([dynare], [4.6.0])
20 AC_INIT([dynare], [4.6.1])
2121 AC_CONFIG_SRCDIR([configure.ac])
2222 AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign])
2323
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.69 for dynare-preprocessor 4.6.0.
2 # Generated by GNU Autoconf 2.69 for dynare-preprocessor 4.6.1.
33 #
44 #
55 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
576576 # Identity of this package.
577577 PACKAGE_NAME='dynare-preprocessor'
578578 PACKAGE_TARNAME='dynare-preprocessor'
579 PACKAGE_VERSION='4.6.0'
580 PACKAGE_STRING='dynare-preprocessor 4.6.0'
579 PACKAGE_VERSION='4.6.1'
580 PACKAGE_STRING='dynare-preprocessor 4.6.1'
581581 PACKAGE_BUGREPORT=''
582582 PACKAGE_URL=''
583583
13151315 # Omit some internal or obsolete options to make the list less imposing.
13161316 # This message is too long to be a string in the A/UX 3.1 sh.
13171317 cat <<_ACEOF
1318 \`configure' configures dynare-preprocessor 4.6.0 to adapt to many kinds of systems.
1318 \`configure' configures dynare-preprocessor 4.6.1 to adapt to many kinds of systems.
13191319
13201320 Usage: $0 [OPTION]... [VAR=VALUE]...
13211321
13871387
13881388 if test -n "$ac_init_help"; then
13891389 case $ac_init_help in
1390 short | recursive ) echo "Configuration of dynare-preprocessor 4.6.0:";;
1390 short | recursive ) echo "Configuration of dynare-preprocessor 4.6.1:";;
13911391 esac
13921392 cat <<\_ACEOF
13931393
14941494 test -n "$ac_init_help" && exit $ac_status
14951495 if $ac_init_version; then
14961496 cat <<\_ACEOF
1497 dynare-preprocessor configure 4.6.0
1497 dynare-preprocessor configure 4.6.1
14981498 generated by GNU Autoconf 2.69
14991499
15001500 Copyright (C) 2012 Free Software Foundation, Inc.
18301830 This file contains any messages produced by compilers while
18311831 running configure, to aid debugging if configure makes a mistake.
18321832
1833 It was created by dynare-preprocessor $as_me 4.6.0, which was
1833 It was created by dynare-preprocessor $as_me 4.6.1, which was
18341834 generated by GNU Autoconf 2.69. Invocation command line was
18351835
18361836 $ $0 $@
26942694
26952695 # Define the identity of the package.
26962696 PACKAGE='dynare-preprocessor'
2697 VERSION='4.6.0'
2697 VERSION='4.6.1'
26982698
26992699
27002700 cat >>confdefs.h <<_ACEOF
82208220 # report actual input values of CONFIG_FILES etc. instead of their
82218221 # values after options handling.
82228222 ac_log="
8223 This file was extended by dynare-preprocessor $as_me 4.6.0, which was
8223 This file was extended by dynare-preprocessor $as_me 4.6.1, which was
82248224 generated by GNU Autoconf 2.69. Invocation command line was
82258225
82268226 CONFIG_FILES = $CONFIG_FILES
82778277 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
82788278 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
82798279 ac_cs_version="\\
8280 dynare-preprocessor config.status 4.6.0
8280 dynare-preprocessor config.status 4.6.1
82818281 configured by $0, generated by GNU Autoconf 2.69,
82828282 with options \\"\$ac_cs_config\\"
82838283
1717 dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>.
1818
1919 AC_PREREQ([2.62])
20 AC_INIT([dynare-preprocessor], [4.6.0])
20 AC_INIT([dynare-preprocessor], [4.6.1])
2121 AC_CONFIG_AUX_DIR([build-aux])
2222 AC_CONFIG_SRCDIR([src/DynareMain.cc])
2323 AM_INIT_AUTOMAKE([1.11 -Wall -Wno-portability foreign no-dist-gzip dist-xz tar-pax])
667667
668668 options_list.writeOutput(output);
669669 symbol_list.writeOutput("var_list_", output);
670 output << "[info, oo_, options_] = stoch_simul(M_, options_, oo_, var_list_);" << endl;
670 output << "[info, oo_, options_, M_] = stoch_simul(M_, options_, oo_, var_list_);" << endl;
671671 }
672672
673673 void
10641064
10651065 options_list.writeOutput(output);
10661066 symbol_list.writeOutput("var_list_", output);
1067 output << "[info, oo_, options_] = discretionary_policy(M_, options_, oo_, var_list_);" << endl;
1067 output << "[info, oo_, options_, M_] = discretionary_policy(M_, options_, oo_, var_list_);" << endl;
10681068 }
10691069
10701070 void
46334633 }
46344634 if (lhs.first == -1)
46354635 {
4636 cerr << "walkPacParameters: error obtaining LHS varibale." << endl;
4636 cerr << "walkPacParameters: error obtaining LHS variable." << endl;
46374637 exit(EXIT_FAILURE);
46384638 }
46394639 if (ec_params_and_vars.second.empty() || ar_params_and_vars.empty())
385385 — except substituting out variables which we know are constant (they
386386 appear in an equation of the form: X = constant)
387387 — except adl operators which we always want expanded
388 — except predetermined variables (which must be handled before the call to
389 setLeadsLagsOrig(), see preprocessor#47)
388390 — except diff operators with a lead which have been expanded by
389391 DataTree:AddDiff()
390392 */
392394 dynamic_model.includeExcludeEquations(include_eqs, false);
393395 dynamic_model.simplifyEquations();
394396 dynamic_model.substituteAdl();
397 if (symbol_table.predeterminedNbr() > 0)
398 dynamic_model.transformPredeterminedVariables();
395399 dynamic_model.setLeadsLagsOrig();
396400 original_model = dynamic_model;
397401 dynamic_model.expandEqTags();
500504
501505 dynamic_model.addEquationsForVar();
502506
503 if (symbol_table.predeterminedNbr() > 0)
504 dynamic_model.transformPredeterminedVariables();
505
506507 // Create auxiliary vars for Expectation operator
507508 dynamic_model.substituteExpectation(mod_file_struct.partial_information);
508509
00 /*
1 * Copyright © 2003-2019 Dynare Team
1 * Copyright © 2003-2020 Dynare Team
22 *
33 * This file is part of Dynare.
44 *
177177 unique_symbols.push_back(it);
178178 else
179179 warnings << "WARNING: In " << dynare_command << ": " << it
180 << " found more than once in symbol list. Removing all but first occurence." << endl;
180 << " found more than once in symbol list. Removing all but first occurrence." << endl;
181181 symbols = unique_symbols;
182182 }
8787
8888 ;; Those keywords that makes the lexer enter the DYNARE_BLOCK start condition
8989 ;; Also include "verbatim" in this list
90 (defvar dynare-blocks
91 '("model" "steady_state_model" "initval" "endval" "histval" "shocks"
92 "shock_groups" "init2shocks" "mshocks" "estimated_params" "epilogue" "priors"
93 "estimated_params_init" "estimated_params_bounds" "osr_params_bounds"
94 "observation_trends" "optim_weights" "homotopy_setup"
95 "conditional_forecast_paths" "svar_identification" "moment_calibration"
96 "irf_calibration" "ramsey_constraints" "restrictions" "generate_irfs"
97 "verbatim")
98 "Dynare block keywords.")
90 ;; Needs to be enclosed within eval-when-compile, because this variable is
91 ;; referenced in another eval-when-compile statement in dynare-calculate-indentation
92 (eval-when-compile
93 (defvar dynare-blocks
94 '("model" "steady_state_model" "initval" "endval" "histval" "shocks"
95 "shock_groups" "init2shocks" "mshocks" "estimated_params" "epilogue" "priors"
96 "estimated_params_init" "estimated_params_bounds" "osr_params_bounds"
97 "observation_trends" "optim_weights" "homotopy_setup"
98 "conditional_forecast_paths" "svar_identification" "moment_calibration"
99 "irf_calibration" "ramsey_constraints" "restrictions" "generate_irfs"
100 "verbatim")
101 "Dynare block keywords."))
99102
100103 ;; Mathematical functions and operators used in model equations (see "hand_side" in Bison file)
101104 (defvar dynare-functions
228231 (add-to-list 'auto-mode-alist '("\\.mod$" . dynare-mode))
229232
230233 (provide 'dynare)
234
235 ;; The following line is for ELPA compatibility (in particular needed for Debian)
236 ;;; dynare.el ends here
9999 optimal_policy/Ramsey/ramsey_histval.mod \
100100 optimal_policy/Ramsey/Gali_commitment.mod \
101101 optimal_policy/RamseyConstraints/test1.mod \
102 optimal_policy/Ramsey/Ramsey_Example_estimation.mod \
102103 discretionary_policy/dennis_1.mod \
103104 discretionary_policy/dennis_1_estim.mod \
104105 discretionary_policy/Gali_discretion.mod \
112113 comments.mod \
113114 histval_sto.mod \
114115 histval_det.mod \
116 histval_predetermined.mod \
115117 auxiliary_variables/test1.mod \
116118 expectations/expectation.mod \
117119 expectations/expectation_ss.mod \
275277 ep/rbcii.mod \
276278 ep/linearmodel0.mod \
277279 ep/linearmodel1.mod \
280 stochastic_simulations/example1_noprint.mod \
278281 stochastic-backward-models/solow_cd.mod \
279282 stochastic-backward-models/solow_ces.mod \
280283 stochastic-backward-models/solow_cd_with_steadystate.mod \
364364 optimal_policy/Ramsey/ramsey_histval.mod \
365365 optimal_policy/Ramsey/Gali_commitment.mod \
366366 optimal_policy/RamseyConstraints/test1.mod \
367 optimal_policy/Ramsey/Ramsey_Example_estimation.mod \
367368 discretionary_policy/dennis_1.mod \
368369 discretionary_policy/dennis_1_estim.mod \
369370 discretionary_policy/Gali_discretion.mod \
377378 comments.mod \
378379 histval_sto.mod \
379380 histval_det.mod \
381 histval_predetermined.mod \
380382 auxiliary_variables/test1.mod \
381383 expectations/expectation.mod \
382384 expectations/expectation_ss.mod \
540542 ep/rbcii.mod \
541543 ep/linearmodel0.mod \
542544 ep/linearmodel1.mod \
545 stochastic_simulations/example1_noprint.mod \
543546 stochastic-backward-models/solow_cd.mod \
544547 stochastic-backward-models/solow_ces.mod \
545548 stochastic-backward-models/solow_cd_with_steadystate.mod \
0 /* Check that histval and predetermined_variables interact correctly, in the
1 case where no explicit lag appears in the model block (though lags appear
2 implicitly via the “predetermined_variables” statement).
3
4 This is a regression test for preprocessor#47.
5 */
6
7 var y, c, k, a, h, b;
8 varexo e, u;
9
10 predetermined_variables a b k;
11
12 parameters beta, rho, alpha, delta, theta, psi, tau;
13
14 alpha = 0.36;
15 rho = 0.95;
16 tau = 0.025;
17 beta = 0.99;
18 delta = 0.025;
19 psi = 0;
20 theta = 2.95;
21
22 phi = 0.1;
23
24 model;
25 c*theta*h^(1+psi)=(1-alpha)*y;
26 k(+1) = beta*(((exp(b(+1))*c)/(exp(b(+2))*c(+1)))
27 *(exp(b(+2))*alpha*y(+1)+(1-delta)*k(+1)));
28 y = exp(a(+1))*(k^alpha)*(h^(1-alpha));
29 k = exp(b(+1))*(y-c)+(1-delta)*k;
30 a(+1) = rho*a+ e;
31 b(+1) = rho*b+ u;
32 end;
33
34 initval;
35 y = 1.08068253095672;
36 c = 0.80359242014163;
37 h = 0.29175631001732;
38 k = 11.08360443260358;
39 a = 0;
40 b = 0;
41 e = 0;
42 u = 0;
43 end;
44
45 shocks;
46 var e; stderr 0.009;
47 var u; stderr 0.009;
48 var e, u = phi*0.009*0.009;
49 end;
50
51 histval;
52 b(0) = 0.1;
53 a(0) = 0.3;
54 end;
55
56 stoch_simul(nograph, periods = 200);
57
58 forecast;
59
129129
130130 for par_iter=1:size(par.pdraws,1)
131131 M_=set_parameters_locally(M_,par.pdraws{par_iter,1});
132 [info, oo_, options_]=stoch_simul(M_, options_, oo_, var_list_);
132 [info, oo_, options_, M_]=stoch_simul(M_, options_, oo_, var_list_);
133133 correlation(:,:,par_iter)=cell2mat(oo_.autocorr);
134134 covariance(:,:,par_iter)=oo_.var;
135135 conditional_variance_decomposition(:,:,:,par_iter)=oo_.conditional_variance_decomposition;
0 /*
1 * This file replicates the model studied in:
2 * Lawrence J. Christiano, Roberto Motto and Massimo Rostagno (2007):
3 * "Notes on Ramsey-Optimal Monetary Policy", Section 2
4 * The paper is available at http://faculty.wcas.northwestern.edu/~lchrist/d16/d1606/ramsey.pdf
5 *
6 * Notes:
7 * - This mod-files allows to simulate a simple New Keynesian Model with Rotemberg price
8 * adjustment costs under three different monetary policy arrangements:
9 * 1. a Taylor rule with a fixed inflation feedback coefficient alpha
10 * -> set the Optimal_policy switch to 0
11 * 2. a Taylor rule where the inflation feedback coefficient alpha is chosen
12 * optimally to minimize a quadratic loss function (optimal simple rule (OSR))
13 * -> set the Optimal_policy switch to 1 and the Ramsey switch to 0
14 * 3. fully optimal monetary under commitment (Ramsey)
15 * -> set the Optimal_policy switch to 1 and the Ramsey switch to 1
16 *
17 * - The Efficent_steady_state switch can be used to switch from an distorted steady state
18 * due to a monopolistic distortion to one where a labor subsidy counteracts this
19 * distortion. Note that the purely quadratic loss function in the OSR case does not capture
20 * the full welfare losses with a distorted steady state as there would be a linear term
21 * appearing.
22 *
23 * - This files shows how to use a conditional steady state file in the Ramsey case. It takes
24 * the value of the defined instrument R as given and then computes the rest of the steady
25 * state, including the steady state inflation rate, based on this value. The initial value
26 * of the instrument for steady state search must then be defined in an initval-block.
27 *
28 * - The optim_weights in the OSR case are based on a second order approximation to the welfare function
29 * as in Gali (2015). The relative weight between inflation and output gap volatility is essentially
30 * given by the slope of the New Keynesian Phillips Curve. Note that the linear terms that would be
31 * present in case of a distorted steady state need to be dropped for OSR.
32 *
33 * - Due to divine coincidence, the first best policy involves fully stabilizing inflation
34 * and thereby the output gap. As a consequence, the optimal inflation feedback coefficient
35 * in a Taylor rule would be infinity. The OSR command therefore estimates it to be at the
36 * upper bound defined via osr_params_bounds.
37 *
38 * - The mod-file also allows to conduct estimation under Ramsey policy by setting the
39 * Estimation_under_Ramsey switch to 1.
40 *
41 * This implementation was written by Johannes Pfeifer.
42 *
43 * If you spot mistakes, email me at jpfeifer@gmx.de
44 *
45 * Please note that the following copyright notice only applies to this Dynare
46 * implementation of the model.
47 */
48
49 /*
50 * Copyright (C) 2019 Dynare Team
51 *
52 * This is free software: you can redistribute it and/or modify
53 * it under the terms of the GNU General Public License as published by
54 * the Free Software Foundation, either version 3 of the License, or
55 * (at your option) any later version.
56 *
57 * It is distributed in the hope that it will be useful,
58 * but WITHOUT ANY WARRANTY; without even the implied warranty of
59 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
60 * GNU General Public License for more details.
61 *
62 * For a copy of the GNU General Public License,
63 * see <http://www.gnu.org/licenses/>.
64 */
65
66 //**********Define which monetary policy setup to use ***********
67
68 @#ifndef Optimal_policy
69 @#define Optimal_policy=1
70 @#ifndef Ramsey
71 @#define Ramsey=1
72 @#endif
73 @#endif
74
75 //**********Define whether to use distorted steady state***********
76
77 @#ifndef Efficent_steady_state
78 @#define Efficent_steady_state=0
79 @#endif
80
81 @#ifndef Estimation_under_Ramsey
82 @#define Estimation_under_Ramsey=1
83 @#endif
84
85 var C $C$ (long_name='Consumption')
86 pi $\pi$ (long_name='Gross inflation')
87 h $h$ (long_name='hours worked')
88 Z $Z$ (long_name='TFP')
89 R $R$ (long_name='Net nominal interest rate')
90 log_C ${\ln C}$ (long_name='Log Consumption')
91 log_h ${\ln h}$ (long_name='Log hours worked')
92 pi_ann ${\pi^{ann}}$ (long_name='Annualized net inflation')
93 R_ann ${R^{ann}}$ (long_name='Annualized net nominal interest rate')
94 r_real ${r^{ann,real}}$ (long_name='Annualized net real interest rate')
95 y_nat ${y^{nat}}$ (long_name='Natural (flex price) output')
96 y_gap ${r^{gap}}$ (long_name='Output gap')
97 ;
98
99 varexo epsilon ${\varepsilon}$ (long_name='TFP shock')
100 ;
101
102 parameters beta ${\beta}$ (long_name='discount factor')
103 theta ${\theta}$ (long_name='substitution elasticity')
104 tau ${\tau}$ (long_name='labor subsidy')
105 chi ${\chi}$ (long_name='labor disutility')
106 phi ${\phi}$ (long_name='price adjustment costs')
107 rho ${\rho}$ (long_name='TFP autocorrelation')
108 @# if !defined(Ramsey) || Ramsey==0
109 pi_star ${\pi^*}$ (long_name='steady state inflation')
110 alpha ${\alpha}$ (long_name='inflation feedback Taylor rule')
111 @# endif
112 ;
113
114 beta=0.99;
115 theta=5;
116 phi=100;
117 rho=0.9;
118 @# if !defined(Ramsey) || Ramsey==0
119 alpha=1.5;
120 pi_star=1;
121 @# endif
122 @# if Efficent_steady_state
123 tau=1/(theta-1);
124 @# else
125 tau=0;
126 @# endif
127 chi=1;
128
129 model;
130 [name='Euler equation']
131 1/(1+R)=beta*C/(C(+1)*pi(+1));
132 [name='Firm FOC']
133 (tau-1/(theta-1))*(1-theta)+theta*(chi*h*C/(exp(Z))-1)=phi*(pi-1)*pi-beta*phi*(pi(+1)-1)*pi(+1);
134 [name='Resource constraint']
135 C*(1+phi/2*(pi-1)^2)=exp(Z)*h;
136 [name='TFP process']
137 Z=rho*Z(-1)+epsilon;
138 @#if !defined(Ramsey) || Ramsey==0
139 [name='Taylor rule']
140 R=pi_star/beta-1+alpha*(pi-pi_star);
141 @#endif
142 [name='Definition log consumption']
143 log_C=log(C);
144 [name='Definition log hours worked']
145 log_h=log(h);
146 [name='Definition annualized inflation rate']
147 pi_ann=4*log(pi);
148 [name='Definition annualized nominal interest rate']
149 R_ann=4*R;
150 [name='Definition annualized real interest rate']
151 r_real=4*log((1+R)/pi(+1));
152 [name='Definition natural output']
153 y_nat=exp(Z)*sqrt((theta-1)/theta*(1+tau)/chi);
154 [name='output gap']
155 y_gap=log_C-log(y_nat);
156 end;
157
158 steady_state_model;
159 Z=0;
160 @# if !defined(Ramsey) || Ramsey==0
161 R=pi_star/beta-1; %only set this if not conditional steady state file for Ramsey
162 @# endif
163 pi=(R+1)*beta;
164 C=sqrt((1+1/theta*((1-beta)*(pi-1)*pi-(tau-1/(theta-1))*(1-theta)))/(chi*(1+phi/2*(pi-1)^2)));
165 h=C*(1+phi/2*(pi-1)^2);
166 log_C=log(C);
167 log_h=log(h);
168 pi_ann=4*log(pi);
169 R_ann=4*R;
170 r_real=4*log((1+R)/pi);
171 y_nat=sqrt((theta-1)/theta*(1+tau)/chi);
172 y_gap=log_C-log(y_nat);
173 end;
174
175 @# if defined(Ramsey) && Ramsey==1
176 //define initial value of instrument for Ramsey
177 initval;
178 R=1/beta-1;
179 end;
180 @# endif
181
182 shocks;
183 var epsilon = 0.01^2;
184 end;
185
186 @#if Optimal_policy==0
187 //use Taylor rule
188 stoch_simul(order=2) pi_ann log_h R_ann log_C Z r_real y_nat;
189 @#else
190 @# if !defined(Ramsey) || Ramsey==0
191 //use OSR Taylor rule
192
193 //set weights on (co-)variances for OSR
194 optim_weights;
195 pi theta/((theta-1)/phi);
196 y_gap 1;
197 end;
198
199 //define OSR parameters to be optimized
200 osr_params alpha;
201
202 //starting value for OSR parameter
203 alpha = 1.5;
204
205 //define bounds for OSR during optimization
206 osr_params_bounds;
207 alpha, 0, 100;
208 end;
209
210 //compute OSR and provide output
211 osr(opt_algo=9) pi_ann log_h R_ann log_C Z r_real;
212
213 @# else
214 //use Ramsey optimal policy
215
216 //define planner objective, which corresponds to utility function of agents
217 planner_objective log(C)-chi/2*h^2;
218
219 //set up Ramsey optimal policy problem with interest rate R as the instrument,...
220 // defining the discount factor in the planner objective to be the one of private agents
221 ramsey_model(instruments=(R),planner_discount=beta,planner_discount_latex_name=$\beta$);
222
223 //conduct stochastic simulations of the Ramsey problem
224 stoch_simul(order=1,irf=20,periods=500) pi_ann log_h R_ann log_C Z r_real;
225 evaluate_planner_objective;
226
227 @# if Estimation_under_Ramsey==1
228 datatomfile('ramsey_simulation',{'log_C'})
229
230 estimated_params;
231 rho,0.5,uniform_pdf, , ,0,1;
232 end;
233 varobs log_C;
234
235 estimation(datafile=ramsey_simulation,mode_compute=5,mh_nblocks=1,mh_replic=0);
236 @# endif
237 @# endif
238 @# endif
239
240 write_latex_static_model(write_equation_tags);
241 write_latex_dynamic_model(write_equation_tags);
242 write_latex_original_model(write_equation_tags);
243 write_latex_steady_state_model;
244
245 collect_latex_files;
246 if system(['pdflatex -halt-on-error -interaction=batchmode ' M_.fname '_TeX_binder.tex'])
247 error('TeX-File did not compile.')
248 end
0 /*
1 * Example 1 from F. Collard (2001): "Stochastic simulations with DYNARE:
2 * A practical guide" (see "guide.pdf" in the documentation directory).
3 */
4
5 /*
6 * Copyright (C) 2001-2010 Dynare Team
7 *
8 * This file is part of Dynare.
9 *
10 * Dynare is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Dynare is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Dynare. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24
25 var y, c, k, a, h, b;
26 varexo e, u;
27
28 parameters beta, rho, alpha, delta, theta, psi, tau;
29
30 alpha = -0.36; // changed "0.36" to "-0.36" to generate an error
31 rho = 0.95;
32 tau = 0.025;
33 beta = 0.99;
34 delta = 0.025;
35 psi = 0;
36 theta = 2.95;
37
38 phi = 0.1;
39
40 model;
41 c*theta*h^(1+psi)=(1-alpha)*y;
42 k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))
43 *(exp(b(+1))*alpha*y(+1)+(1-delta)*k));
44 y = exp(a)*(k(-1)^alpha)*(h^(1-alpha));
45 k = exp(b)*(y-c)+(1-delta)*k(-1);
46 a = rho*a(-1)+tau*b(-1) + e;
47 b = tau*a(-1)+rho*b(-1) + u;
48 end;
49
50 initval;
51 y = 1.08068253095672;
52 c = 0.80359242014163;
53 h = 0.29175631001732;
54 k = 11.08360443260358;
55 a = 0;
56 b = 0;
57 e = 0;
58 u = 0;
59 end;
60
61 shocks;
62 var e; stderr 0.009;
63 var u; stderr 0.009;
64 var e, u = phi*0.009*0.009;
65 end;
66
67 stoch_simul(noprint); // added "noprint"
44 # The binaries are cross compiled for Windows (32/64bits), Octave and MATLAB
55 # (all supported versions).
66
7 # Copyright © 2017-2019 Dynare Team
7 # Copyright © 2017-2020 Dynare Team
88 #
99 # This file is part of Dynare.
1010 #
269269 mkdir -p "$ZIPDIR"/scripts
270270 cp -p scripts/dynare.el "$ZIPDIR"/scripts
271271 mkdir "$ZIPDIR"/dynare++
272 cp -pr dynare++/32-bit/ dynare++/64-bit/ "$ZIPDIR"/dynare++
272 cp -pr dynare++/32-bit/ dynare++/64-bit/ dynare++/dynare_simul/dynare_simul.m "$ZIPDIR"/dynare++
273273 mkdir -p "$ZIPDIR"/doc/dynare++
274274 mkdir -p "$ZIPDIR"/doc/dynare-manual.html
275275 cp -pr doc/manual/build/html/* "$ZIPDIR"/doc/dynare-manual.html
157157 SetOutPath $INSTDIR\dynare++\64-bit
158158 File ..\dynare++\64-bit\dynare++.exe
159159
160 SetOutPath $INSTDIR\dynare++
161 File ..\dynare++\dynare_simul\dynare_simul.m
162
160163 SetOutPath $INSTDIR\doc\dynare++
161164 File ..\dynare++\doc\*.pdf
162165