Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • nowaitbar
  • master
  • sparse-tree
  • sparse-sep
  • isfile
  • nlf-fixes
  • newton-quadratic-equation-solver
  • nlf-fixes-r
  • nls-fixes
  • sep-fixes
  • sep
  • use-dprior
  • ep-sparse
  • rebase-1
  • parfor
  • reset-seed-in-unit-tests
  • remove-persistent-variables
  • nonlinear-filter-fixes
  • pac-mce-with-composite-target
  • 6.x
  • dprior
  • covariance-quadratic-approximation
  • benchmark-ec
  • kalman_mex
  • 5.x
  • remove-priordens
  • mr#2134
  • silicon
  • silicon-new-samplers
  • new-samplers
  • asm
  • time-varying-information-set
  • 4.6
  • dynare_minreal
  • dragonfly
  • various_fixes
  • 4.5
  • clang+openmp
  • dynamic-striated
  • occbin
  • exo_steady_state
  • filter_initial_state
  • declare_vars_in_model_block
  • exceptions
  • rmExtraExo
  • julia
  • error_msg_undeclared_model_vars
  • static_aux_vars
  • slice
  • aux_func
  • penalty
  • 4.4
  • separateM_
  • estim_params
  • dmm
  • sphinx-doc-experimental
  • gpm-optimal-policy
  • dates-and-dseries-improvements
  • 4.3
  • eigen
  • mex-GetPowerDeriv
  • 3.062
  • 3.063
  • 4.0.0
  • 4.0.1
  • 4.0.2
  • 4.0.3
  • 4.0.4
  • 4.1-alpha1
  • 4.1-alpha2
  • 4.1.0
  • 4.1.1
  • 4.1.2
  • 4.1.3
  • 4.2.0
  • 4.2.1
  • 4.2.2
  • 4.2.3
  • 4.2.4
  • 4.2.5
  • 4.3.0
  • 4.3.1
  • 4.3.2
  • 4.3.3
  • 4.4-beta1
  • 4.4.0
  • 4.4.1
  • 4.4.2
  • 4.4.3
  • 4.5.0
  • 4.5.1
  • 4.5.2
  • 4.5.3
  • 4.5.4
  • 4.5.5
  • 4.5.6
  • 4.5.7
  • 4.6-beta1
  • 4.6.0
  • 4.6.0-rc1
  • 4.6.0-rc2
  • 4.6.1
  • 4.6.2
  • 4.6.3
  • 4.6.4
  • 4.7-beta1
  • 4.7-beta2
  • 4.7-beta3
  • 5.0
  • 5.0-rc1
  • 5.1
  • 5.2
  • 5.3
  • 5.4
  • 5.5
115 results

Target

Select target project
  • Dynare / dynare
  • MichelJuillard / dynare
  • Mark Song / dynare
  • FerhatMihoubi / dynare
  • Sébastien Villemot / dynare
  • Johannes Pfeifer / dynare
  • Willi Mutschler / dynare
  • Marco Ratto / dynare
  • Wenddy SHu / dynare
  • Frédéric Karamé / dynare
  • Sumudu Kankanamge / dynare
  • Camilo Marchesini / dynare
  • Dóra Kocsis / dynare
  • Alexander Tishin / dynare
  • jeffjiang07 / dynare
  • Ethan Lin / dynare
  • Normann Rion / dynare
  • Selma Malmberg / dynare
  • Claudio Marcelo Olguin Ribera / dynare
  • Minje Jeon / dynare
20 results
Select Git revision
  • master
  • 6.x
  • pardiso+paru
  • mkl-pardiso
  • madysson
  • 5.x
  • asm
  • time-varying-information-set
  • 4.6
  • dynare_minreal
  • dragonfly
  • various_fixes
  • 4.5
  • clang+openmp
  • exo_steady_state
  • declare_vars_in_model_block
  • julia
  • error_msg_undeclared_model_vars
  • static_aux_vars
  • slice
  • aux_func
  • penalty
  • 4.4
  • separateM_
  • estim_params
  • dmm
  • sphinx-doc-experimental
  • gpm-optimal-policy
  • dates-and-dseries-improvements
  • 4.3
  • eigen
  • mex-GetPowerDeriv
  • 3.062
  • 3.063
  • 4.0.0
  • 4.0.1
  • 4.0.2
  • 4.0.3
  • 4.0.4
  • 4.1-alpha1
  • 4.1-alpha2
  • 4.1.0
  • 4.1.1
  • 4.1.2
  • 4.1.3
  • 4.2.0
  • 4.2.1
  • 4.2.2
  • 4.2.3
  • 4.2.4
  • 4.2.5
  • 4.3.0
  • 4.3.1
  • 4.3.2
  • 4.3.3
  • 4.4-beta1
  • 4.4.0
  • 4.4.1
  • 4.4.2
  • 4.4.3
  • 4.5.0
  • 4.5.1
  • 4.5.2
  • 4.5.3
  • 4.5.4
  • 4.5.5
  • 4.5.6
  • 4.5.7
  • 4.6-beta1
  • 4.6.0
  • 4.6.0-rc1
  • 4.6.0-rc2
  • 4.6.1
  • 4.6.2
  • 4.6.3
  • 4.6.4
  • 4.7-beta1
  • 4.7-beta2
  • 4.7-beta3
  • 5.0
  • 5.0-rc1
  • 5.1
  • 5.2
  • 5.3
  • 5.4
  • 5.5
  • 6-beta1
  • 6-beta2
  • 6.0
  • 6.1
  • 6.2
  • 6.3
  • 6.4
93 results
Show changes
319 files
+ 4311
18097
Compare changes
  • Side-by-side
  • Inline

Files

+4 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ checksum
/doc/dynare.info
/doc/dynare.info-1
/doc/dynare.info-2
/doc/dynare.info-3
/doc/dynare.cp
/doc/dynare.fn
/doc/dynare.fns
@@ -212,3 +213,6 @@ tests/julia/rbc/rbc*.jl

# Octave variables saved when Octave crashes
octave-workspace

# VERSION generated file
VERSION
 No newline at end of file

.gitlab-ci.yml

0 → 100644
+82 −0
Original line number Diff line number Diff line
variables:
  GIT_SUBMODULE_STRATEGY: normal
  TERM: linux

build_binaries:
  stage: build
  script:
    - autoreconf -si
    - './configure --with-matlab=$(dirname $(dirname $(readlink -f `which matlab`))) MATLAB_VERSION=$(echo version | matlab -nodesktop -nodisplay -nosplash 2>/dev/null | sed -En "/ans\ =/!d;n;n;s/^[^0-9]*([0-9]+\.[0-9]+).*$/\1/;p")'
    - make -j $(nproc) LN_S="cp -p"
  artifacts:
    paths:
      - matlab/preprocessor*/*
      - mex/octave/
      - mex/matlab/
      - dynare++/src/dynare++
    expire_in: 1 week

build_doc:
  stage: build
  script:
    - autoreconf -si
    - ./configure --disable-matlab --disable-octave
    - make -j $(nproc) info pdf html
  artifacts:
    paths:
      - doc/dynare.info*
      - doc/dynare.html
      - doc/dynare.pdf

testsuite_matlab:
  stage: test
  script:
    - autoreconf -si
    - './configure --disable-octave --with-matlab=$(dirname $(dirname $(readlink -f `which matlab`))) MATLAB_VERSION=$(echo version | matlab -nodesktop -nodisplay -nosplash 2>/dev/null | sed -En "/ans\ =/!d;n;n;s/^[^0-9]*([0-9]+\.[0-9]+).*$/\1/;p")'
    - make -j $(($(nproc) * 3 / 4)) -C tests check-matlab
  artifacts:
    paths:
      - tests/*.m.log
      - tests/*.m.trs
      - tests/*/*.m.log
      - tests/*/*.m.trs
      - tests/*/*/*.m.log
      - tests/*/*/*.m.trs
      - tests/run_test_matlab_output.txt
    when: always
  dependencies:
    - build_binaries

.testsuite_octave_template:
  stage: test
  variables:
    OPENBLAS_NUM_THREADS: 1
  script:
    - autoreconf -si
    - ./configure --disable-matlab
    - make -j $(nproc) -C tests check-octave
  artifacts:
    paths:
      - tests/*.o.log
      - tests/*.o.trs
      - tests/*/*.o.log
      - tests/*/*.o.trs
      - tests/*/*/*.o.log
      - tests/*/*/*.o.trs
      - tests/run_test_octave_output.txt
    when: always
  dependencies:
    - build_binaries

testsuite_octave_auto:
  extends: .testsuite_octave_template
  only:
    - tags
    - schedules

testsuite_octave_manual:
  extends: .testsuite_octave_template
  except:
    - tags
    - schedules
  when: manual
+8 −11
Original line number Diff line number Diff line
[submodule "contrib/ms-sbvar/utilities_dw"]
	path = contrib/ms-sbvar/utilities_dw
	url = http://www.dynare.org/git/frbatlanta/utilities_dw.git
	url = https://git.dynare.org/contrib/utilities_dw.git
[submodule "contrib/ms-sbvar/switch_dw"]
	path = contrib/ms-sbvar/switch_dw
	url = http://www.dynare.org/git/frbatlanta/switch_dw.git
	url = https://git.dynare.org/contrib/switch_dw.git
[submodule "contrib/ms-sbvar/TZcode"]
	path = contrib/ms-sbvar/TZcode
	url = http://www.dynare.org/git/frbatlanta/TZcode.git
[submodule "contrib/dmm"]
	path = contrib/dmm
	url = http://www.dynare.org/git/dmm.git
	url = https://git.dynare.org/contrib/TZcode.git
[submodule "matlab/utilities/tests"]
	path = matlab/utilities/tests
	url = https://github.com/DynareTeam/m-unit-tests.git
	url = https://git.dynare.org/Dynare/m-unit-tests.git
[submodule "matlab/particles"]
	path = matlab/particles
	url = https://github.com/DynareTeam/particles.git
	url = https://git.dynare.org/Dynare/particles.git
[submodule "matlab/modules/dates"]
	path = matlab/modules/dates
	url = https://github.com/DynareTeam/dates.git
	url = https://git.dynare.org/Dynare/dates.git
	branch = old-oop-style
[submodule "matlab/modules/dseries"]
	path = matlab/modules/dseries
	url = https://github.com/DynareTeam/dseries.git
	url = https://git.dynare.org/Dynare/dseries.git
	branch = old-oop-style
[submodule "matlab/modules/reporting"]
	path = matlab/modules/reporting
	url = https://github.com/DynareTeam/reporting.git
 No newline at end of file
	url = https://git.dynare.org/Dynare/reporting.git
 No newline at end of file
+9 −9
Original line number Diff line number Diff line
@@ -10,13 +10,13 @@ If something is not clear, don't hesitate to ask if you can't find the answer on

Please note that the repositories under the purview of this page are:

* [Dynare](https://github.com/DynareTeam/dynare)
* [Particles](https://github.com/DynareTeam/particles)
* [Dates](https://github.com/DynareTeam/dates)
* [Dseries](https://github.com/DynareTeam/dseries)
* [Reporting](https://github.com/DynareTeam/reporting)
* [Testsuite](https://github.com/DynareTeam/testsuite)
* [M-unit-tests](https://github.com/DynareTeam/m-unit-tests)
* [Dynare](https://git.dynare.org/Dynare/dynare)
* [Particles](https://git.dynare.org/Dynare/particles)
* [Dates](https://git.dynare.org/Dynare/dates)
* [Dseries](https://git.dynare.org/Dynare/dseries)
* [Reporting](https://git.dynare.org/Dynare/reporting)
* [Testsuite](https://git.dynare.org/Dynare/testsuite)
* [M-unit-tests](https://git.dynare.org/Dynare/m-unit-tests)

## Making your Intentions Known

@@ -26,7 +26,7 @@ Before making changes to the codebase, it'd be helpful if you communicated your

You can report bugs in both the stable and unstable versions of Dynare. Before reporting a bug in the stable version of Dynare, please check the [Known Bugs](http://www.dynare.org/DynareWiki/KnownBugs) page to ensure it has not already been encountered/fixed. If reporting a bug in the unstable version of Dynare, please ensure the bug exists in the latest [unstable Dynare snapshot](http://www.dynare.org/download/dynare-unstable).

To report a bug in Dynare, simply open a GitHub issue in the repository where the bug resides. For example, to report a bug in Dynare itself, go to the [Dynare repository issue page](https://github.com/DynareTeam/dynare/issues) and click on "New Issue."
To report a bug in Dynare, simply open a GitHub issue in the repository where the bug resides. For example, to report a bug in Dynare itself, go to the [Dynare repository issue page](https://git.dynare.org/Dynare/dynare/issues) and click on "New Issue."

The minimal information to add is a subject and a description of the steps needed to reproduce the bug. However, the most helpful description would also provide the code to reproduce the bug (often times a `.mod` file). The most helpful `.mod` file is a minimal, quick-running example that reproduces the bug, but we'll take anything that will help us squash a bug.

@@ -45,7 +45,7 @@ So, now you've reported the bug or asked for an enhancemnt by creating a GitHub
Now, if you want to go the extra mile, you'll volunteer to contribute code to fix the GitHub issue you created above. Once we've agreed that you'll do it, please do the following:

1. Clone the Dynare repository:
   * `git clone https://github.com/DynareTeam/dynare.git`
   * `git clone https://git.dynare.org/Dynare/dynare.git`
1. [Fork the Dynare repository](https://help.github.com/articles/fork-a-repo)
1. Change into the `dynare` folder and add the forked repository as a remote:
   * `cd dynare`
+2 −1
Original line number Diff line number Diff line
@@ -39,13 +39,14 @@ dist-hook:
	rm -rf `find $(distdir)/matlab $(distdir)/examples -name *~`
	rm -rf $(distdir)/matlab/preprocessor* $(distdir)/matlab/dynare_version.m
	$(MKDIR_P) $(distdir)/mex/matlab $(distdir)/mex/octave
	rm -rf `find $(distdir)/contrib -name '.git*'`
	rm -rf `find $(distdir) -name '.git*'`

install-exec-local:
	$(MKDIR_P) $(DESTDIR)$(pkglibdir)/contrib/ms-sbvar/TZcode
	cp -r contrib/ms-sbvar/TZcode/MatlabFiles $(DESTDIR)$(pkglibdir)/contrib/ms-sbvar/TZcode
	cp -r examples $(DESTDIR)$(pkglibdir)
	cp -r matlab $(DESTDIR)$(pkglibdir)
	find $(DESTDIR)$(pkglibdir) -name LICENSE.md -delete
	rm -rf $(DESTDIR)$(pkglibdir)/matlab/preprocessor*
	{ \
	if [ -z "`file preprocessor/dynare_m | grep x86.64`" ]; then \
+1161 −4

File changed.

Preview size limit exceeded, changes collapsed.

+12 −10
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ available via the Dynare homepage: <http://www.dynare.org/download/dynare-stable

# Contributions

To contribute to Dynare and participate in the Dynare community, please see: [CONTRIBUTING.md](https://github.com/DynareTeam/dynare/blob/master/CONTRIBUTING.md)
To contribute to Dynare and participate in the Dynare community, please see: [CONTRIBUTING.md](https://git.dynare.org/Dynare/dynare/blob/master/CONTRIBUTING.md)

# License

@@ -32,7 +32,7 @@ Here, we explain how to build from source:
- all the associated documentation (PDF and HTML)

This source can be retrieved in three forms:
- via git, at <https://github.com/DynareTeam/dynare.git>
- via git, at <https://git.dynare.org/Dynare/dynare.git>
- using the stable source archive of the latest Dynare version (currently 4.4) from <http://www.dynare.org/download/dynare-stable/>
- using a source snapshot of the unstable version, from <http://www.dynare.org/download/dynare-unstable/source-snapshot>

@@ -81,7 +81,7 @@ A number of tools and libraries are needed in order to recompile everything. You
  - [Beamer](http://latex-beamer.sourceforge.net/) (for some PDF presentations)
- For building the reference manual:
  - [GNU Texinfo](http://www.gnu.org/software/texinfo/)
  - [Texi2HTML](http://www.nongnu.org/texi2html) and [Latex2HTML](http://www.latex2html.org), if you want nice mathematical formulas in HTML output
  - [Latex2HTML](http://www.latex2html.org), if you want nice mathematical formulas in HTML output
  - [Doxygen](http://www.stack.nl/%7Edimitri/doxygen/) (if you want to build Dynare preprocessor source documentation)
- For Octave, the development libraries corresponding to the UMFPACK packaged with Octave

@@ -91,7 +91,7 @@ If you have downloaded the sources from an official source archive or the source

If you want to use Git, do the following from a terminal:

    git clone --recursive http://github.com/DynareTeam/dynare.git
    git clone --recursive https://git.dynare.org/Dynare/dynare.git
    cd dynare
    autoreconf -si

@@ -219,9 +219,9 @@ Alternatively, if you want to build everything, manually install the following p

- `build-essential` (for gcc, g++ and make)
- `gfortran`
- `liboctave-dev` or `octave3.2-headers` (will install ATLAS)
- `liboctave-dev` (or `octave3.2-headers` on older systems)
- `libboost-graph-dev`
- `libgsl0-dev`
- `libgsl-dev` (or `libgsl0-dev` on older systems)
- `libmatio-dev`
- `libslicot-dev` and `libslicot-pic`
- `libsuitesparse-dev`
@@ -235,9 +235,11 @@ Alternatively, if you want to build everything, manually install the following p
- `texlive-formats-extra` (for Eplain)
- `texlive-latex-extra` (for fullpage.sty)
- `texlive-fonts-extra` (for ccicons)
- `latex-beamer`
- `texlive-latex-recommended` (or `latex-beamer` on older systems)
- `texlive-science` (or `texlive-math-extra` on older systems) (for amstex)
- `texinfo`
- `texi2html`, `latex2html`
- `lmodern` (for macroprocessor PDF)
- `latex2html`
- `doxygen`

## Fedora
@@ -253,7 +255,7 @@ Alternatively, if you want to build everything, manually install the following p
- `automake`
- `texlive`
- `texinfo`
- `texi2html`, `latex2html`
- `latex2html`
- `doxygen`

## Windows
@@ -303,7 +305,7 @@ After this, prepare the source and configure the build tree as described for Lin
- **NB**: If not compiling Dynare mex files for Octave, add ```--without-octave``` to the installation command
- **NB**: To compile the latest stable version of dynare, follow the same instructions as above, omitting the ```--HEAD``` argument
- **NB**: To update a ```--HEAD``` install of dynare you need to uninstall it then install it again: ```brew uninstall dynare; brew install dynare --HEAD```.
- **NB**: If you want to maintain a separate git directory of dynare, you can do a ```--HEAD``` install of dynare, then uninstall it. This will have the effect of bringing in all the dependencies you will need to then compile dynare from your git directory. Then, change to the git directory and type:
- **NB**: If you want to maintain a separate git directory of dynare, you can do a ```--HEAD``` install of dynare, then uninstall it. This will have the effect of bringing in all the dependencies you will need to then compile dynare from your git directory. (For `flex` and `bison` it may be necessary to symlink them via `brew link bison --force` and `brew link flex --force` as they are keg-only). Then, change to the git directory and type:
    - ```autoreconf -si; ./configure --with-matlab=/Applications/MATLAB_R2015a.app MATLAB_VERSION=R2015a```, adjusting the Matlab path and version to accord with your version
- Once compilation is done, open Matlab and type the last line shown when you type ```brew info dynare``` in the Terminal window. With the typical Homebrew setup, this is:
    - ```addpath /usr/local/opt/dynare/lib/dynare/matlab```

VERSION.in

0 → 100644
+1 −0
Original line number Diff line number Diff line
@PACKAGE_VERSION@
 No newline at end of file

configure.ac

100755 → 100644
+5 −15
Original line number Diff line number Diff line
dnl Process this file with autoconf to produce a configure script.

dnl Copyright (C) 2009-2016 Dynare Team
dnl Copyright (C) 2009-2017 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
@@ -18,7 +18,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with Dynare.  If not, see <http://www.gnu.org/licenses/>.

AC_PREREQ([2.62])
AC_INIT([dynare], [4.5-unstable])
AC_INIT([dynare], [4.5.7])
AC_CONFIG_SRCDIR([preprocessor/DynareMain.cc])
AM_INIT_AUTOMAKE([1.11 -Wall -Wno-portability foreign no-dist-gzip dist-xz tar-pax])

@@ -86,10 +86,6 @@ CPPFLAGS="$CPPFLAGS_SAVED"
# Don't use deprecated hash structures
AC_DEFINE([BOOST_NO_HASH], [], [Don't use deprecated STL hash structures])

# Check for dlopen(), needed by tests for estimation DLL
AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], [])
AC_SUBST([LIBADD_DLOPEN])

# Check for libmatio, needed by Dynare++
AX_MATIO
AM_CONDITIONAL([HAVE_MATIO], [test "x$has_matio" = "xyes"])
@@ -117,9 +113,6 @@ AM_CONDITIONAL([HAVE_PDFLATEX], [test "x$PDFLATEX" != "x"])
AC_CHECK_PROG([BIBTEX], [bibtex], [bibtex])
AM_CONDITIONAL([HAVE_BIBTEX], [test "x$BIBTEX" != "x"])

AC_CHECK_PROG([TEXI2HTML], [texi2html], [texi2html])
AM_CONDITIONAL([HAVE_TEXI2HTML], [test "x$TEXI2HTML" != "x"])

AC_CHECK_PROG([LATEX2HTML], [latex2html], [latex2html])
AM_CONDITIONAL([HAVE_LATEX2HTML], [test "x$LATEX2HTML" != "x"])

@@ -172,6 +165,7 @@ esac
AX_PTHREAD

AC_CONFIG_FILES([Makefile
                 VERSION
                 preprocessor/macro/Makefile
                 preprocessor/Makefile
                 doc/Makefile
@@ -202,10 +196,6 @@ AC_CONFIG_FILES([Makefile
                 dynare++/kord/Makefile
                 dynare++/src/Makefile
                 mex/sources/Makefile
                 mex/sources/estimation/Makefile
                 mex/sources/estimation/tests/Makefile
                 mex/sources/estimation/libmat/Makefile
                 mex/sources/estimation/libmat/tests/Makefile
])

AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab], [disable compilation of MEX files for MATLAB]), [], [enable_matlab=yes])
@@ -281,10 +271,10 @@ fi

if test "x$MAKEINFO" != "x"; then
  BUILD_DYNARE_INFO="yes"
  if test "x$TEXI2HTML" != "x" -a "x$LATEX2HTML" != "x"; then
  if test "x$LATEX2HTML" != "x"; then
    BUILD_DYNARE_HTML_MANUAL="yes"
  else
    BUILD_DYNARE_HTML_MANUAL="yes (but with ugly math formulas, missing texi2html or latex2html)"
    BUILD_DYNARE_HTML_MANUAL="yes (but with ugly math formulas, missing latex2html)"
  fi
  BUILD_DYNARE_PDF_MANUAL="yes"
else

dmm @ ea7846fd

Original line number Diff line number Diff line
Subproject commit ea7846fd71d32851877cf60008ac5046b51a7a51
Original line number Diff line number Diff line
Subproject commit 8b3d14040133ea5b622cde9ea79b3b0b41891bce
Subproject commit ce173d3fa2605957f7208bf624655893a7dc1768
+3 −4
Original line number Diff line number Diff line
@@ -2,15 +2,14 @@ SUBDIRS = preprocessor macroprocessor userguide parallel internals gsa dseries-a

info_TEXINFOS = dynare.texi

if HAVE_TEXI2HTML
if HAVE_LATEX2HTML
html-local: dynare.html

# The temporary directory for latex2html (L2H_TMP) must not contain a dot, so
# enforce standard tmp directory instead of defaulting to current directory
dynare.html: dynare.texi
	rm -rf dynare.html
	mkdir -p dynare.html
	cd dynare.html && $(TEXI2HTML) --l2h --split section --prefix index ../dynare.texi
endif
	texi2any --html --split=section -c L2H=1 -c L2H_TMP=$${TMPDIR:-/tmp} -c PREFIX=dynare.html dynare.texi
endif

PDF_TARGETS =
+130 −109

File changed.

Preview size limit exceeded, changes collapsed.

+38 −28
Original line number Diff line number Diff line
@@ -8,12 +8,11 @@
\usetheme{Boadilla}

\title{The Dynare Macro-processor}
\subtitle{Dynare Summer School 2015}
\subtitle{Dynare Summer School 2017}
\author{Sébastien Villemot}
%\pgfdeclareimage[height=0.6cm]{logo}{logo-ofce}
%\institute[OFCE]{\pgfuseimage{logo}}
\institute{OFCE}
\date{June 9, 2015}
\date{June 13, 2017}

\AtBeginSection[]
{
@@ -91,30 +90,6 @@
  \end{itemize}
\end{frame}

\begin{frame}[fragile=singleslide]
  \frametitle{Inclusion directive}
  \begin{itemize}
  \item This directive simply includes the content of another file at the place where it is inserted.
    \begin{block}{Syntax}
      \verb+@#include "+\textit{filename}\verb+"+
    \end{block}
    \begin{block}{Example}
\begin{verbatim}
@#include "modelcomponent.mod"
\end{verbatim}
    \end{block}
  \item Exactly equivalent to a copy/paste of the content of the included file
  \item Note that it is possible to nest includes (\textit{i.e.} to include a file from an included file)
  \item Since Dynare 4.5, the filename can be given by a macro-variable (see below).
    Useful in loops.
    \begin{block}{Example with variable}
\begin{verbatim}
@#define fname = "modelcomponent.mod"
@#include fname
\end{verbatim}
    \end{block}
  \end{itemize}
\end{frame}

\begin{frame}
\frametitle{Variables}
@@ -219,6 +194,41 @@ end;
  \end{block}
\end{frame}

\begin{frame}[fragile=singleslide]
  \frametitle{Inclusion directive (1/2)}
  \begin{itemize}
  \item This directive simply includes the content of another file at the place where it is inserted.
    \begin{block}{Syntax}
      \verb+@#include "+\textit{filename}\verb+"+
    \end{block}
    \begin{block}{Example}
\begin{verbatim}
@#include "modelcomponent.mod"
\end{verbatim}
    \end{block}
  \item Exactly equivalent to a copy/paste of the content of the included file
  \item Note that it is possible to nest includes (\textit{i.e.} to include a
    file from an included file)
  \end{itemize}
\end{frame}

\begin{frame}[fragile=singleslide]
  \frametitle{Inclusion directive (2/2)}
  \begin{itemize}
\item The filename can be given by a macro-variable (useful in loops):
    \begin{block}{Example with variable}
\begin{verbatim}
@#define fname = "modelcomponent.mod"
@#include fname
\end{verbatim}
    \end{block}
  \item Files to include are searched for in current directory. Other directories can
    be added with
    \texttt{@includepath} directive, \texttt{-I} command line option or
    \texttt{[paths]} section in config file.
  \end{itemize}
\end{frame}

\begin{frame}[fragile=singleslide]
  \frametitle{Loop directive}
  \begin{block}{Syntax}
@@ -604,7 +614,7 @@ rhos = [ 0.8, 0.9, 1];
    \ccbysa
    \column{0.71\textwidth}
    \tiny
    Copyright © 2008--2015 Dynare Team \\
    Copyright © 2008--2017 Dynare Team \\
    Licence: \href{http://creativecommons.org/licenses/by-sa/4.0/}{Creative
      Commons Attribution-ShareAlike 4.0}
    \end{columns}
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
% AMS-LaTeX Paper ************************************************
% **** -----------------------------------------------------------
\documentclass[12pt,a4paper,pdftex,nofootinbib]{article}
\usepackage[cp1252]{inputenc}
\usepackage{amssymb,amsmath}
\usepackage[pdftex]{graphicx}
\usepackage{epstopdf}
+9 −6
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ SimResults::~SimResults()
	for (int i = 0; i < getNumSets(); i++) {
		delete data[i];
		delete shocks[i];
		delete start[i];
	}
}

@@ -149,7 +150,7 @@ which are not to be burnt. If the data is not finite, the both data
and shocks are thrown away.

@<|SimResults::addDataSet| code@>=
bool SimResults::addDataSet(TwoDMatrix* d, ExplicitShockRealization* sr)
bool SimResults::addDataSet(TwoDMatrix* d, ExplicitShockRealization* sr, const ConstVector& st)
{
	KORD_RAISE_IF(d->nrows() != num_y,
				  "Incompatible number of rows for SimResults::addDataSets");
@@ -160,6 +161,10 @@ bool SimResults::addDataSet(TwoDMatrix* d, ExplicitShockRealization* sr)
		data.push_back(new TwoDMatrix((const TwoDMatrix&)(*d),num_burn,num_per));
		shocks.push_back(new ExplicitShockRealization(
								ConstTwoDMatrix(sr->getShocks(),num_burn,num_per)));
		if (num_burn == 0)
			start.push_back(new Vector(st));
		else
			start.push_back(new Vector(ConstVector(*d, num_burn-1)));
		ret = true;
	}

@@ -527,7 +532,7 @@ void SimulationWorker::operator()()
	TwoDMatrix* m = dr.simulate(em, np, st, *esr);
	{
		SYNCHRO syn(&res, "simulation");
		res.addDataSet(m, esr);
		res.addDataSet(m, esr, st);
	}
}

@@ -540,13 +545,11 @@ void SimulationIRFWorker::operator()()
	ExplicitShockRealization* esr =
	    new ExplicitShockRealization(res.control.getShocks(idata));
	esr->addToShock(ishock, 0, imp);
	const TwoDMatrix& data = res.control.getData(idata);
	ConstVector st(data, res.control.getNumBurn());
	TwoDMatrix* m = dr.simulate(em, np, st, *esr);
	TwoDMatrix* m = dr.simulate(em, np, res.control.getStart(idata), *esr);
	m->add(-1.0, res.control.getData(idata));
	{
		SYNCHRO syn(&res, "simulation");
		res.addDataSet(m, esr);
		res.addDataSet(m, esr, res.control.getStart(idata));
	}
}

+6 −2
Original line number Diff line number Diff line
@@ -694,7 +694,8 @@ bool calcFixPoint(emethod em, Vector& out)

@ This is a basically a number of matrices of the same dimensions,
which can be obtained as simulation results from a given decision rule
and shock realizations. We also store the realizations of shocks.
 and shock realizations. We also store the realizations of shocks and the
starting point of each simulation.

@<|SimResults| class declaration@>=
class ExplicitShockRealization;
@@ -705,6 +706,7 @@ protected:@;
	int num_burn;
	vector<TwoDMatrix*> data;
	vector<ExplicitShockRealization*> shocks;
	vector<Vector *> start;
public:@;
	SimResults(int ny, int nper, int nburn = 0)
		: num_y(ny), num_per(nper), num_burn(nburn)@+ {}
@@ -723,7 +725,9 @@ public:@;
		{@+ return *(data[i]);@+}
	const ExplicitShockRealization& getShocks(int i) const
		{ @+ return *(shocks[i]);@+}
	bool addDataSet(TwoDMatrix* d, ExplicitShockRealization* sr);
	const Vector& getStart(int i) const
		{ return *(start[i]); }
	bool addDataSet(TwoDMatrix* d, ExplicitShockRealization* sr, const ConstVector& st);
	void writeMat(const char* base, const char* lname) const;
	void writeMat(mat_t* fd, const char* lname) const;
};
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ to select (return true) the pairs for which $\alpha<\beta$.
@<|order_eigs| function code@>=
lapack_int order_eigs(const double* alphar, const double* alphai, const double* beta)
{
	return (*alphar * *alphar + *alphai * *alphai < *beta * *beta * qz_criterium);
	return (*alphar * *alphar + *alphai * *alphai < *beta * *beta * qz_criterium * qz_criterium);
}


+5 −1
Original line number Diff line number Diff line
@@ -101,7 +101,11 @@ void SystemResources::getRUS(double& load_avg, long int& pg_avail,
	majflt = -1;
#endif

#if !defined(__MINGW32__) && !defined(__CYGWIN32__) && !defined(__CYGWIN__) && !defined(__MINGW64__) && !defined(__CYGWIN64__)

#define MINGCYGTMP (!defined(__MINGW32__) && !defined(__CYGWIN32__) && !defined(__CYGWIN__))
#define MINGCYG (MINGCYGTMP && !defined(__MINGW64__) && !defined(__CYGWIN64__))

#if MINGCYG
	getloadavg(&load_avg, 1);
#else
	load_avg = -1.0;
+2 −2
Original line number Diff line number Diff line
@@ -159,9 +159,9 @@ KOrder::KOrder(int num_stat, int num_pred, int num_both, int num_forw,
	KORD_RAISE_IF(gy.nrows() != ypart.ny(),
				  "Wrong number of rows in gy in KOrder constructor");
	KORD_RAISE_IF(gu.nrows() != ypart.ny(),
				  "Wrong number of rows in gu in KOrder constuctor");
				  "Wrong number of rows in gu in KOrder constructor");
	KORD_RAISE_IF(gu.ncols() != nu,
				  "Wrong number of columns in gu in KOrder constuctor");
				  "Wrong number of columns in gu in KOrder constructor");

	// set nvs:
	nvs[0] = ypart.nys(); nvs[1] = nu; nvs[2] = nu; nvs[3] = 1;
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public:@;
	@<|IntegDerivs| constructor code@>;
};

@ This constuctor integrates a rule (namely its $g^{**}$ part) with
@ This constructor integrates a rule (namely its $g^{**}$ part) with
respect to $u=\tilde\sigma\eta$, and stores to the object the
derivatives of this integral $h$ at $(y^*,u,\sigma)=(\tilde
y^*,0,\tilde\sigma)$. The original container of $g^{**}$, the moments of
+5 −5
Original line number Diff line number Diff line
@@ -155,18 +155,18 @@ sigma_m =-5.85;
Lambdamu=3.4e-3;
LambdaA = 2.8e-3;

LambdaYd= (LambdaA+alppha*Lambdamu)/(1-alppha);

/*
The following parameters are set in the steady state file as they depend on other 
deep parameters that were estimated in the original study. Setting them in the
deep parameters (some were estimated in the original study). Setting them in the
steady state file means they are updated for every parameter draw in the MCMC
algorithm, while the parameters initialized here are only set once for the initial
values of the parameters they depend on:

gammma1 as it depends on LambdaA, alppha, Lambdamu, betta, and delta
Rbar =0 as it depends on PI, LambdaA, alppha, Lambdamu, and betta
Lambdax
gammma1=mu_z*mu_I/betta-(1-delta);
R=1+(PIbar*mu_z/betta-1);
Lambdax=exp(LambdaYd);
LambdaYd= (LambdaA+alppha*Lambdamu)/(1-alppha);
*/


+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ d=1;
phi=1;
m=0;
zeta=1;
LambdaYd= (LambdaA+alppha*Lambdamu)/(1-alppha);
mu_z=exp(LambdaYd);
mu_I=exp(Lambdamu);
mu_A=exp(LambdaA);
+5 −2
Original line number Diff line number Diff line
@@ -74,8 +74,11 @@ periods 1;
values 1.2;
end;

// Deterministic simulation of the model for 200 periods
simul(periods=200);
// Prepare the deterministic simulation of the model over 200 periods
perfect_foresight_setup(periods=200);

// Perform the simulation
perfect_foresight_solver;

// Display the path of consumption and capital
rplot c;
+88 −163
Original line number Diff line number Diff line
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Dynare
Upstream-Contact: Dynare Team, whose members in 2016 are:
Upstream-Contact: Dynare Team, whose members in 2017 are:
                  Stéphane Adjemian <stephane.adjemian@univ-lemans.fr>
                  Houtan Bastani <houtan@dynare.org>
                  Michel Juillard <michel.juillard@mjui.fr>
                  Frédéric Karamé <frederic.karame@univ-lemans.fr>
                  Junior Maih <junior.maih@gmail.com>
                  Ferhat Mihoubi <fmihoubi@univ-evry.fr>
                  George Perendia <george@perendia.orangehome.co.uk>
                  Johannes Pfeifer <jpfeifer@gmx.de>
                  Marco Ratto <marco.ratto@jrc.ec.europa.eu>
                  Marco Ratto <marco.ratto@ec.europa.eu>
                  Sébastien Villemot <sebastien@dynare.org>
Source: http://www.dynare.org

@@ -18,8 +17,8 @@ Copyright: 1996-2017 Dynare Team
License: GPL-3+

Files: matlab/AIM/SP*
Copyright: public-domain
License: public-domain
Copyright: none
License: public-domain-aim
 This code is in the public domain and may be used freely.
 However the authors would appreciate acknowledgement of the source by
 citation of any of the following papers:
@@ -86,53 +85,56 @@ Copyright: 2016 Benjamin Born and Johannes Pfeifer
           2016 Dynare Team
License: GPL-3+

Files: matlab\gsa\Morris_Measure_Groups.m
matlab\gsa\Sampling_Function_2.m
Written by Jessica Cariboni and Francesca Campolongo
Files: matlab/gsa/Morris_Measure_Groups.m
       matlab/gsa/Sampling_Function_2.m
Copyright: 2005 European Commission
           2012 Dynare Team
License: GPL-3+
Comment: Written by Jessica Cariboni and Francesca Campolongo
 Joint Research Centre, The European Commission,
Copyright (C) 2005 European Commission
Copyright (C) 2012 Dynare Team

Files: matlab\gsa\cumplot.m
matlab\gsa\filt_mc_.m
matlab\gsa\gsa_plotmatrix.m
matlab\gsa\gsa_skewness.m
matlab\gsa\gsa_speed.m
matlab\gsa\log_trans_.m
matlab\gsa\map_calibration.m
matlab\gsa\map_ident_.m
matlab\gsa\mcf_analysis.m
matlab\gsa\myboxplot.m
matlab\gsa\myprctilecol.m
matlab\gsa\prior_draw_gsa.m
matlab\gsa\read_data.m
matlab\gsa\redform_map.m
matlab\gsa\redform_screen.m
matlab\gsa\scatter_mcf.m
matlab\gsa\smirnov.m
matlab\gsa\stab_map_.m
matlab\gsa\stab_map_1.m
matlab\gsa\stab_map_2.m
matlab\gsa\stand_.m
matlab\gsa\tcrit.m
matlab\gsa\teff.m
matlab\gsa\trank.m
Copyright (C) 2011-2017 European Commission
Copyright (C) 2011-2017 Dynare Team

Files: matlab/gsa/cumplot.m
       matlab/gsa/filt_mc_.m
       matlab/gsa/gsa_plotmatrix.m
       matlab/gsa/gsa_skewness.m
       matlab/gsa/gsa_speed.m
       matlab/gsa/log_trans_.m
       matlab/gsa/map_calibration.m
       matlab/gsa/map_ident_.m
       matlab/gsa/mcf_analysis.m
       matlab/gsa/myboxplot.m
       matlab/gsa/myprctilecol.m
       matlab/gsa/prior_draw_gsa.m
       matlab/gsa/read_data.m
       matlab/gsa/redform_map.m
       matlab/gsa/redform_screen.m
       matlab/gsa/scatter_mcf.m
       matlab/gsa/smirnov.m
       matlab/gsa/stab_map_.m
       matlab/gsa/stab_map_1.m
       matlab/gsa/stab_map_2.m
       matlab/gsa/stand_.m
       matlab/gsa/tcrit.m
       matlab/gsa/teff.m
       matlab/gsa/trank.m
Copyright: 2011-2017 European Commission
           2011-2017 Dynare Team
License: GPL-3+

Files: matlab/gsa/pick.m
Copyright (C) 2001-2017 European Commission
This file is part of GLUEWIN
The program has been developed by M. Ratto, European Commission, Joint Research Centre,
Institute for the Protection and Security of The Citizen, Technological and Economic Risk Management,
Applied Statistics, as a deliverable of the IMPACT project 
(EC Fifth Framework Programme, SCA Project, IST-1999-11313, DG-INFSO).
Disclaimer: This software has been developed at the Joint Research Centre of European Commission
Copyright: none
License: public-domain-jrc
 This software has been developed at the Joint Research Centre of European Commission
 by officers in the course of their official duties. This software is not subject to copyright
 protection and is in the public domain. It is an experimental system. The Joint Research Centre
 of European Commission assumes no responsibility whatsoever for its use by other parties
 and makes no guarantees, expressed or implied, about its quality, reliability, or any other
 characteristic. We would appreciate acknowledgement if the software is used.
Comment: This file is part of GLUEWIN.
 The program has been developed by M. Ratto, European Commission, Joint Research Centre,
 Institute for the Protection and Security of The Citizen, Technological and Economic Risk Management,
 Applied Statistics, as a deliverable of the IMPACT project
 (EC Fifth Framework Programme, SCA Project, IST-1999-11313, DG-INFSO).

Files: matlab/optimization/simpsa.m matlab/optimization/simpsaget.m matlab/optimization/simpsaset.m
Copyright: 2005 Henning Schmidt, FCC, henning@fcc.chalmers.se
@@ -141,23 +143,24 @@ Copyright: 2005 Henning Schmidt, FCC, henning@fcc.chalmers.se
License: GPL-3+

Files: matlab/missing/stats/normpdf.m matlab/missing/stats/gamcdf.m
 matlab/missing/stats/common_size.m matlab/missing/stats/chi2inv.m
 matlab/missing/stats/chi2inv.m
 matlab/missing/stats/gaminv.m matlab/missing/stats/gampdf.m
 matlab/missing/stats/stdnormal_inv.m matlab/missing/stats/betacdf.m
 matlab/missing/stats/betapdf.m matlab/missing/stats/normcdf.m
 matlab/missing/stats/stdnormal_cdf.m matlab/missing/stats/norminv.m
 matlab/missing/stats/stdnormal_pdf.m matlab/missing/stats/betainv.m
 matlab/missing/stats-matlab/common_size.m
Copyright: 1995-2007 Kurt Hornik
           2008-2011 Dynare Team
License: GPL-3+

Files: matlab/missing/stats/quantile.m
Files: matlab/missing/stats-matlab/quantile.m
Copyright: 2014-2016 Christopher Hummersone
           2016 Dynare Team
License: GPL-3+


Files: matlab/missing/stats/corr.m
Files: matlab/missing/stats-matlab/corr.m
Copyright: 1993-1996 Kurt Hornik
           1996-2015 John W. Eaton
           2013-2015 Julien Bect
@@ -175,83 +178,24 @@ Copyright: 2005 Jos van der Geest <jos@jasen.nl>
           2013 Christophe Gouel
           2016 Dynare Team
License: BSD-2-clause
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
 met:
 .
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
     * Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in
       the documentation and/or other materials provided with the distribution
 .
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.

Files: matlab/lmmcp/lmmcp.m
Copyright: 2005 Christian Kanzow and Stefania Petra
           2013 Christophe Gouel
           2014 Dynare Team
License: permissive
License: permissive-lmmcp
 Unlimited permission is granted to everyone to use, copy, modify or
 distribute this software.

Files: matlab/utilities/graphics/distinguishable_colors.m
Copyright 2010-2011 by Timothy E. Holy
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in
      the documentation and/or other materials provided with the distribution
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Copyright: 2010-2011 Timothy E. Holy
License: BSD-2-clause

Files: matlab/utilities/graphics/colorspace.m
Pascal Getreuer 2005-2010
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in
      the documentation and/or other materials provided with the distribution
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Copyright: 2005-2010 Pascal Getreuer
License: BSD-2-clause

Files: doc/dynare.texi doc/*.tex doc/*.svg doc/*.dia doc/*.pdf doc/*.bib
Files: doc/dynare.texi doc/*.tex doc/*.svg doc/*.pdf doc/*.bib
Copyright: 1996-2017 Dynare Team
License: GFDL-NIV-1.3+

@@ -300,7 +244,7 @@ Files: m4/ax_compare_version.m4
Copyright: 2008 Tim Toolan <toolan@ele.uri.edu>
License: permissive-autoconf

Files: m4/ax_latex_bibtex_test.m4 m4/ax_latex_class.m4 m4/ax_tex_test.m4
Files: m4/ax_latex_class.m4 m4/ax_tex_test.m4
Copyright: 2008 Boretti Mathieu <boretti@eig.unige.ch>
           2009 Dynare Team
License: LGPL-2.1+
@@ -329,7 +273,7 @@ Copyright: 1996-2011 Daniel Waggoner and Tao Zha
License: GPL-3+

Files: contrib/ms-sbvar/switch_dw/state_space/sbvar/dw_csminwel.c
 state_space/sbvar/dw_csminwel.h
       contrib/ms-sbvar/switch_dw/state_space/sbvar/dw_csminwel.h
Copyright: 1996 Christopher Sims
           2003 Karibzhanov, Waggoner and Zha
License: GPL-3+
@@ -403,32 +347,28 @@ Files: contrib/ms-sbvar/TZcode/MatlabFiles/qplot2.m
Copyright: 1997-2012 Clark A. Burdick
License: GPL-3+

Files: contrib/dmm/*
Copyright: 2010-2014 European Commission
           2006-2012 Dynare Team
License: GPL-3+

Files: contrib/dmm/randlib/*
Copyright: none
License: public-domain
 We place the Randlib code that we have written in the public domain.  
 .
                                 NO WARRANTY
 .    
     WE PROVIDE ABSOLUTELY  NO WARRANTY  OF ANY  KIND  EITHER  EXPRESSED OR
     IMPLIED,  INCLUDING BUT   NOT LIMITED TO,  THE  IMPLIED  WARRANTIES OF
     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK
     AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS  WITH YOU.  SHOULD
     THIS PROGRAM PROVE  DEFECTIVE, YOU ASSUME  THE COST  OF  ALL NECESSARY
     SERVICING, REPAIR OR CORRECTION.
 .    
     IN NO  EVENT  SHALL THE UNIVERSITY  OF TEXAS OR  ANY  OF ITS COMPONENT
     INSTITUTIONS INCLUDING M. D.   ANDERSON HOSPITAL BE LIABLE  TO YOU FOR
     DAMAGES, INCLUDING ANY  LOST PROFITS, LOST MONIES,   OR OTHER SPECIAL,
     INCIDENTAL   OR  CONSEQUENTIAL DAMAGES   ARISING   OUT  OF  THE USE OR
     INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA OR
     ITS ANALYSIS BEING  RENDERED INACCURATE OR  LOSSES SUSTAINED  BY THIRD
     PARTIES) THE PROGRAM.
License: BSD-2-clause
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
 met:
 .
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
     * Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in
       the documentation and/or other materials provided with the distribution
 .
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.

License: GFDL-NIV-1.3+
 Permission is granted to copy, distribute and/or modify this document
@@ -438,21 +378,6 @@ License: GFDL-NIV-1.3+
 .
 A copy of the license can be found at <http://www.gnu.org/licenses/fdl.txt>

License: GPL-2+
 This program is free software: you can redistribute it and/or
 modify it under the terms of the GNU General Public License as
 published by the Free Software Foundation, either version 2 of
 the License, or (at your option) any later version.
 .
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 .
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see
 <http://www.gnu.org/licenses/>.

License: GPL-2+ with Autoconf exception
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as

m4/ax_latex_bibtex_test.m4

deleted100644 → 0
+0 −66
Original line number Diff line number Diff line
# ===========================================================================
#          http://www.nongnu.org/autoconf-archive/ax_latex_test.html
# ===========================================================================
#
# OBSOLETE MACRO
#
#   Deprecated because of licensing issues. The Lesser GPL imposes licensing
#   restrictions on the generated configure script unless it is augmented
#   with an Autoconf Exception clause.
#
# SYNOPSIS
#
#   AX_LATEX_BIBTEX_TEST(FILEDATA,BIBDATA,VARIABLETOSET,[NOCLEAN])
#
# DESCRIPTION
#
#   This macros creates a bib file called contest.bib with BIBDATA,
#   executes the latex application with FILEDATA as input, then runs
#   bibtex on the resulting aux file, and finally sets VARIABLETOSET
#   to yes or no depending on the result. If NOCLEAN is set, the folder
#   used for the test is not deleted after testing.
#
#   The macro assumes that the variables PDFLATEX and BIBTEX are set.
#
#   Adapted from the macro AX_LATEX_TEST by Sébastien Villemot.
#
# LICENSE
#
#   Copyright (c) 2008 Boretti Mathieu <boretti@eig.unige.ch>
#   Copyright (c) 2009 Dynare Team
#
#   This library is free software; you can redistribute it and/or modify it
#   under the terms of the GNU Lesser General Public License as published by
#   the Free Software Foundation; either version 2.1 of the License, or (at
#   your option) any later version.
#
#   This library is distributed in the hope that it will be useful, but
#   WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
#   General Public License for more details.
#
#   You should have received a copy of the GNU Lesser General Public License
#   along with this library. If not, see <http://www.gnu.org/licenses/>.

AC_DEFUN([AX_LATEX_BIBTEX_TEST],[
rm -rf conftest.dir/.acltx
AS_MKDIR_P([conftest.dir/.acltx])
cd conftest.dir/.acltx
m4_ifval([$3],[$3="no"; export $3;])
cat > conftest.tex << ACLEOF
$1
ACLEOF
cat > conftest.bib << ACLEOF
$2
ACLEOF
$PDFLATEX conftest 2>&1 1>output
$BIBTEX conftest 2>&1 1>output2 m4_ifval([$3],[&& $3=yes])
cd ..
cd ..
sed 's/^/| /' conftest.dir/.acltx/conftest.tex >&5
echo "$as_me:$LINENO: executing $PDFLATEX conftest" >&5
sed 's/^/| /' conftest.dir/.acltx/output >&5
echo "$as_me:$LINENO: executing $BIBTEX conftest" >&5
sed 's/^/| /' conftest.dir/.acltx/output2 >&5
m4_ifval([$4],,[rm -rf conftest.dir/.acltx])
])
+16 −1
Original line number Diff line number Diff line
dnl Copyright (C) 2009-2016 Dynare Team
dnl Copyright (C) 2009-2019 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
@@ -22,6 +22,21 @@ AC_REQUIRE([AX_MATLAB])
AC_MSG_CHECKING([for MATLAB version])
if test "x$MATLAB_VERSION" != "x"; then
  case $MATLAB_VERSION in
    *2019b | *2019B)
      MATLAB_VERSION="9.7"
      ;;
    *2019a | *2019A)
      MATLAB_VERSION="9.6"
      ;;
    *2018b | *2018B)
      MATLAB_VERSION="9.5"
      ;;
    *2018a | *2018A)
      MATLAB_VERSION="9.4"
      ;;
    *2017b | *2017B)
      MATLAB_VERSION="9.3"
      ;;
    *2017a | *2017A)
      MATLAB_VERSION="9.2"
      ;;
+3 −3
Original line number Diff line number Diff line
@@ -41,13 +41,13 @@ else
    AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [7.1], [AC_MSG_ERROR([I can't determine the MEX file extension. Please explicitly indicate it to the configure script with the MEXEXT variable.])])
    case $build_os in
      *cygwin*)
        ax_cv_mexext=`$MATLAB/bin/mexext.bat | sed 's/\r//'`
        ax_cv_mexext=$("$MATLAB"/bin/mexext.bat | sed 's/\r//')
        ;;
      *mingw*)
        ax_cv_mexext=`cd $MATLAB/bin && cmd /c mexext.bat | sed 's/\r//'`
        ax_cv_mexext=$(cd "$MATLAB"/bin && cmd /c mexext.bat | sed 's/\r//')
        ;;
      *)
        ax_cv_mexext=`$MATLAB/bin/mexext`
        ax_cv_mexext=$("$MATLAB"/bin/mexext)
        ;;
    esac
fi])
+6 −2
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ function [alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK,T,R,P,PK,de
% SPECIAL REQUIREMENTS
%   None

% Copyright (C) 2006-2017 Dynare Team
% Copyright (C) 2006-2018 Dynare Team
%
% This file is part of Dynare.
%
@@ -104,6 +104,10 @@ oo_.dr.restrict_columns = bayestopt_.smoother_restrict_columns;

[T,R,SteadyState,info,M_,options_,oo_] = dynare_resolve(M_,options_,oo_);

if info~=0
    print_info(info,options_.noprint, options_);
    return
end
oo_.dr.restrict_var_list = oldoo.restrict_var_list;
oo_.dr.restrict_columns = oldoo.restrict_columns;

@@ -179,7 +183,7 @@ elseif options_.lik_init == 3 % Diffuse Kalman filter
            Z   = [Z, eye(vobs)];
        end
    end
    [Pstar,Pinf] = compute_Pinf_Pstar(mf,T,R,Q,options_.qz_criterium,oo_.dr.restrict_var_list);
    [Pstar,Pinf] = compute_Pinf_Pstar(mf,T,R,Q,options_.qz_criterium);
elseif options_.lik_init == 4           % Start from the solution of the Riccati equation.
    [err, Pstar] = kalman_steady_state(transpose(T),R*Q*transpose(R),transpose(build_selection_matrix(mf,np,vobs)),H);
    mexErrCheck('kalman_steady_state',err);
+8 −3
Original line number Diff line number Diff line
function [xparams, logpost] = GetOneDraw(type)
% function [xparams, logpost] = GetOneDraw(type)
function [xparams, logpost] = GetOneDraw(type,M_,estim_params_,oo_,options_,bayestopt_)
% function [xparams, logpost] = GetOneDraw(type,M_,estim_params_,oo_,options_,bayestopt_)
% draws one parameter vector and its posterior from MCMC or the prior
%
% INPUTS
%    type:      [string]       'posterior': draw from MCMC draws
%                              'prior': draw from prior
%    M_         [structure]     Definition of the model
%    estim_params_ [structure]  characterizing parameters to be estimated
%    oo_         [structure]    Storage of results
%    options_    [structure]    Options
%    bayestopt_  [structure]    describing the priors
%
% OUTPUTS
%    xparams:   vector of estimated parameters (drawn from posterior or prior distribution)
@@ -36,6 +41,6 @@ switch type
  case 'prior'
    xparams = prior_draw();
    if nargout>1
        logpost = evaluate_posterior_kernel(xparams');
        logpost = evaluate_posterior_kernel(xparams',M_,estim_params_,oo_,options_,bayestopt_);
    end
end
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ localVars.type=type;
if strcmpi(type,'posterior')
    while b<B
        b = b + 1;
        x(b,:) = GetOneDraw(type);
        x(b,:) = GetOneDraw(type,M_,estim_params_,oo_,options_,bayestopt_);
    end
end

+1 −1
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ while fpar<B
    irun = irun+1;
    irun2 = irun2+1;
    if strcmpi(type,'prior')
        deep = GetOneDraw(type);
        deep = GetOneDraw(type,M_,estim_params_,oo_,options_,bayestopt_);
    else
        deep = x(fpar,:);
    end
+9 −1
Original line number Diff line number Diff line
@@ -51,8 +51,16 @@ else
                    addpath(mexpath);
                end
            end
        elseif matlab_ver_less_than('9.4')
            tmp = [dynareroot '../mex/matlab/win64-7.8-9.3/'];
            if exist(tmp, 'dir')
                mexpath = tmp;
                if modifypath
                    addpath(mexpath);
                end
            end
        else
            tmp = [dynareroot '../mex/matlab/win64-7.8-9.2/'];
            tmp = [dynareroot '../mex/matlab/win64-9.4-9.7/'];
            if exist(tmp, 'dir')
                mexpath = tmp;
                if modifypath
+121 −121
Original line number Diff line number Diff line
@@ -57,17 +57,16 @@ islog = q2a.islog;
aux      = q2a.aux;
aux0 = aux;
cumfix      = q2a.cumfix;
% usual shock decomp
if isstruct(oo_)
    %     z = oo_.shock_decomposition;
    myopts=options_;
    myopts.plot_shock_decomp.type='qoq';
    myopts.plot_shock_decomp.realtime=0;
    [z, junk] = plot_shock_decomposition(M_,oo_,myopts,[]);
else
    z = oo_;
qvintage_ = vintage_;
tpoints = t0:4:t1;
if ~ismember(vintage_,tpoints) && vintage_
    ind1=min(find(tpoints>vintage_));
    ind2=max(find(tpoints<vintage_));
    vintage_=tpoints(ind1);
end
z = z(i_var,:,:);

nfrcst = options_.shock_decomp.forecast/4;
%% initialize names
mytype=var_type;
if isfield(q2a,'name')
    mytxt = q2a.name;
@@ -90,29 +89,6 @@ if isfield(q2a,'name')
    end
    mytype=0;
end
if isstruct(aux)
    if ischar(aux.y)
        myopts=options_;
        myopts.plot_shock_decomp.type='qoq';
        myopts.plot_shock_decomp.realtime=0;
        [y_aux, steady_state_aux] = plot_shock_decomposition(M_,oo_,myopts,aux.y);
        aux.y=y_aux;
        aux.yss=steady_state_aux;
    end
    yaux=aux.y;
end
if mytype==2
    gtxt = 'PHI'; % inflation rate
    gtex = '\pi';
elseif mytype
    gtxt = 'G'; % growth rate
    gtex = 'g';
end
steady_state=steady_state(i_var);
% endo_names = M_.endo_names(i_var,:);
% endo_names_tex = M_.endo_names_tex(i_var,:);
nterms = size(z,2);
nfrcst = opts.forecast/4;

for j=1:nvar
    if j>1
@@ -133,44 +109,47 @@ for j=1:nvar
            gendo_names_tex = [gtex '(' deblank(endo_names_tex(j,:)) ')'];
        end
    end
    for k =1:nterms
        if isstruct(aux)
            aux.y = squeeze(yaux(j,k,min((t0-3):-4:1):end));
        end
        [za(j,k,:), steady_state_a(j,1), gza(j,k,:), steady_state_ga(j,1)] = ...
            quarterly2annual(squeeze(z(j,k,min((t0-3):-4:1):end)),steady_state(j),GYTREND0,var_type,islog,aux);
    end
    ztmp=squeeze(za(j,:,:));
    if cumfix==0
        zscale = sum(ztmp(1:end-1,:))./ztmp(end,:);
        ztmp(1:end-1,:) = ztmp(1:end-1,:)./repmat(zscale,[nterms-1,1]);
    else
        zres = ztmp(end,:)-sum(ztmp(1:end-1,:));
        ztmp(end-1,:) = ztmp(end-1,:) + zres;
    end
    gztmp=squeeze(gza(j,:,:));
    if cumfix==0
        gscale = sum(gztmp(1:end-1,:))./ gztmp(end,:);
        gztmp(1:end-1,:) = gztmp(1:end-1,:)./repmat(gscale,[nterms-1,1]);
    else
        gres = gztmp(end,:) - sum(gztmp(1:end-1,:));
        gztmp(end-1,:) = gztmp(end-1,:)+gres;
    end
    za(j,:,:) = ztmp;
    gza(j,:,:) = gztmp;
end

if q2a.plot ==1
    z=gza;
    endo_names = gendo_names;
    endo_names_tex = gendo_names_tex;
elseif q2a.plot == 2
    z=za;
else
    z=cat(1,za,gza);
elseif q2a.plot ~= 2
    endo_names = char(endo_names,gendo_names);
    endo_names_tex = char(endo_names_tex,gendo_names_tex);
end

% end initialize names
steady_state=steady_state(i_var);

if realtime_==0
    % usual shock decomp
    if isstruct(oo_)
        %     z = oo_.shock_decomposition;
        myopts=options_;
        myopts.plot_shock_decomp.type='qoq';
        myopts.plot_shock_decomp.realtime=0;
        [z, junk] = plot_shock_decomposition(M_,oo_,myopts,[]);
    else
        z = oo_;
    end
    z = z(i_var,:,:);
if isstruct(aux)
    if ischar(aux.y)
        myopts=options_;
        myopts.plot_shock_decomp.type='qoq';
        myopts.plot_shock_decomp.realtime=0;
        [y_aux, steady_state_aux] = plot_shock_decomposition(M_,oo_,myopts,aux.y);
        aux.y=y_aux;
        aux.yss=steady_state_aux;
    end
end
% endo_names = M_.endo_names(i_var,:);
% endo_names_tex = M_.endo_names_tex(i_var,:);

    % make annualized shock decomp
    [z, steady_state_a, steady_state_ga] = annualiz(z,t0,q2a,aux,steady_state);
end
% if isstruct(oo_)
%     oo_.annualized_shock_decomposition=z;
% end
@@ -180,85 +159,55 @@ if realtime_ && isstruct(oo_) && isfield(oo_, 'realtime_shock_decomposition')
    init=1;
    for i=t0:4:t1
        yr=floor(i/4);
        za=[];
        gza=[];
        myopts=options_;
        myopts.plot_shock_decomp.type='qoq';
        myopts.plot_shock_decomp.realtime=1;
        myopts.plot_shock_decomp.vintage=i;
        [z, steady_state_aux] = plot_shock_decomposition(M_,oo_,myopts,[]);
        
        % retrieve quarterly shock decomp
        z = plot_shock_decomposition(M_,oo_,myopts,[]);
        zdim = size(z);
        z = z(i_var,:,:);
        if isstruct(aux)
            if ischar(aux0.y)
                % retrieve quarterly shock decomp for aux variable
                [y_aux, steady_state_aux] = plot_shock_decomposition(M_,oo_,myopts,aux0.y);
                aux.y=y_aux;
                aux.yss=steady_state_aux;
            end
            yaux=aux.y;
        end
        nterms = size(z,2);
		
        %     z = oo_.realtime_shock_decomposition.(['time_' int2str(i)]);
        %     z = z(i_var,:,:);
        % make annualized shock decomp
        [z, steady_state_a, steady_state_ga] = annualiz(z,t0,q2a,aux,steady_state);

        for j=1:nvar
            for k =nterms:-1:1
                %             if k<nterms
                %                 ztmp = squeeze(sum(z(j,[1:k-1,k+1:end-1],t0-4:end)));
                %             else
                ztmp = squeeze(z(j,k,min((t0-3):-4:1):end));
                %             end
                if isstruct(aux)
                    aux.y = squeeze(yaux(j,k,min((t0-3):-4:1):end));
                end
                [za(j,k,:), steady_state_a(j,1), gza(j,k,:), steady_state_ga(j,1)] = ...
                    quarterly2annual(ztmp,steady_state(j),GYTREND0,var_type,islog,aux);
                %             if k<nterms
                %                 za(j,k,:) = za(j,end,:) - za(j,k,:);
                %                 gza(j,k,:) = gza(j,end,:) - gza(j,k,:);
                %             end

            end

            ztmp=squeeze(za(j,:,:));

            if cumfix==0
                zscale = sum(ztmp(1:end-1,:))./ztmp(end,:);
                ztmp(1:end-1,:) = ztmp(1:end-1,:)./repmat(zscale,[nterms-1,1]);
        if init==1
            oo_.annualized_realtime_shock_decomposition.pool = z;
        else
                zres = ztmp(end,:)-sum(ztmp(1:end-1,:));
                ztmp(end-1,:) = ztmp(end-1,:) + zres;
            oo_.annualized_realtime_shock_decomposition.pool(:,:,yr) = z(:,:,end-nfrcst);
        end
        oo_.annualized_realtime_shock_decomposition.(['yr_' int2str(yr)]) = z;

            gztmp=squeeze(gza(j,:,:));
            if cumfix==0
                gscale = sum(gztmp(1:end-1,:))./ gztmp(end,:);
                gztmp(1:end-1,:) = gztmp(1:end-1,:)./repmat(gscale,[nterms-1,1]);
            else
                gres = gztmp(end,:) - sum(gztmp(1:end-1,:));
                gztmp(end-1,:) = gztmp(end-1,:)+gres;
        if options_.shock_decomp.forecast
            if qvintage_>i-4 && qvintage_<i
                myopts.plot_shock_decomp.vintage=qvintage_;
                % retrieve quarterly shock decomp
                z = plot_shock_decomposition(M_,oo_,myopts,[]);
                z(:,:,end+1:zdim(3))=nan; % fill with nan's remaining time points to reach Q4
                z = z(i_var,:,:);
                if isstruct(aux)
                    if ischar(aux0.y)
                        % retrieve quarterly shock decomp for aux variable
                        [y_aux, steady_state_aux] = plot_shock_decomposition(M_,oo_,myopts,aux0.y);
                        aux.y=y_aux;
                        aux.yss=steady_state_aux;
                    end

            za(j,:,:) = ztmp;
            gza(j,:,:) = gztmp;
                end
				
        if q2a.plot ==1
            z=gza;
        elseif q2a.plot == 2
            z=za;
        else
            z=cat(1,za,gza);
        end
                % make annualized shock decomp
                z = annualiz(z,t0,q2a,aux,steady_state);
                
        if init==1
            oo_.annualized_realtime_shock_decomposition.pool = z;
        else
            oo_.annualized_realtime_shock_decomposition.pool(:,:,yr) = z(:,:,end-nfrcst);
            end
        oo_.annualized_realtime_shock_decomposition.(['yr_' int2str(yr)]) = z;

        if opts.forecast
            oo_.annualized_realtime_forecast_shock_decomposition.(['yr_' int2str(yr)]) = z(:,:,end-nfrcst:end);
            if init>nfrcst
                oo_.annualized_realtime_conditional_shock_decomposition.(['yr_' int2str(yr-nfrcst)]) = ...
@@ -277,6 +226,7 @@ if realtime_ && isstruct(oo_) && isfield(oo_, 'realtime_shock_decomposition')
                            oo_.annualized_realtime_shock_decomposition.pool(:,:,yr-my_forecast_:yr) - ...
                            oo_.annualized_realtime_forecast_shock_decomposition.(['yr_' int2str(yr-my_forecast_)])(:,:,1:my_forecast_+1);
                        oo_.annualized_realtime_conditional_shock_decomposition.(['yr_' int2str(yr-my_forecast_)])(:,end-1,:) = ...
                            oo_.annualized_realtime_conditional_shock_decomposition.(['yr_' int2str(yr-my_forecast_)])(:,end-1,:) + ...
                            oo_.annualized_realtime_forecast_shock_decomposition.(['yr_' int2str(yr-my_forecast_)])(:,end,1:my_forecast_+1);
                        oo_.annualized_realtime_conditional_shock_decomposition.(['yr_' int2str(yr-my_forecast_)])(:,end,:) = ...
                            oo_.annualized_realtime_shock_decomposition.pool(:,end,yr-my_forecast_:yr);
@@ -331,3 +281,53 @@ else
        steady_state = steady_state_a;
    end
end

return

function [z, steady_state_a, steady_state_ga] = annualiz(z,t0,q2a,aux,steady_state)

GYTREND0 = q2a.GYTREND0;
var_type = q2a.type;
islog    = q2a.islog;
cumfix   = q2a.cumfix;
if isstruct(aux)
    yaux=aux.y;
end

[nvar , nterms, junk] = size(z);
for j=1:nvar
    for k =1:nterms
        ztmp = squeeze(z(j,k,min((t0-3):-4:1):end));
        if isstruct(aux)
            aux.y = squeeze(yaux(j,k,min((t0-3):-4:1):end));
        end
        [za(j,k,:), steady_state_a(j,1), gza(j,k,:), steady_state_ga(j,1)] = ...
            quarterly2annual(ztmp,steady_state(j),GYTREND0,var_type,islog,aux);
    end
    ztmp=squeeze(za(j,:,:));
    if cumfix==0
        zscale = sum(ztmp(1:end-1,:))./ztmp(end,:);
        ztmp(1:end-1,:) = ztmp(1:end-1,:)./repmat(zscale,[nterms-1,1]);
    else
        zres = ztmp(end,:)-sum(ztmp(1:end-1,:));
        ztmp(1:end-1,:) = ztmp(1:end-1,:) + repmat(zres,[nterms-1 1])/(nterms-1);
    end
    gztmp=squeeze(gza(j,:,:));
    if cumfix==0
        gscale = sum(gztmp(1:end-1,:))./ gztmp(end,:);
        gztmp(1:end-1,:) = gztmp(1:end-1,:)./repmat(gscale,[nterms-1,1]);
    else
        gres = gztmp(end,:) - sum(gztmp(1:end-1,:));
        gztmp(1:end-1,:) = gztmp(1:end-1,:) + repmat(gres,[nterms-1 1])/(nterms-1);
    end
    za(j,:,:) = ztmp;
    gza(j,:,:) = gztmp;
end

if q2a.plot ==1
    z=gza;
elseif q2a.plot == 2
    z=za;
else
    z=cat(1,za,gza);
end
+6 −2
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ function varargout = prior(varargin)
% Computes various prior statistics and display them in the command window.
%
% INPUTS
%   'table', 'moments', 'optimize', 'simulate', 'plot'
%   'table', 'moments', 'optimize', 'simulate', 'plot', 'moments(distribution)'
%
% OUTPUTS
%   none
@@ -11,7 +11,7 @@ function varargout = prior(varargin)
% SPECIAL REQUIREMENTS
%   none

% Copyright (C) 2015-2017 Dynare Team
% Copyright (C) 2015-2018 Dynare Team
%
% This file is part of Dynare.
%
@@ -103,6 +103,9 @@ if ismember('simulate', varargin) % Prior simulations (BK).
    disp(['mjdgges crash share                   = ' num2str(results.dll.problem_share)])
    disp(['Steady state problem share            = ' num2str(results.ss.problem_share)])
    disp(['Complex steady state  share           = ' num2str(results.ss.complex_share)])
    if options_.loglinear
        disp(['Nonpositive steady state share        = ' num2str(results.ss.nonpositive_share)])
    end
    disp(['Analytical steady state problem share = ' num2str(results.ass.problem_share)])
    skipline(2)
    donesomething = true;
@@ -158,6 +161,7 @@ if ismember('moments(distribution)', varargin) % Prior simulations (BK).
                dr = tmp.pdraws{j,3};
                oo__ = oo_;
                oo__.dr = dr;
                Model=set_parameters_locally(Model,tmp.pdraws{j,1});% Needed to update the covariance matrix of the state innovations.
                oo__ = disp_th_moments(oo__.dr, [], Model, options_, oo__);
                FirstOrderMoments(:,iter) = oo__.mean;
                SecondOrderMoments(:,:,iter) = oo__.var;
+70 −6
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ function [Pstar,Pinf] = compute_Pinf_Pstar(mf,T,R,Q,qz_criterium, restrict_colum
% SPECIAL REQUIREMENTS
%   None

% Copyright (C) 2006-2017 Dynare Team
% Copyright (C) 2006-2018 Dynare Team
%
% This file is part of Dynare.
%
@@ -48,8 +48,22 @@ function [Pstar,Pinf] = compute_Pinf_Pstar(mf,T,R,Q,qz_criterium, restrict_colum
% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.

np = size(T,1);
if nargin == 6
    indx = restrict_columns;
    indx0=find(~ismember([1:np],indx));
else
    indx=(find(max(abs(T))>=1.e-10));
    indx0=(find(max(abs(T))<1.e-10));
end
np0=length(indx0);
Tbkp = T;
T0=T(indx0,indx); % static variables vs. dynamic ones
R0=R(indx0,:);    % matrix of shocks for static variables

% perform Kitagawa transformation
% Perform Kitagawa transformation only for non-zero columns of T
T=T(indx,indx);
R=R(indx,:);
np = size(T,1);
[QT,ST] = schur(T);
e1 = abs(ordeig(ST)) > 2-qz_criterium;
[QT,ST] = ordschur(QT,ST,e1);
@@ -59,7 +73,6 @@ nk1 = nk+1;
Pstar = zeros(np,np);
R1 = QT'*R;
B = R1*Q*R1';
% computes variance of stationary block (lower right)
i = np;
while i >= nk+2
    if ST(i,i-1) == 0
@@ -100,13 +113,64 @@ if i == nk+1
    Pstar(nk1,nk1)=(B(nk1,nk1)+c)/(1-ST(nk1,nk1)*ST(nk1,nk1));
end

if np0
    ST1=ST;
    % Now I recover stationarized static variables using
    % ss = s-A*z
    % and
    % z-z(-1) (growth rates of unit roots) only depends on stationary variables
    Pstar = blkdiag(zeros(np0),Pstar);
    ST = [zeros(length(Pstar),length(indx0)) [T0*QT ;ST]];
    R1 = [R0; R1];
    % Build the matrix for stationarized variables
    STinf = ST(np0+1:np0+nk,np0+1:np0+nk);
    iSTinf = inv(STinf);
    ST0=ST;
    ST0(:,1:np0+nk)=0;  % stationarized static + 1st difference only respond to lagged stationary states
    ST00 = ST(1:np0,np0+1:np0+nk);
    %     A\B is the matrix division of A into B, which is roughly the
    %     same as INV(A)*B
    ST0(1:np0,np0+nk+1:end) = ST(1:np0,np0+nk+1:end)-ST00*(iSTinf*ST(np0+1:np0+nk,np0+nk+1:end)); % snip non-stationary part
    R10 = R1;
    R10(1:np0,:) = R1(1:np0,:)-ST00*(iSTinf*R1(np0+1:np0+nk,:)); % snip non-stationary part
    % Kill non-stationary part before projecting Pstar
    ST0(np0+1:np0+nk,:)=0;
    R10(np0+1:np0+nk,:)=0; % is this questionable???? IT HAS TO in order to match Michel's version!!!
    % project Pstar onto static x
    Pstar = ST0*Pstar*ST0'+R10*Q*R10';
    % QT(1:np0,np0+1:np0+nk) = QT(1:np0,np0+1:np0+nk)+ST(1:np0,np0+1:np0+nk);  %%% is this questionable ????
    % reorder QT entries
else
    STinf = ST(np0+1:np0+nk,np0+1:np0+nk);
end

% stochastic trends with no influence on observed variables are
% arbitrarily initialized to zero
Pinf = zeros(np,np);
Pinf(1:nk,1:nk) = eye(nk);
if np0
    STtriu = STinf-eye(nk);
%     A\B is the matrix division of A into B, which is roughly the
%     same as INV(A)*B
    STinf0 = ST00*(eye(nk)-iSTinf*STtriu);
    Pinf = blkdiag(zeros(np0),Pinf);
    QT = blkdiag(eye(np0),QT);
    QTinf = QT;
    QTinf(1:np0,np0+1:np0+nk) = STinf0;
    QTinf([indx0(:); indx(:)],:) = QTinf;
    STinf1 = [zeros(np0+np,np0) [STinf0; eye(nk); zeros(np-nk,nk)] zeros(np0+np,np-nk)];
    for k = 1:nk
        if norm(QTinf(mf,:)*ST([indx0(:); indx(:)],k+np0)) < 1e-8
            Pinf(k+np0,k+np0) = 0;
        end
    end
    Pinf = STinf1*Pinf*STinf1';
    QT([indx0(:); indx(:)],:) = QT;
else
    for k = 1:nk
        if norm(QT(mf,:)*ST(:,k)) < 1e-8
        Pinf(k,k) = 0;
            Pinf(k+np0,k+np0) = 0;
        end
    end
end

+7 −2
Original line number Diff line number Diff line
@@ -67,6 +67,9 @@ if options_.steadystate_flag
                                                      options_,0);
end
[U,Uy,W] = feval([M_.fname,'_objective_static'],zeros(endo_nbr,1),[], M_.params);
if any(any(isnan(Uy)))
    error(['discretionary_policy: the derivatives of the objective function contain NaN'])
end
if any(any(Uy~=0))
    error(['discretionary_policy: the objective function must have zero ' ...
           'first order derivatives'])
@@ -98,7 +101,9 @@ instr_nbr=endo_nbr-eq_nbr;
if instr_nbr==0
    error('discretionary_policy:: There are no available instruments, because the model has as many equations as variables.')
end
if size(Instruments,1)~= instr_nbr
if size(Instruments,1)< instr_nbr
    error('discretionary_policy:: There are fewer declared instruments than omitted equations.')
elseif size(Instruments,1)> instr_nbr
    error('discretionary_policy:: There are more declared instruments than omitted equations.')    
end

+3 −3
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ function [H,G,retcode]=discretionary_policy_engine(AAlag,AA0,AAlead,BB,bigw,inst
%  Dennis, Richard (2007): Optimal policy in rational expectations models: new solution algorithms,
%       Macroeconomic Dynamics, 11, 31–55.

% Copyright (C) 2007-2017 Dynare Team
% Copyright (C) 2007-2018 Dynare Team
%
% This file is part of Dynare.
%
@@ -112,9 +112,9 @@ F1=F10;
while 1
    iter=iter+1;
    P=SylvesterDoubling(W+beta*F1'*Q*F1,beta*H1',H1,discretion_tol,solve_maxit);
    if any(any(isnan(P)))
    if any(any(isnan(P))) || any(any(isinf(P)))
        P=SylvesterHessenbergSchur(W+beta*F1'*Q*F1,beta*H1',H1);
        if any(any(isnan(P)))
        if any(any(isnan(P))) || any(any(isinf(P)))
            retcode=2;
            return
        end
+5 −0
Original line number Diff line number Diff line
@@ -27,6 +27,11 @@ function disp_dr(dr,order,var_list)

global M_ options_

if M_.hessian_eq_zero && order~=1
    order = 1;
    warning('disp_dr: using order = 1 because Hessian is equal to zero');
end
    
nx =size(dr.ghx,2);
nu =size(dr.ghu,2);
if options_.block
+11 −4
Original line number Diff line number Diff line
@@ -84,7 +84,11 @@ end

disp(['  ']),

if any(idemodel.ino)

no_warning_message_display=1;

if any(idemodel.ino) || any(any(idemodel.ind0==0)) || any(any(idemodel.jweak_pair))
    no_warning_message_display=0;
    disp('WARNING !!!')
    if SampleSize>1
        disp(['The rank of H (model) is deficient for ', num2str(length(find(idemodel.ino))),' out of ',int2str(SampleSize),' MC runs!'  ]),
@@ -152,12 +156,15 @@ if any(idemodel.ino)
    %         end
end

if ~any(idemodel.ino) && ~any(any(idemodel.ind0==0))
if no_warning_message_display
    disp(['All parameters are identified in the model (rank of H).' ]),
    skipline()
end

if any(idemoments.ino)
no_warning_message_display = 1;

if any(idemoments.ino) || any(any(idemoments.ind0==0)) || any(any(idemoments.jweak_pair))
    no_warning_message_display = 0;
    skipline()
    disp('WARNING !!!')
    if SampleSize > 1
@@ -234,7 +241,7 @@ if any(idemoments.ino)
    %         end
    %     end
end
if ~any(idemoments.ino) && ~any(any(idemoments.ind0==0))
if no_warning_message_display
    skipline()
    disp(['All parameters are identified by J moments (rank of J)' ]),
    skipline()
+6 −5
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ m(non_stationary_vars) = NaN;
i1 = find(abs(diag(oo_.gamma_y{1})) > 1e-12);
s2 = diag(oo_.gamma_y{1});
sd = sqrt(s2);
if options_.order == 2
if options_.order == 2 && ~M_.hessian_eq_zero
    m = m+oo_.gamma_y{options_.ar+3};
end

@@ -123,7 +123,8 @@ if length(i1) == 0
end

if options_.nocorr == 0 && size(stationary_vars, 1) > 0
    corr = oo_.gamma_y{1}(i1,i1)./(sd(i1)*sd(i1)');
    corr=NaN(size(oo_.gamma_y{1}));
    corr(i1,i1) = oo_.gamma_y{1}(i1,i1)./(sd(i1)*sd(i1)');
    if options_.contemporaneous_correlation 
        oo_.contemporaneous_correlation = corr;
    end
@@ -138,12 +139,12 @@ if options_.nocorr == 0 && size(stationary_vars, 1) > 0
        labels = deblank(M_.endo_names(ivar(i1),:));
        headers = char('Variables',labels);
        lh = size(labels,2)+2;
        dyntable(options_,title,headers,labels,corr,lh,8,4);
        dyntable(options_,title,headers,labels,corr(i1,i1),lh,8,4);
        if options_.TeX
            labels = deblank(M_.endo_names_tex(ivar(i1),:));
            headers=char('Variables',labels);
            lh = size(labels,2)+2;
            dyn_latex_table(M_,options_,title,'th_corr_matrix',headers,labels,corr,lh,8,4);
            dyn_latex_table(M_,options_,title,'th_corr_matrix',headers,labels,corr(i1,i1),lh,8,4);
        end
    end
end
+9 −9
Original line number Diff line number Diff line
@@ -206,7 +206,7 @@ end
%$
%$ try
%$    if isoctave
%$        s = quadv(density, .0000000001, 100000,1e-10);
%$        s = quadl(density, .0000000001, 100000, 1e-10);
%$    else
%$        s = integral(density, 0, 100000);
%$    end
@@ -229,7 +229,7 @@ end
%$
%$ try
%$    if isoctave
%$        s = quadv(density, .0000000001, 100000,1e-10);
%$        s = quadl(density, .0000000001, 100000, 1e-10);
%$    else
%$        s = integral(density, 0, 100000);
%$    end
@@ -252,7 +252,7 @@ end
%$
%$ try
%$    if isoctave
%$        s = quadv(density, .0000000001, 100000,1e-10)
%$        s = quadl(density, .0000000001, 100000, 1e-10);
%$    else
%$        s = integral(density, 0, 100000);
%$    end
@@ -279,7 +279,7 @@ end
%$
%$ try
%$    if isoctave
%$        s = quadv(xdens, .0000000001, 20,1e-10)
%$        s = quadgk(xdens, .0000000001, 100000, 1e-10);
%$    else
%$        s = integral(xdens, 0, 100000);
%$    end
@@ -302,7 +302,7 @@ end
%$
%$ try
%$    if isoctave
%$        s = quadv(xdens, .0000000001, 100000,1e-10)
%$        s = quadl(xdens, .0000000001, 100000, 1e-10);
%$    else
%$        s = integral(xdens, 0, 100000);
%$    end
@@ -325,7 +325,7 @@ end
%$
%$ try
%$    if isoctave
%$        s = quadv(xdens, .0000000001, 100000,1e-10)
%$        s = quadl(xdens, .0000000001, 100000, 1e-10);
%$    else
%$        s = integral(xdens, 0, 100000);
%$    end
@@ -351,7 +351,7 @@ end
%$    s = NaN(n, 1);
%$    for i=1:n
%$        if isoctave()
%$            s(i) = quadv(density, .0000000001, .1*i,1e-10)
%$             s(i) = quadl(density, .0000000001, .1*i, 1e-10);
%$        else
%$            s(i) = integral(density, 0, .1*i);
%$        end
@@ -382,7 +382,7 @@ end
%$    s = NaN(n, 1);
%$    for i=1:n
%$        if isoctave()
%$            s(i) = quadv(density, .0000000001, .1*i,1e-10)
%$            s(i) = quadl(density, .0000000001, .1*i, 1e-10);
%$        else
%$            s(i) = integral(density, 0, .1*i);
%$        end
@@ -413,7 +413,7 @@ end
%$    s = NaN(n, 1);
%$    for i=1:n
%$        if isoctave()
%$            s(i) = quadv(density, .0000000001, .1*i,1e-10)
%$            s(i) = quadl(density, .0000000001, .1*i, 1e-10);
%$        else
%$            s(i) = integral(density, 0, .1*i);
%$        end
+2 −16
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ function [fval,info,exit_flag,DLIK,Hess,SteadyState,trend_coeff,Model,DynareOpti
%! @end deftypefn
%@eod:

% Copyright (C) 2004-2017 Dynare Team
% Copyright (C) 2004-2018 Dynare Team
%
% This file is part of Dynare.
%
@@ -146,20 +146,6 @@ Hess = [];
% Ensure that xparam1 is a column vector.
xparam1 = xparam1(:);

if DynareOptions.estimation_dll
    [fval,exit_flag,SteadyState,trend_coeff,info,params,H,Q] ...
        = logposterior(xparam1,DynareDataset, DynareOptions,Model, ...
                       EstimatedParameters,BayesInfo,DynareResults);
    mexErrCheck('logposterior', exit_flag);
    Model.params = params;
    if ~isequal(Model.H,0)
        Model.H = H;
    end
    Model.Sigma_e = Q;
    DynareResults.dr.ys = SteadyState;
    return
end

% Set flag related to analytical derivatives.
analytic_derivation = DynareOptions.analytic_derivation;

@@ -372,7 +358,7 @@ switch DynareOptions.lik_init
        error(['The model requires Diffuse filter, but you specified a different Kalman filter. You must set options_.kalman_algo ' ...
               'to 0 (default), 3 or 4'])
    end
    [Pstar,Pinf] = compute_Pinf_Pstar(Z,T,R,Q,DynareOptions.qz_criterium,[1:length(T)]);
    [Pstar,Pinf] = compute_Pinf_Pstar(Z,T,R,Q,DynareOptions.qz_criterium);
    Z =zeros(length(BayesInfo.mf),size(T,1));
    for i = 1:length(BayesInfo.mf)
        Z(i,BayesInfo.mf(i))=1;