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

Target

Select target project
  • giovanma/dynare
  • giorgiomas/dynare
  • Vermandel/dynare
  • Dynare/dynare
  • normann/dynare
  • MichelJuillard/dynare
  • wmutschl/dynare
  • FerhatMihoubi/dynare
  • sebastien/dynare
  • lnsongxf/dynare
  • rattoma/dynare
  • CIMERS/dynare
  • FredericKarame/dynare
  • SumuduK/dynare
  • MinjeJeon/dynare
  • camilomrch/dynare
  • DoraK/dynare
  • avtishin/dynare
  • selma/dynare
  • claudio_olguin/dynare
  • jeffjiang07/dynare
  • EthanSystem/dynare
  • stepan-a/dynare
  • wjgatt/dynare
  • JohannesPfeifer/dynare
  • gboehl/dynare
  • chskcau/dynare-doc-fixes
27 results
Show changes
Commits on Source (252)
Showing
with 1440 additions and 351 deletions
......@@ -19,6 +19,7 @@ BreakInheritanceList: AfterColon
Cpp11BracedListStyle: true
DeriveLineEnding: false
IndentPPDirectives: AfterHash
InsertNewlineAtEOF: true
PackConstructorInitializers: NextLine
PPIndentWidth: 1
PointerAlignment: Left
......
variables:
GIT_SUBMODULE_STRATEGY: recursive
TERM: linux
MATLAB_VERSION: R2023b
MATLAB_VERSION: R2024b
OLD_MATLAB_VERSION: R2018b
# To ensure that "false && true" fails, see https://gitlab.com/gitlab-org/gitlab-runner/-/issues/25394#note_412609647
FF_ENABLE_BASH_EXIT_CODE_CHECK: 'true'
......@@ -11,12 +11,10 @@ variables:
# - if VERSION was already set (when manually running a pipeline), use it
# - if we are in the official Dynare repository:
# + if on a tag: use the tag
# + if on master: use 6-unstable-$TIMESTAMP-$COMMIT
# + on another branch: use $BRANCH-$TIMESTAMP-$COMMIT
# - if in a personal repository: use $USER-$TIMESTAMP-$COMMIT
before_script:
- 'if [[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Dynare ]] && [[ -n $CI_COMMIT_TAG ]]; then export VERSION=$CI_COMMIT_TAG; fi'
- 'if [[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Dynare ]] && [[ $CI_COMMIT_REF_NAME == master ]]; then export VERSION=6-unstable-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA; fi'
- 'if [[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Dynare ]]; then export VERSION=$CI_COMMIT_REF_NAME-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA; fi'
- 'if [[ -z $VERSION ]]; then export VERSION=$CI_PROJECT_NAMESPACE-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA; fi'
......@@ -162,7 +160,6 @@ test_old_matlab:
paths:
- build-old-matlab/meson-logs/testlog.txt
when: always
when: manual
test_octave:
stage: test
......@@ -175,7 +172,6 @@ test_octave:
- build-octave/meson-logs/testlog.txt
when: always
needs: [ "build_octave" ]
when: manual
test_clang_format:
stage: test
......@@ -184,6 +180,17 @@ test_clang_format:
- ninja -C build-clang-format clang-format-check
needs: []
test_clang_tidy:
stage: test
script:
# Hack needed for meson < 1.6.0 which only looks for unversioned clang-tidy
- mkdir -p ~/.local/bin && ln -s /usr/bin/clang-tidy-19 ~/.local/bin/clang-tidy
- export PATH="$HOME/.local/bin:$PATH"
- meson setup -Dbuild_for=octave build-clang-tidy
- ninja -C build-clang-tidy clang-tidy
needs: []
when: manual
# For the sign and deploy jobs, we don’t use the “needs” keyword, since we
# don’t want those jobs to start before the “test” and “pkg” stages have
# succeeded. Hence we stick to the “dependencies” keyword.
......@@ -191,7 +198,7 @@ test_clang_format:
sign_windows:
stage: sign
rules:
- if: '$CI_PROJECT_NAMESPACE == "Dynare" && $CI_COMMIT_REF_NAME == "master"'
- if: '$CI_PROJECT_NAMESPACE == "Dynare" && $CI_COMMIT_TAG =~ /^6/'
when: on_success
- when: never
tags:
......@@ -205,10 +212,10 @@ sign_windows:
- windows/exe-signed/*
expire_in: 3 days
deploy_manual_unstable:
deploy_manual_stable:
stage: deploy
rules:
- if: '$CI_PROJECT_NAMESPACE == "Dynare" && $CI_COMMIT_REF_NAME == "master"'
- if: '$CI_PROJECT_NAMESPACE == "Dynare" && $CI_COMMIT_TAG =~ /^6\.[0-9]+$/'
when: on_success
- when: never
tags:
......@@ -216,12 +223,13 @@ deploy_manual_unstable:
dependencies:
- build_doc
script:
- rsync --recursive --links --delete build-doc/dynare-manual.html/ /srv/www.dynare.org/manual-unstable/
- rsync --recursive --links --delete build-doc/dynare-manual.html/ /srv/www.dynare.org/manual/
- cp build-doc/dynare-manual.pdf /srv/www.dynare.org/manual.pdf
deploy_snapshot_unstable:
deploy_release_stable:
stage: deploy
rules:
- if: '$CI_PROJECT_NAMESPACE == "Dynare" && $CI_COMMIT_REF_NAME == "master"'
- if: '$CI_PROJECT_NAMESPACE == "Dynare" && $CI_COMMIT_TAG =~ /^6\.[0-9]+$/'
when: on_success
- when: never
tags:
......@@ -233,11 +241,33 @@ deploy_snapshot_unstable:
- pkg_macOS_arm64
- pkg_macOS_x86_64
script:
- cp build-src/meson-dist/*.tar.xz /srv/www.dynare.org/snapshot/source/ && ln -sf *.tar.xz /srv/www.dynare.org/snapshot/source/dynare-latest-src.tar.xz
- f=(windows/exe-signed/*) && cp ${f[0]} /srv/www.dynare.org/snapshot/windows/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/windows/dynare-latest-win.exe
- f=(windows/7z/*) && cp ${f[0]} /srv/www.dynare.org/snapshot/windows-7z/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/windows-7z/dynare-latest-win.7z
- f=(windows/zip/*) && cp ${f[0]} /srv/www.dynare.org/snapshot/windows-zip/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/windows-zip/dynare-latest-win.zip
- f=(macOS/pkg/*-arm64.pkg) && cp ${f[0]} /srv/www.dynare.org/snapshot/macos-arm64/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/macos-arm64/dynare-latest-macos-arm64.pkg
- f=(macOS/pkg/*-x86_64.pkg) && cp ${f[0]} /srv/www.dynare.org/snapshot/macos-x86_64/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/macos-x86_64/dynare-latest-macos-x86_64.pkg
- ~/update-snapshot-list.sh
- cp build-src/meson-dist/*.tar.xz /srv/www.dynare.org/release/source/
- cp windows/exe-signed/* /srv/www.dynare.org/release/windows/
- cp windows/7z/* /srv/www.dynare.org/release/windows-7z/
- cp windows/zip/* /srv/www.dynare.org/release/windows-zip/
- cp macOS/pkg/*-arm64.pkg /srv/www.dynare.org/release/macos-arm64/
- cp macOS/pkg/*-x86_64.pkg /srv/www.dynare.org/release/macos-x86_64/
- ~/update-release-list.sh
- curl -X POST -F token="$WEBSITE_PIPELINE_TRIGGER_TOKEN" -F ref=master https://git.dynare.org/api/v4/projects/40/trigger/pipeline
deploy_beta_stable:
stage: deploy
rules:
- if: '$CI_PROJECT_NAMESPACE == "Dynare" && $CI_COMMIT_TAG =~ /^6(\.[0-9]+)?-(beta|rc)[0-9]+$/'
when: on_success
- when: never
tags:
- deploy
dependencies:
- pkg_source
- pkg_windows
- sign_windows
- pkg_macOS_arm64
- pkg_macOS_x86_64
script:
- cp build-src/meson-dist/*.tar.xz /srv/www.dynare.org/beta/source/
- cp windows/exe-signed/* /srv/www.dynare.org/beta/windows/
- cp windows/7z/* /srv/www.dynare.org/beta/windows-7z/
- cp windows/zip/* /srv/www.dynare.org/beta/windows-zip/
- cp macOS/pkg/*-arm64.pkg /srv/www.dynare.org/beta/macos-arm64/
- cp macOS/pkg/*-x86_64.pkg /srv/www.dynare.org/beta/macos-x86_64/
......@@ -10,7 +10,7 @@
[submodule "matlab/utilities/tests"]
path = matlab/utilities/tests
url = ../../Dynare/m-unit-tests.git
[submodule "matlab/modules/dseries"]
[submodule "matlab/dseries"]
path = matlab/dseries
url = ../../Dynare/dseries.git
branch = master
......
Announcement for Dynare 6.3 (on 2025-02-19)
===========================================
We are pleased to announce the release of Dynare 6.3.
This maintenance release fixes various bugs.
The Windows, macOS, MATLAB online and source packages are available for
download at [the Dynare website](https://www.dynare.org/download/).
This release is compatible with MATLAB versions ranging from 9.5 (R2018b) to
24.2 (R2024b), and with GNU Octave versions ranging from 7.1.0 to 9.4.0 (NB:
the Windows package requires version 9.4.0 specifically).
Here is a list of the problems identified in version 6.2 and that have been
fixed in version 6.3:
* OccBin with option `smoother_inversion_filter` would crash the MCMC
estimation if the `filtered_variables` or `filter_step_ahead` options were
used
* OccBin with option `smoother_inversion_filter` would use the PKF if
`mh_replic>0`
* OccBin with option `smoothed_state_uncertainty` would crash Dynare if the
MCMC smoother was run after the classical one
* OccBin's smoother would crash when encountering an internal error due to the
output of the linear smoother not having been computed
* Calling `model_info` with `differentiate_forward_vars` would crash
* The `identification` command would compute the asymptotic Hessian via
simulation instead of via moments as intended
* The `identification` command would crash during prior sampling if the initial
draw did not solve the model
* The `gsa_sample_file` was broken
* Optimization algorithm `mode_compute=5` (`newrat`) would crash with
`analytic_derivation`
* The `discretionary_policy` command would crash if the model was purely
forward-looking
* The `dsample` command would crash
* The `conditional_forecast_paths` block did not accept vector inputs
* For MCMC chains with fewer than 6000 draws, the default number of `sub_draws`
used to compute posterior moments was incorrect
* Bi-annual dates (e.g. `2024S1` or `2024H1`) were not accepted within Dynare
statements
* Plotting `dseries` did not correctly show dates on the x-axis
Announcement for Dynare 6.2 (on 2024-09-25)
===========================================
We are pleased to announce the release of Dynare 6.2.
This maintenance release fixes various bugs.
The Windows, macOS, MATLAB online and source packages are available for
download at [the Dynare website](https://www.dynare.org/download/).
This release is compatible with MATLAB versions ranging from 9.5 (R2018b) to
24.2 (R2024b), and with GNU Octave versions ranging from 7.1.0 to 9.2.0 (NB:
the Windows package requires version 9.2.0 specifically).
Here is a list of the problems identified in version 6.1 and that have been
fixed in version 6.2:
* The mixed complementarity problem (MCP) solver could fail or give wrong
results in some cases where there were multiple complementarity conditions
* The `qmc_sequence` MEX file from the macOS package would fail to load
* OccBin forecasts would crash in case of shocks with zero variance
* OccBin smoother would crash if simulation did not converge
* Computation of posterior moments could crash in large models
* The auxiliary particle filter and the Liu & West online filter
(`mode_compute=11`) required the Statistics Toolbox
* The auxiliary particle filter and the Liu & West online filter
(`mode_compute=11`) would not work with the `discretionary_policy` command
* The `discretionary_policy` command would crash if there were fewer than two
exogenous variables
* Using the `forecast` command with a model solved at `order>1` without
`varexo_det` would return forecasts based on a first order approximation
instead of providing an error message
* Using the `forecast` command with a model solved at `order=2` with
`varexo_det` and `pruning` would return forecasts without `pruning` instead
of providing an error message
* Using the `forecast` command with a model solved at `order=3` would crash
* SMC methods could return wrong posterior results if the Parallel Toolbox was
installed
* The Herbst-Schorfheide SMC sampler would crash at `order>1`
* Annualized shock decomposition would not output results if desired vintage
date did not coincide to an end-of-the-year Q4 period
* Using `rand_multivariate_student` as the proposal density in the
`tailored_random_block_metropolis_hastings` posterior sampler would return
wrong results
* The `onlyclearglobals` of the `dynare` command was not working as intended
* The `det_cond_forecast` command would crash with plans including only
expected shocks
* Estimation could crash in some rare cases when computing the 2nd order
moments of prior or posterior distribution
* Successive calls of the Herbst-Schorfheide SMC sampler could crash due to
some stale files being left on disk
* The shock decomposition plot could be wrong in the presence of leads/lags on
exogenous variables, or when the steady state is squeezed
Announcement for Dynare 6.1 (on 2024-05-02)
===========================================
We are pleased to announce the release of Dynare 6.1.
This maintenance release fixes various bugs.
The Windows, macOS, MATLAB online and source packages are already available for
download at [the Dynare website](https://www.dynare.org/download/).
This release is compatible with MATLAB versions ranging from 9.5 (R2018b) to
24.1 (R2024a), and with GNU Octave versions ranging from 7.1.0 to 9.1.0 (NB:
the Windows package requires version 9.1.0 specifically).
Here is a list of the problems identified in version 6.0 and that have been
fixed in version 6.1:
* Identification: simulated moments were triggered instead of theoretical ones
* Variance decompositions would crash with measurement errors when zero
variance shocks were present
* The handling of Lagrange multipliers in the display of problems with the
Jacobian was wrong
* The option `auxname` was missing in the documentation of the `pac_model`
command
* PAC equation estimation/simulation was crashing in the case of composite
target
* The PAC equation estimation would crash if the PAC target was a transformed
variable
* The `perfect_foresight_with_expectation_errors_solver` command could return
incorrect results when used in conjunction with
`homotopy_linearization_fallback` or
`homotopy_marginal_linearization_fallback` options
* For scalar values, the description of the `horizon` option of the
`var_expectation_model` command was incorrect
* The steady state computation with the `bytecode` option in a Ramsey model
was broken
* OccBin: the piecewise Kalman filter would crash in case of a periodic
solution
* The `heteroskedastic_filter` option of the `estimation` command would cause a
crash if there was only one shock
* The `method_of_moments` command would crash during the J-test for just and
underidentified models
* User-defined `warning` settings were internally overwritten with the
`method_of_moments` command or the piecewise Kalman filter
* The SMC sampler would crash if any of the `bayesian_irf`, `moments_varendo`,
or `smoother` options of the `estimation` command had been specified
* The `bvar_irf` command would ignore the `SquareRoot` option and instead
employ a Cholesky decomposition
* The univariate Kalman filter erroneously treated observations with negative
prediction variances due to numerical issues as missing values instead of
discarding the parameter draw
Moreover, a new `homotopy_exclude_varexo` option to the
`perfect_foresight_solver` command has been added, to exclude some exogenous
variables from the homotopy procedure (*i.e.* to keep them at their value
corresponding to 100% of the shock during all homotopy iterations).
Announcement for Dynare 6.0 (on 2024-02-02)
===========================================
We are pleased to announce the release of Dynare 6.0.
This major release adds new features and fixes various bugs.
The Windows, macOS, MATLAB Online and source packages are already available for
download at [the Dynare website](https://www.dynare.org/download/).
This release is compatible with MATLAB versions ranging from 9.5 (R2018b) to
23.2 (R2023b), and with GNU Octave versions ranging from 7.1.0 to 8.4.0 (NB:
the Windows package requires version 8.4.0 specifically).
Major user-visible changes
--------------------------
- The Sequential Monte Carlo sampler as described by Herbst and Schorfheide
(2014) is now available under value `hssmc` for option
`posterior_sampling_method`.
- New routines for perfect foresight simulation with expectation errors. In
such a scenario, agents make expectation errors in that the path they had
anticipated in period 1 is not realized exactly. More precisely, in some
simulation periods, they may receive new information that makes them revise
their anticipation for the path of future shocks. Also, under this scenario,
it is assumed that agents behave as under perfect foresight, *i.e.* they
make their decisions as if there were no uncertainty and they knew exactly
the path of future shocks; the new information that they may receive comes
as a total surprise to them. Available under new
`perfect_foresight_with_expectation_errors_setup` and
`perfect_foresight_with_expectation_errors_solver` commands, and
`shocks(learnt_in=…)`, `mshocks(learnt_in=…)` and `endval(learnt_in=…)`
blocks.
- New routines for IRF matching with stochastic simulations:
- Both frequentist (as in Christiano, Eichenbaum, and Evans, 2005) and
Bayesian (as in Christiano, Trabandt, and Walentin, 2010) IRF matching
approaches are implemented. The core idea of IRF matching is to treat
empirical impulse responses (*e.g.* given from an SVAR or local projection
estimation) as data and select model parameters that align the model’s
IRFs closely with their empirical counterparts.
- Available under option `mom_method = irf_matching` option to the
`method_of_moments` command.
- New blocks `matched_irfs` and `matched_irfs_weights` for specifying the
values and weights of the empirical impulse response functions.
- Pruning à la Andreasen et al. (2018) is now available at an arbitrary
approximation order when performing stochastic simulations with
`stoch_simul`, and at 3rd order when performing particle filtering.
- New `log` option to the `var` statement. In addition to the endogenous
variable(s) thus declared, this option also triggers the creation of
auxiliary variable(s) equal to the log of the corresponding endogenous
variable(s). For example, given a `var(log) y;` statement, two endogenous
will be created (`y` and `LOG_y`), and an auxiliary equation linking the two
will also be added (equal to `y = exp(LOG_y);`). Moreover, every occurrence
of `y` in the model will be replaced by `exp(LOG_y)`. This option is, for
example, useful for performing a loglinear approximation of some variable(s)
in the context of a first-order stochastic approximation; or for ensuring
that the variable(s) stay(s) in the definition domain of the function
defining the steady state or the dynamic residuals when the nonlinear solver
is used.
- New model editing features
- Multiple `model` blocks are now supported (this was already working but
not explicitly documented).
- Multiple `estimated_params` blocks now concatenate their contents (instead
of overwriting previous ones, which was the former undocumented behavior);
an `overwrite` option has been added to provide the old behavior.
- New `model_options` statement to set model options in a global fashion.
- New `model_remove` command to remove equations.
- New `model_replace` block to replace equations.
- New `var_remove` command to remove variables (or parameters).
- New `estimated_params_remove` block to remove estimated parameters.
- Stochastic simulations
- Performance improvements for simulation of the solution under perturbation
and for particle filtering at higher order (⩾ 3).
- Performance improvement for the first order perturbation solution using
either cycle reduction (`dr=cycle_reduction` option) or logarithmic
reduction (`dr=logarithmic_reduction`).
- New `nomodelsummary` option to the `stoch_simul` command, to suppress the
printing of the model summary and the covariance of the exogenous shocks.
- Estimation
- A truncated normal distribution can now be specified as a prior, using the
3rd and 4th parameters of the `estimated_params` block as the bounds.
- New `conditional_likelihood` option to the `estimation` command. When the
option is set, instead of using the Kalman filter to evaluate the
likelihood, Dynare will evaluate the conditional likelihood based on the
first-order reduced form of the model by assuming that the initial state
vector is at its steady state.
- New `additional_optimizer_steps` option to the `estimation` command to
trigger the sequential execution of several optimizers when looking for
the posterior mode.
- The `generate_trace_plots` command now allows comparing multiple chains.
- The Geweke and Raftery-Lewis convergence diagnostics will now also be
displayed when `mh_nblocks>1`.
- New `robust`, `TolGstep`, and `TolGstepRel` options to the optimizer
available under `mode_compute=5` (“newrat”).
- New `brooks_gelman_plotrows` option to the `estimation` command for
controlling the number of parameters to depict along the rows of the
figures depicting the Brooks and Gelman (1998) convergence diagnostics.
- New `mh_init_scale_factor` option to the `estimation` command tor govern
the overdispersion of the starting draws when initializing several Monte
Carlo Markov Chains. This option supersedes the `mh_init_scale` option,
which is now deprecated.
- Steady state computation
- Steady state computation now accounts for occasionally-binding constraints
of mixed-complementarity problems (as defined by `mcp` tags).
- New `tolx` option to the `steady` command for governing the termination
based on the step tolerance.
- New `fsolve_options` option to the `steady` command for passing options to
`fsolve` (in conjunction with the `solve_algo=0` option).
- New option `from_initval_to_endval` option to the `homotopy_setup` block,
for easily computing homotopy from initial to terminal steady state (when
the former is already computed).
- New `non_zero` option to `resid` command to restrict display to non-zero
residuals.
- Perfect foresight
- Significant performance improvement of the `stack_solve_algo=1` option to
the `perfect_foresight_solver` command (Laffargue-Boucekkine-Juillard
algorithm) when used in conjunction with options `block` and/or `bytecode`
of the `model` block.
- New `relative_to_initval` option to the `mshocks` block, to use the
initial steady state as a basis for the multiplication when there is an
`endval` block.
- New `static_mfs` option to the `model` block (and to the `model_options`
command), for controlling the minimum feedback set computation for the
static model. It defaults to `0` (corresponding to the behavior in Dynare
version 5).
- Various improvements to homotopy
- New `endval_steady` option to the `perfect_foresight_setup` command for
computing the terminal steady state at the same time as the transitory
dynamics (and new options `steady_solve_algo`, `steady_tolf`,
`steady_tolx`, `steady_maxit` and `steady_markowitz` for controlling the
steady state nonlinear solver).
- New `homotopy_linearization_fallback` and
`homotopy_marginal_linearization_fallback` options to the
`perfect_foresight_solver` command to get an approximate solution when
homotopy fails to go to 100%.
- New `homotopy_initial_step_size`, `homotopy_min_step_size`,
`homotopy_step_size_increase_success_count` and
`homotopy_max_completion_share` options to the
`perfect_foresight_solver` command to fine tune the homotopy behavior.
- Purely backward, forward and static models are now supported by the
homotopy procedure.
- The `stack_solve_algo=1` and `stack_solve_algo=6` options of the
`perfect_foresight_solver` command were merged and are now synonymous.
They both provide the Laffargue-Boucekkine-Juillard algorithm and work
with and without the `block` and `bytecode` options of the `model` block.
Using `stack_solve_algo=1` is now recommended, but `stack_solve_algo=6` is
kept for backward compatibility.
- OccBin
- New `simul_reset_check_ahead_periods` option to the `occbin_setup` and
`occbin_solver` commands, for resetting `check_ahead_periods` in each
simulation period.
- new `simul_max_check_ahead_periods`, `likelihood_max_check_ahead_periods`,
and `smoother_max_check_ahead_periods` options to the `occbin_setup`
command, for truncating the number of periods for which agents check ahead
which regime is present.
- Optimal policy
- The `osr` command now accepts the `analytic_derivation` and
`analytic_derivation_mode` options.
- The `evaluate_planner_objective` command now computes the unconditional
welfare for higher-order approximations (⩾ 3).
- New `periods` and `drop` options to the `evaluate_planner_objective`
command.
- Semi-structural models
- New `pac_target_info` block for decomposing the PAC target into an
arbitrary number of components. Furthermore, in the presence of such a
block, the new `pac_target_nonstationary` operator can be used to select
the non stationary part of the target (typically useful in the error
correction term of the PAC equation).
- New `kind` option to the `pac_model` command. This option allows the user
to select the formula used to compute the weights on the VAR companion
matrix variables that are used to form PAC expectations.
- Performance improvement to `solve_algo=12` and `solve_algo=14`, which
significantly accelerates the simulation of purely backward, forward and
static models with the `perfect_foresight_solver` command and the routines
for semi-structural models.
- dseries classes
- The `remove` and `remove_` methods now accept a list of variables (they
would previously only accept a single variable).
- New MATLAB/Octave command `dplot` to plot mathematical expressions
generated from variables fetched from (different) dseries objects.
- Misc
- New `display_parameter_values` command to print the parameter values in
the command window.
- New `collapse_figures_in_tabgroup` command to dock all figures.
- Performance improvement for the `use_dll` option of the `model` block. The
preprocessor now takes advantage of parallelization when compiling the MEX
files.
- New mathematical primitives available: complementary error function
(`erfc`), hyperbolic functions (`cosh`, `sinh`, `tanh`, `acosh`, `asinh`,
`atanh`).
- New `last_simulation_period` option to the `initval_file` command.
- The `calib_smoother` command now accepts the `nobs` and
`heteroskedastic_filter` options.
- Under the MATLAB Desktop, autocompletion is now available for the `dynare`
command and other CLI commands (thanks to Eduard Benet Cerda from
MathWorks).
- Model debugging: The preprocessor now creates files for evaluating the
left- and right-hand sides of model equations separately. For a model file
called `ramst.mod`, you can call
`[lhs,rhs]=ramst.debug.static_resid(y,x,params);` (for the static model)
and `[lhs,rhs]=ramst.debug.dynamic_resid(y,x,params,steady_state);` (for
the dynamic model), where `y` are the endogenous, `x` the exogenous,
`params` the parameters, and `steady_state` is self-explanatory. NB: In
the dynamic case, the vector `y` of endogenous must have 3n elements
where n is the number of endogenous (including auxiliary ones); the
first n elements correspond to the lagged values, the middle n
elements to the contemporaneous values, and the last n elements to the
lead values.
- New interactive MATLAB/Octave command `search` for listing the equations
in which given variable(s) appear (requires `json` command line option).
- The `model_info` command allows to print the block decomposition even if
the `block` option of the `model` block has not been used, by specifying
the new options `block_static` and `block_dynamic`.
- There is now a default value for the global initialization file
(`GlobalInitFile` option of the configuration file): the `global_init.m`
in the Dynare configuration directory (typically
`$HOME/.config/dynare/global_init.m` under Linux and macOS, and
`c:\Users\USERNAME\AppData\Roaming\dynare\global_init.m` under Windows).
- For those compiling Dynare from source, the build system has been entirely
rewritten and now uses Meson; as a consequence, it is now faster and
easier to understand.
- References:
- Andreasen, Martin M., Jesús Fernández-Villaverde, and Juan Rubio-Ramírez
(2018): “The Pruned State-Space System for Non-Linear DSGE Models: Theory
and Empirical Applications,” *Review of Economic Studies*, 85(1), 1-49.
- Brooks, Stephen P., and Andrew Gelman (1998): “General methods for
monitoring convergence of iterative simulations,” *Journal of Computational
and Graphical Statistics*, 7, pp. 434–455.
- Christiano, Eichenbaum and Charles L. Evans (2005): “Nominal Rigidities and
the Dynamic Effects of a Shock to Monetary Policy,” *Journal of Political
Economy*, 113(1), 1–45.
- Christiano, Lawrence J., Mathias Trabandt, and Karl Walentin (2010): “DSGE
Models for Monetary Policy Analysis,” In: *Handbook of Monetary Economics
3*, 285–367.
- Herbst, Edward and Schorfheide, Frank (2014): "Sequential Monte Carlo
Sampling for DSGE Models," *Journal of Applied Econometrics*, 29,
1073-1098.
Incompatible changes
--------------------
- The default value of the `mode_compute` option of the `estimation` command
has been changed to `5` (it was previously `4`).
- When using block decomposition (with the `block` option of the `model`
block), the option `mfs` now defaults to `1`. This setting should deliver
better performance in perfect foresight simulation on most models.
- The default location for the configuration file has changed. On Linux and
macOS, the configuration file is now searched by default under
`dynare/dynare.ini` in the configuration directories defined by the XDG
specification (typically `$HOME/.config/dynare/dynare.ini` for the
user-specific configuration and `/etc/xdg/dynare/dynare.ini` for the
system-wide configuration, the former having precedence over the latter).
Under Windows, the configuration file is now searched by default in
`%APPDATA%\dynare\dynare.ini` (typically
`c:\Users\USERNAME\AppData\Roaming\dynare\dynare.ini`).
- The information stored in `oo_.endo_simul, oo_.exo_simul`, and `oo_.irfs` is
no longer duplicated in the base workspace. New helper functions
`send_endogenous_variables_to_workspace`,
`send_exogenous_variables_to_workspace`, and `send_irfs_to_workspace` have
been introduced to explicitly request these outputs and to mimic the old
behavior.
- The `dynare_sensitivity` command has been renamed `sensitivity`. The old
name is still accepted but triggers a warning.
- The syntax `resid(1)` is no longer supported.
- The `mode_compute=6` option to the `estimation` command now recursively
updates the covariance matrix across the `NumberOfMh` Metropolis-Hastings
runs, starting with the `InitialCovarianceMatrix` in the first run, instead
of computing it from scratch in every Metropolis-Hastings run.
- The `periods` command has been removed.
- The `Sigma_e` command has been removed.
- The `block` option of the `model` block no longer has an effect when used in
conjunction with `stoch_simul` or `estimation` commands.
- The Dynare++ executable is no longer distributed since almost all of its
functionalities have been integrated inside Dynare for MATLAB/Octave.
- A macro-processor variable defined without a value (such as `@#define var`
in the `.mod` file or alternatively `-Dvar` on the `dynare` command line) is
now assigned the `true` logical value (it was previously assigned `1`).
- The `parallel_slave_open_mode` option of the `dynare` command has been
renamed `parallel_follower_open_mode`.
- The `static` option of the `model_info` command is now deprecated and is
replaced by the `block_static` option.
Bugs that were present in 5.5 and that have been fixed in 6.0
-------------------------------------------------------------
* The `mh_initialize_from_previous_mcmc` option of the `estimation` command
would not work if estimation was conducted with a different prior and the
last draw in the previous MCMC fell outside the new prior bounds
* When specifying a generalized inverse Gamma prior, the hyperparameter
computation would erroneously ignore the resulting mean shift
* When using the `mh_recover` option of the `estimation` command, the status
bar always started at zero instead of showing the overall progress of the
recovered chain
* The `model_diagnostics` command would fail to check the correctness of
user-defined steady state files
* GSA: LaTeX output was not working as expected
* Forecasts and filtered variables could not be retrieved with the
`heteroskedastic_shocks` block
* The OccBin smoother would potentially not display all smoothed shocks with
`heteroskedastic_filter` option
* The OccBin smoother would crash if the number of requested periods was
smaller than the data length
* The multivariate OccBin smoother would return wrong results if the constraint
was binding in the first period
* The `plot_shock_decomposition` command would fail with the `init2shocks`
block if the `initial_condition_decomposition` was not run before
* LaTeX output under Windows failed to compile for `plot_priors=1` option of
the `estimation` command and Brooks and Gelman (1998) convergence diagnostics
* The plot produced by the `shock_decomposition` command was too big, making
the close button inaccessible
* Monthly dates for October, November and December (*i.e.* with a 2-digit month
number) were not properly interpreted by the preprocessor
* Theoretical moments computed by `stoch_simul` at `order=2` with `pruning`
would not contain unconditional and conditional variance decomposition
Announcement for Dynare 5.5 (on 2023-10-23)
===========================================
......
......@@ -54,6 +54,7 @@ a 32-bit Octave.
1. [**General Instructions**](#general-instructions)
1. [**Debian or Ubuntu**](#debian-or-ubuntu)
1. [**Fedora, CentOS or RHEL**](#fedora-centos-or-rhel)
1. [**Arch Linux**](#arch-linux)
1. [**Windows**](#windows)
1. [**macOS**](#macos)
1. [**Docker**](#docker)
......@@ -103,13 +104,13 @@ If you want a certain version (e.g. 5.x) , then add `--single-branch --branch 5.
If you want to compile for MATLAB, please run the following (after adapting the path to MATLAB):
```sh
meson setup -Dmatlab_path=/usr/local/MATLAB/R2023b -Dbuildtype=debugoptimized build-matlab
meson setup -Dmatlab_path=/usr/local/MATLAB/R2023b --buildtype=debugoptimized build-matlab
```
The build directory will thus be `build-matlab`.
Or for Octave:
```sh
meson setup -Dbuild_for=octave -Dbuildtype=debugoptimized build-octave
meson setup -Dbuild_for=octave --buildtype=debugoptimized build-octave
```
The build directory will thus be `build-octave`.
......@@ -149,9 +150,10 @@ Note that running the testsuite with Octave requires the additional packages `ps
Often, it does not make sense to run the complete testsuite. For instance, if you modify codes only related to the perfect foresight model solver, you can decide to run only a subset of the integration tests, with:
```sh
meson test -C <builddir> deterministic_simulations
meson test -C <builddir> --suite deterministic_simulations
```
This will run all the integration tests in `tests/deterministic_simulations`.
This syntax also works with a nested directory (e.g. `--suite deterministic_simulations/purely_forward`).
Finally if you want to run a single integration test, e.g. `deterministic_simulations/lbj/rbc.mod`:
```sh
......@@ -182,6 +184,7 @@ All the prerequisites are packaged:
- `texlive-fonts-extra` (for ccicons)
- `texlive-science` (for amstex)
- `lmodern` (for macroprocessor PDF)
- `cm-super` (for BVAR à la Sims and GSA PDFs)
- `python3-sphinx`
- `tex-gyre`
- `latexmk`
......@@ -190,7 +193,7 @@ All the prerequisites are packaged:
You can install them all at once with:
```sh
apt install gcc g++ gfortran octave-dev libboost-graph-dev libgsl-dev libmatio-dev libslicot-dev libslicot-pic libsuitesparse-dev flex libfl-dev bison meson pkgconf texlive texlive-publishers texlive-latex-extra texlive-fonts-extra texlive-science lmodern python3-sphinx make tex-gyre latexmk libjs-mathjax x13as
apt install gcc g++ gfortran octave-dev libboost-graph-dev libgsl-dev libmatio-dev libslicot-dev libslicot-pic libsuitesparse-dev flex libfl-dev bison meson pkgconf texlive texlive-publishers texlive-latex-extra texlive-fonts-extra texlive-science lmodern cm-super python3-sphinx make tex-gyre latexmk libjs-mathjax x13as
```
If you use MATLAB, we strongly advise to also `apt install matlab-support` and confirm to rename the GCC libraries shipped with MATLAB to avoid possible conflicts with GCC libraries shipped by your distribution.
......@@ -241,15 +244,15 @@ The documentation packages have slightly different names in CentOS and RHEL, but
# compile slicot from source and put it into /home/$USER/dynare/slicot/lib/
mkdir -p /home/$USER/dynare/slicot
cd /home/$USER/dynare/slicot
wget https://deb.debian.org/debian/pool/main/s/slicot/slicot_5.0+20101122.orig.tar.gz
tar xf slicot_5.0+20101122.orig.tar.gz
cd slicot-5.0+20101122
wget https://github.com/SLICOT/SLICOT-Reference/archive/refs/tags/v5.9.tar.gz
tar xf v5.9.tar.gz
cd SLICOT-Reference-5.9
mkdir -p /home/$USER/dynare/slicot/lib
# The following two lines are only for MATLAB
make FORTRAN=gfortran OPTS="-O2 -fPIC -fdefault-integer-8" LOADER=gfortran lib
make -f makefile_Unix FORTRAN=gfortran OPTS="-O2 -fPIC -fdefault-integer-8" LOADER=gfortran lib
cp slicot.a /home/$USER/dynare/slicot/lib/libslicot64_pic.a
# The following two lines are only for Octave
make FORTRAN=gfortran OPTS="-O2 -fPIC" LOADER=gfortran lib
make -f makefile_Unix FORTRAN=gfortran OPTS="-O2 -fPIC" LOADER=gfortran lib
cp slicot.a /home/$USER/dynare/slicot/lib/libslicot_pic.a
# compile x13as from source and put it into /usr/bin/
......@@ -262,14 +265,15 @@ make -f makefile.gf FFLAGS="-O2 -std=legacy" PROGRAM=x13as
sudo cp x13as /usr/bin/
```
If you use MATLAB, we strongly advise to also rename or exclude the GCC libraries shipped with MATLAB to avoid possible conflicts with GCC libraries shipped by Fedora, see e.g. [Matlab on Fedora 33](https://mutschler.eu/linux/install-guides/fedora-post-install/#matlab) or [MATLAB-ArchWiki](https://wiki.archlinux.org/index.php/MATLAB) for instructions.
If you use MATLAB, we strongly advise to also rename or exclude the GCC libraries shipped with MATLAB to avoid possible conflicts with GCC libraries shipped by Fedora, see e.g. the [OpenGL Section of the ArchWiki article on MATLAB](https://wiki.archlinux.org/title/MATLAB#OpenGL_acceleration) for instructions.
Now use the following commands if using MATLAB (adapt them for Octave, see above):
```sh
cd /home/$USER/dynare
git clone --recurse-submodules https://git.dynare.org/dynare/dynare.git unstable
cd unstable
meson setup -Dmatlab_path=/usr/local/MATLAB/R2023b -Dfortran_args="[ '-B', '/home/$USER/dynare/slicot']" -Dbuildtype=debugoptimized build-matlab
meson setup -Dmatlab_path=/usr/local/MATLAB/R2023b -Dfortran_args="[ '-B', '/home/$USER/dynare/slicot']" --buildtype=debugoptimized build-matlab
meson compile -C build-matlab
```
......@@ -289,6 +293,43 @@ bison --version # bison (GNU Bison) 3.6.4
```
Now configure dynare as above.
## Arch Linux
The following steps show how to install Dynare on Arch Linux from source.
- Install all needed dependencies:
```sh
pacman -S git make meson boost blas gsl libmatio gcc-fortran gcc-libs
```
- Compile and install SLICOT:
```sh
wget https://github.com/SLICOT/SLICOT-Reference/archive/refs/tags/v5.9.tar.gz
tar xf v5.9.tar.gz
cd SLICOT-Reference-5.9
make -f makefile_Unix FORTRAN=gfortran OPTS="-O2 -fno-underscoring -fdefault-integer-8" LOADER=gfortran lib
mkdir -p /usr/local/lib
cp slicot.a /usr/local/lib/libslicot64_pic.a
cd ..
```
- Install `x13as-bin` from the AUR ([link to PKGBUILD](https://aur.archlinux.org/packages/x13as-bin)), either by using your favorite AUR-helper or by following the [Arch wiki](https://wiki.archlinux.org/title/Arch_User_Repository)
- Prepare the Dynare sources:
```sh
git clone --recurse-submodules https://git.dynare.org/Dynare/dynare.git
cd dynare
```
- Configure Dynare from the source directory (adjust `matlab_path` if you use a different version than R2024a):
```sh
meson setup -Dmatlab_path=/usr/local/MATLAB/R2024a --buildtype=debugoptimized build-matlab
```
- Compile:
```sh
meson compile -C build-matlab
```
- Optionally, run the testsuite:
```sh
meson test -C build-matlab
```
If you run into errors with GCC libraries/`libstdc++`, you need to prevent MATLAB from using the libraries it is shipping. For example, you could follow the [OpenGL Section of the ArchWiki article on MATLAB](https://wiki.archlinux.org/title/MATLAB#OpenGL_acceleration) by setting/exporting `LD_PRELOAD` and `LD_LIBRARY` (the exports could also be placed in your `.zprofile`). If necessary, add `java.opts` as described in the section.
## Windows
- Install [MSYS2](http://www.msys2.org)
......@@ -306,10 +347,10 @@ pacman -S git bison flex make tar mingw-w64-x86_64-meson mingw-w64-x86_64-gcc mi
```
- Compile and install SLICOT
```sh
wget https://deb.debian.org/debian/pool/main/s/slicot/slicot_5.0+20101122.orig.tar.gz
tar xf slicot_5.0+20101122.orig.tar.gz
cd slicot-5.0+20101122
make FORTRAN=gfortran OPTS="-O2 -fno-underscoring -fdefault-integer-8" LOADER=gfortran lib
wget https://github.com/SLICOT/SLICOT-Reference/archive/refs/tags/v5.9.tar.gz
tar xf v5.9.tar.gz
cd SLICOT-Reference-5.9
make -f makefile_Unix FORTRAN=gfortran OPTS="-O2 -fno-underscoring -fdefault-integer-8" LOADER=gfortran lib
mkdir -p /usr/local/lib
cp slicot.a /usr/local/lib/libslicot64_pic.a
cd ..
......@@ -321,7 +362,7 @@ cd dynare
```
- Configure Dynare from the source directory:
```sh
meson setup -Dmatlab_path=<…> -Dbuildtype=debugoptimized -Dprefer_static=true -Dfortran_args="['-B','/usr/local/lib']" build-matlab
meson setup -Dmatlab_path=<…> --buildtype=debugoptimized --prefer-static -Dfortran_args="['-B','C:/msys64/usr/local/lib']" build-matlab
```
where the path of MATLAB is specified. Note that you should use
the MSYS2 notation and not put spaces in the MATLAB path, so you probably want
......@@ -439,13 +480,13 @@ export DYNAREDIR=$HOME/dynare
```sh
mkdir -p $DYNAREDIR/slicot/lib
cd $DYNAREDIR/slicot
curl -O https://deb.debian.org/debian/pool/main/s/slicot/slicot_5.0+20101122.orig.tar.gz
tar xf slicot_5.0+20101122.orig.tar.gz
cd slicot-5.0+20101122
make -j$(sysctl -n hw.ncpu) FORTRAN=$BREWDIR/bin/gfortran OPTS="-O2" LOADER=gfortran lib
curl -O https://github.com/SLICOT/SLICOT-Reference/archive/refs/tags/v5.9.tar.gz
tar xf v5.9.tar.gz
cd SLICOT-Reference-5.9
make -f makefile_Unix -j$(sysctl -n hw.ncpu) FORTRAN=$BREWDIR/bin/gfortran OPTS="-O2" LOADER=gfortran lib
cp slicot.a $DYNAREDIR/slicot/lib/libslicot_pic.a
make clean
make -j$(sysctl -n hw.ncpu) FORTRAN=$BREWDIR/bin/gfortran OPTS="-O2 -fdefault-integer-8" LOADER=gfortran lib
make -f makefile_Unix -j$(sysctl -n hw.ncpu) FORTRAN=$BREWDIR/bin/gfortran OPTS="-O2 -fdefault-integer-8" LOADER=gfortran lib
cp slicot.a $DYNAREDIR/slicot/lib/libslicot64_pic.a
```
......@@ -456,7 +497,7 @@ cd $DYNAREDIR/x13as
curl -O https://www2.census.gov/software/x-13arima-seats/x13as/unix-linux/program-archives/x13as_asciisrc-v1-1-b60.tar.gz
tar xf x13as_asciisrc-v1-1-b60.tar.gz
sed -i '' 's/-static//g' makefile.gf
make -j$(sysctl -n hw.ncpu) -f makefile.gf FC=$BREWDIR/bin/gfortran LINKER=$BREWDIR/bin/gcc-13 FFLAGS="-O2 -std=legacy" LDFLAGS=-static-libgcc LIBS="$BREWDIR/lib/gcc/current/libgfortran.a /$BREWDIR/lib/gcc/current/libquadmath.a" PROGRAM=x13as
make -j$(sysctl -n hw.ncpu) -f makefile.gf FC=$BREWDIR/bin/gfortran LINKER=$BREWDIR/bin/gcc-14 FFLAGS="-O2 -std=legacy" LDFLAGS=-static-libgcc LIBS="$BREWDIR/lib/gcc/current/libgfortran.a /$BREWDIR/lib/gcc/current/libquadmath.a" PROGRAM=x13as
sudo cp $DYNAREDIR/x13as/x13as /usr/local/bin/x13as
cd $DYNAREDIR
x13as
......@@ -479,7 +520,7 @@ If you want a certain version (e.g. 5.x) , then add `--single-branch --branch 5.
```sh
export BUILDDIR=build-matlab
export MATLABPATH=/Applications/MATLAB_R2023b.app
arch -$ARCH meson setup --native-file macOS/homebrew-native-$ARCH.ini -Dmatlab_path=$MATLABPATH -Dbuildtype=debugoptimized -Dfortran_args="['-B','$DYNAREDIR/slicot/lib']" $BUILDDIR
arch -$ARCH meson setup --native-file macOS/homebrew-native-$ARCH.ini -Dmatlab_path=$MATLABPATH --buildtype=debugoptimized -Dfortran_args="['-B','$DYNAREDIR/slicot/lib']" $BUILDDIR
```
where you need to adapt the path to MATLAB.
Similarly, if you want to compile for Octave, replace the `-Dmatlab_path` option by `-Dbuild_for=octave`, and change the build directory to `build-octave`.
......
......@@ -22,7 +22,7 @@
\begin{document}
% ----------------------------------------------------------------
\title{Sensitivity Analysis Toolbox for DYNARE\thanks{Copyright \copyright~2012 Dynare
\title{Sensitivity Analysis Toolbox for Dynare\thanks{Copyright \copyright~2012-2024 Dynare
Team. Permission is granted to copy, distribute and/or modify
this document under the terms of the GNU Free Documentation
License, Version 1.3 or any later version published by the Free
......@@ -32,9 +32,9 @@
\author{Marco Ratto\\
European Commission, Joint Research Centre \\
TP361, IPSC, \\21027 Ispra
TP581\\21027 Ispra
(VA) Italy\\
\texttt{marco.ratto@jrc.ec.europa.eu}
\texttt{Marco.Ratto@ec.europa.eu}
\thanks{The author gratefully thanks Christophe Planas, Kenneth Judd, Michel Juillard,
Alessandro Rossi, Frank Schorfheide and the participants to the
Courses on Global Sensitivity Analysis for Macroeconomic
......@@ -52,21 +52,21 @@ helpful suggestions.}}
%-----------------------------------------------------------------------
\begin{abstract}
\noindent The Sensitivity Analysis Toolbox for DYNARE is a set of
\noindent The Sensitivity Analysis Toolbox for Dynare is a set of
MATLAB routines for the analysis of DSGE models with global
sensitivity analysis. The routines are thought to be used within
the DYNARE v4 environment.
the Dynare 6 environment.
\begin{description}
\item \textbf{Keywords}: Stability Mapping , Reduced form solution, DSGE models,
Monte Carlo filtering, Global Sensitivity Analysis.
Monte Carlo filtering, Global Sensitivity Analysis.
\end{description}
\end{abstract}
\newpage
% ----------------------------------------------------------------
\section{Introduction} \label{s:intro}
The Sensitivity Analysis Toolbox for DYNARE is a collection of
The Sensitivity Analysis Toolbox for Dynare is a collection of
MATLAB routines implemented to answer the following questions: (i)
Which is the domain of structural coefficients assuring the
stability and determinacy of a DSGE model? (ii) Which parameters
......@@ -81,20 +81,18 @@ described in \cite{Ratto_CompEcon_2008}.
\section{Use of the Toolbox}
The DYNARE parser now recognizes sensitivity analysis commands.
The Dynare parser now recognizes sensitivity analysis commands.
The syntax is based on a single command:
\vspace{0.5cm}
\verb"dynare_sensitivity(option1=<opt1_val>,option2=<opt2_val>,...)"
\verb"sensitivity(option1=<opt1_val>,option2=<opt2_val>,...)"
\vspace{0.5cm} \noindent with a list of options described in the
next section.
With respect to the previous version of the toolbox, in order to
work properly, the sensitivity analysis Toolbox \emph{no longer}
needs that the DYNARE estimation environment is set-up.
Therefore, \verb"dynare_sensitivity" is the only command to run to
In order to work properly, the sensitivity analysis Toolbox does not need
a Dynare estimation environment to be set up. Rather, \verb"sensitivity"
is the only command to run to
make a sensitivity analysis on a DSGE model\footnote{Of course,
when the user needs to perform the mapping of the fit with a
posterior sample, a Bayesian estimation has to be performed
......@@ -208,16 +206,17 @@ a multivariate normal MC sample, with covariance matrix based on
the inverse Hessian at the optimum: this analysis is useful when
ML estimation is done (i.e. no Bayesian estimation);
\item when \verb"ppost=1" the Toolbox analyses
the RMSE's for the posterior sample obtained by DYNARE's
the RMSE's for the posterior sample obtained by Dynare's
Metropolis procedure.
\end{enumerate}
The use of cases 2. and 3. requires an estimation step beforehand!
The use of cases 2. and 3. require an estimation step beforehand!
To facilitate the sensitivity analysis after estimation, the
\verb"dynare_sensitivity" command also allows to indicate some
options of \verb"dynare_estimation". These are:
\verb"sensitivity" command also allows to indicate some
options of \verb"estimation". These are:
\begin{itemize}
\item \verb"datafile"
\item \verb"diffuse_filter"
\item \verb"mode_file"
\item \verb"first_obs"
\item \verb"lik_init"
......@@ -278,10 +277,10 @@ identifiable.
\end{tabular}
\vspace{1cm}
\noindent For example, the following commands in the DYNARE model file
\noindent For example, the following commands in the Dynare model file
\vspace{1cm}
\noindent\verb"dynare_sensitivity(identification=1, morris=2);"
\noindent\verb"sensitivity(identification=1, morris=2);"
\vspace{1cm}
\noindent trigger the identification analysis using \cite{Iskrev2010,Iskrev2011}, jointly with the mapping of the acceptable region.
......@@ -293,75 +292,75 @@ Sensitivity analysis results are saved on the hard-disk of the
computer. The Toolbox uses a dedicated folder called \verb"GSA",
located in \\
\\
\verb"<DYNARE_file>\GSA", \\
\verb"<Dynare_file>\GSA", \\
\\
where \verb"<DYNARE_file>.mod" is the name of the DYNARE model
where \verb"<Dynare_file>.mod" is the name of the Dynare model
file.
\subsection{Binary data files}
A set of binary data files is saved in the \verb"GSA" folder:
\begin{description}
\item[]\verb"<DYNARE_file>_prior.mat": this file stores
\item[]\verb"<Dynare_file>_prior.mat": this file stores
information about the analyses performed sampling from the prior
ranges, i.e. \verb"pprior=1" and \verb"ppost=0";
\item[]\verb"<DYNARE_file>_mc.mat": this file stores
\item[]\verb"<Dynare_file>_mc.mat": this file stores
information about the analyses performed sampling from
multivariate normal, i.e. \verb"pprior=0" and \verb"ppost=0";
\item[]\verb"<DYNARE_file>_post.mat": this file stores information
\item[]\verb"<Dynare_file>_post.mat": this file stores information
about analyses performed using the Metropolis posterior sample,
i.e. \verb"ppost=1".
\end{description}
\begin{description}
\item[]\verb"<DYNARE_file>_prior_*.mat": these files store
\item[]\verb"<Dynare_file>_prior_*.mat": these files store
the filtered and smoothed variables for the prior MC sample,
generated when doing RMSE analysis (\verb"pprior=1" and
\verb"ppost=0");
\item[]\verb"<DYNARE_file>_mc_*.mat": these files store
\item[]\verb"<Dynare_file>_mc_*.mat": these files store
the filtered and smoothed variables for the multivariate normal MC
sample, generated when doing RMSE analysis (\verb"pprior=0" and
\verb"ppost=0").
\end{description}
\subsection{Stability analysis}
Figure files \verb"<DYNARE_file>_prior_*.fig" store results for
Figure files \verb"<Dynare_file>_prior_*.fig" store results for
the stability mapping from prior MC samples:
\begin{description}
\item[]\verb"<DYNARE_file>_prior_stab_SA_*.fig": plots of the Smirnov
test analyses confronting the cdf of the sample fulfilling
Blanchard-Kahn conditions with the cdf of the rest of the sample;
\item[]\verb"<DYNARE_file>_prior_stab_indet_SA_*.fig": plots of the Smirnov
test analyses confronting the cdf of the sample producing
indeterminacy with the cdf of the original prior sample;
\item[]\verb"<DYNARE_file>_prior_stab_unst_SA_*.fig": plots of the Smirnov
test analyses confronting the cdf of the sample producing unstable
(explosive roots) behaviour with the cdf of the original prior
\item[]\verb"<Dynare_file>_prior_stab_SA_*.fig": plots of the Smirnov
test analyses confronting the CDF of the sample fulfilling
Blanchard-Kahn conditions with the CDF of the rest of the sample;
\item[]\verb"<Dynare_file>_prior_stab_indet_SA_*.fig": plots of the Smirnov
test analyses confronting the CDF of the sample producing
indeterminacy with the CDF of the original prior sample;
\item[]\verb"<Dynare_file>_prior_stab_unst_SA_*.fig": plots of the Smirnov
test analyses confronting the CDF of the sample producing unstable
(explosive roots) behaviour with the CDF of the original prior
sample;
\item[]\verb"<DYNARE_file>_prior_stable_corr_*.fig": plots of
\item[]\verb"<Dynare_file>_prior_stable_corr_*.fig": plots of
bivariate projections of the sample fulfilling Blanchard-Kahn
conditions;
\item[]\verb"<DYNARE_file>_prior_indeterm_corr_*.fig": plots of
\item[]\verb"<Dynare_file>_prior_indeterm_corr_*.fig": plots of
bivariate projections of the sample producing indeterminacy;
\item[]\verb"<DYNARE_file>_prior_unstable_corr_*.fig": plots of
\item[]\verb"<Dynare_file>_prior_unstable_corr_*.fig": plots of
bivariate projections of the sample producing instability;
\item[]\verb"<DYNARE_file>_prior_unacceptable_corr_*.fig": plots of
\item[]\verb"<Dynare_file>_prior_unacceptable_corr_*.fig": plots of
bivariate projections of the sample producing unacceptable
solutions, i.e. either instability or indeterminacy or the
solution could not be found (e.g. the steady state solution could
not be found by the solver).
\end{description}
Similar conventions apply for \verb"<DYNARE_file>_mc_*.fig" files,
Similar conventions apply for \verb"<Dynare_file>_mc_*.fig" files,
obtained when samples from multivariate normal are used.
\subsection{RMSE analysis}
Figure files \verb"<DYNARE_file>_rmse_*.fig" store results for the
Figure files \verb"<Dynare_file>_rmse_*.fig" store results for the
RMSE analysis.
\begin{description}
\item[]\verb"<DYNARE_file>_rmse_prior*.fig": save results for
\item[]\verb"<Dynare_file>_rmse_prior*.fig": save results for
the analysis using prior MC samples;
\item[]\verb"<DYNARE_file>_rmse_mc*.fig": save results for
\item[]\verb"<Dynare_file>_rmse_mc*.fig": save results for
the analysis using multivariate normal MC samples;
\item[]\verb"<DYNARE_file>_rmse_post*.fig": save results for
\item[]\verb"<Dynare_file>_rmse_post*.fig": save results for
the analysis using Metropolis posterior samples.
\end{description}
......@@ -369,33 +368,33 @@ The following types of figures are saved (we show prior sample to
fix ideas, but the same conventions are used for multivariate
normal and posterior):
\begin{description}
\item[]\verb"<DYNARE_file>_rmse_prior_*.fig": for each parameter, plots the cdf's
\item[]\verb"<Dynare_file>_rmse_prior_*.fig": for each parameter, plots the CDF's
corresponding to the best 10\% RMES's of each observed series;
\item[]\verb"<DYNARE_file>_rmse_prior_dens_*.fig": for each parameter, plots the pdf's
\item[]\verb"<Dynare_file>_rmse_prior_dens_*.fig": for each parameter, plots the pdf's
corresponding to the best 10\% RMES's of each observed series;
\item[]\verb"<DYNARE_file>_rmse_prior_<name of observedseries>_corr_*.fig": for each observed series plots the
\item[]\verb"<Dynare_file>_rmse_prior_<name of observedseries>_corr_*.fig": for each observed series plots the
bi-dimensional projections of samples with the best 10\% RMSE's,
when the correlation is significant;
\item[]\verb"<DYNARE_file>_rmse_prior_lnlik*.fig": for each observed
series, plots \emph{in red} the cdf of the log-likelihood
corresponding to the best 10\% RMSE's, \emph{in green} the cdf of
the rest of the sample and \emph{in blue }the cdf of the full
\item[]\verb"<Dynare_file>_rmse_prior_lnlik*.fig": for each observed
series, plots \emph{in red} the CDF of the log-likelihood
corresponding to the best 10\% RMSE's, \emph{in green} the CDF of
the rest of the sample and \emph{in blue }the CDF of the full
sample; this allows to see the presence of some idiosyncratic
behaviour;
\item[]\verb"<DYNARE_file>_rmse_prior_lnpost*.fig": for each observed
series, plots \emph{in red} the cdf of the log-posterior
corresponding to the best 10\% RMSE's, \emph{in green} the cdf of
the rest of the sample and \emph{in blue }the cdf of the full
\item[]\verb"<Dynare_file>_rmse_prior_lnpost*.fig": for each observed
series, plots \emph{in red} the CDF of the log-posterior
corresponding to the best 10\% RMSE's, \emph{in green} the CDF of
the rest of the sample and \emph{in blue }the CDF of the full
sample; this allows to see idiosyncratic behaviour;
\item[]\verb"<DYNARE_file>_rmse_prior_lnprior*.fig": for each observed
series, plots \emph{in red} the cdf of the log-prior corresponding
to the best 10\% RMSE's, \emph{in green} the cdf of the rest of
the sample and \emph{in blue }the cdf of the full sample; this
\item[]\verb"<Dynare_file>_rmse_prior_lnprior*.fig": for each observed
series, plots \emph{in red} the CDF of the log-prior corresponding
to the best 10\% RMSE's, \emph{in green} the CDF of the rest of
the sample and \emph{in blue }the CDF of the full sample; this
allows to see idiosyncratic behaviour;
\item[]\verb"<DYNARE_file>_rmse_prior_lik_SA_*.fig": when
\item[]\verb"<Dynare_file>_rmse_prior_lik_SA_*.fig": when
\verb"lik_only=1", this shows the Smirnov tests for the filtering
of the best 10\% log-likelihood values;
\item[]\verb"<DYNARE_file>_rmse_prior_post_SA_*.fig": when
\item[]\verb"<Dynare_file>_rmse_prior_post_SA_*.fig": when
\verb"lik_only=1", this shows the Smirnov test for the filtering
of the best 10\% log-posterior values.
\end{description}
......@@ -405,19 +404,19 @@ In the case of the mapping of the reduced form solution, synthetic
figures are saved in the \verb"\GSA" folder:
\begin{description}
\item[]\verb"<DYNARE_file>_redform_<endo name>_vs_lags_*.fig":
\item[]\verb"<Dynare_file>_redform_<endo name>_vs_lags_*.fig":
shows bar charts of the sensitivity indices for the \emph{ten most
important} parameters driving the reduced form coefficients of the
selected endogenous variables (\verb"namendo") versus lagged
endogenous variables (\verb"namlagendo"); suffix \verb"log"
indicates the results for log-transformed entries;
\item[]\verb"<DYNARE_file>_redform_<endo name>_vs_shocks_*.fig":
\item[]\verb"<Dynare_file>_redform_<endo name>_vs_shocks_*.fig":
shows bar charts of the sensitivity indices for the \emph{ten most
important} parameters driving the reduced form coefficients of the
selected endogenous variables (\verb"namendo") versus exogenous
variables (\verb"namexo"); suffix \verb"log" indicates the results
for log-transformed entries;
\item[]\verb"<DYNARE_file>_redform_GSA(_log).fig": shows bar chart of
\item[]\verb"<Dynare_file>_redform_GSA(_log).fig": shows bar chart of
all sensitivity indices for each parameter: this allows to notice
parameters that have a minor effect for \emph{any} of the reduced
form coefficients,
......@@ -449,24 +448,24 @@ without the need of any user's intervention.
\subsection{Screening analysis}
The results of the screening analysis with Morris sampling design
are stored in the subfolder \verb"\GSA\SCREEN". The data file
\verb"<DYNARE_file>_prior" stores all the information of the
\verb"<Dynare_file>_prior" stores all the information of the
analysis (Morris sample, reduced form coefficients, etc.).
Screening analysis merely concerns reduced form coefficients.
Similar synthetic bar charts as for the reduced form analysis with
MC samples are saved:
\begin{description}
\item[]\verb"<DYNARE_file>_redform_<endo name>_vs_lags_*.fig":
\item[]\verb"<Dynare_file>_redform_<endo name>_vs_lags_*.fig":
shows bar charts of the elementary effect tests for the \emph{ten
most important} parameters driving the reduced form coefficients
of the selected endogenous variables (\verb"namendo") versus
lagged endogenous variables (\verb"namlagendo");
\item[]\verb"<DYNARE_file>_redform_<endo name>_vs_shocks_*.fig":
\item[]\verb"<Dynare_file>_redform_<endo name>_vs_shocks_*.fig":
shows bar charts of the elementary effect tests for the \emph{ten
most important} parameters driving the reduced form coefficients
of the selected endogenous variables (\verb"namendo") versus
exogenous variables (\verb"namexo");
\item[]\verb"<DYNARE_file>_redform_screen.fig": shows bar chart of
\item[]\verb"<Dynare_file>_redform_screen.fig": shows bar chart of
all elementary effect tests for each parameter: this allows to
identify parameters that have a minor effect for \emph{any} of the
reduced form coefficients.
......
......@@ -16,8 +16,8 @@ Bibliography
* Bini, Dario A., Guy Latouche, and Beatrice Meini (2002): “Solving matrix polynomial equations arising in queueing problems,” *Linear Algebra and its Applications*, 340, 225–244.
* Born, Benjamin and Johannes Pfeifer (2014): “Policy risk and the business cycle”, *Journal of Monetary Economics*, 68, 68-85.
* Boucekkine, Raouf (1995): “An alternative methodology for solving nonlinear forward-looking models,” *Journal of Economic Dynamics and Control*, 19, 711–734.
* Brayton, Flint and Peter Tinsley (1996): "A Guide to FRB/US: A Macroeconomic Model of the United States", *Finance and Economics Discussion Series*, 1996-42.
* Brayton, Flint, Morris Davis and Peter Tulip (2000): "Polynomial Adjustment Costs in FRB/US", *Unpublished manuscript*.
* Brayton, Flint and Peter Tinsley (1996): A Guide to FRB/US: A Macroeconomic Model of the United States, *Finance and Economics Discussion Series*, 1996-42.
* Brayton, Flint, Morris Davis and Peter Tulip (2000): Polynomial Adjustment Costs in FRB/US, *Unpublished manuscript*.
* Brooks, Stephen P., and Andrew Gelman (1998): “General methods for monitoring convergence of iterative simulations,” *Journal of Computational and Graphical Statistics*, 7, pp. 434–455.
* Cardoso, Margarida F., R. L. Salcedo and S. Feyo de Azevedo (1996): “The simplex simulated annealing approach to continuous non-linear optimization,” *Computers & Chemical Engineering*, 20(9), 1065-1080.
* Chib, Siddhartha and Srikanth Ramamurthy (2010): “Tailored randomized block MCMC methods with application to DSGE models,” *Journal of Econometrics*, 155, 19–38.
......@@ -29,7 +29,7 @@ Bibliography
* Collard, Fabrice and Michel Juillard (2001a): “Accuracy of stochastic perturbation methods: The case of asset pricing models,” *Journal of Economic Dynamics and Control*, 25, 979–999.
* Collard, Fabrice and Michel Juillard (2001b): “A Higher-Order Taylor Expansion Approach to Simulation of Stochastic Forward-Looking Models with an Application to a Non-Linear Phillips Curve,” *Computational Economics*, 17, 125–139.
* Corana, Angelo, M. Marchesi, Claudio Martini, and Sandro Ridella (1987): “Minimizing multimodal functions of continuous variables with the “simulated annealing” algorithm”, *ACM Transactions on Mathematical Software*, 13(3), 262–280.
* Cuba-Borda, Pablo, Luca Guerrieri, Matteo Iacoviello, and Molin Zhong (2019): "Likelihood evaluation of models with occasionally binding constraints", Journal of Applied Econometrics, 34(7), 1073-1085
* Cuba-Borda, Pablo, Luca Guerrieri, Matteo Iacoviello, and Molin Zhong (2019): Likelihood evaluation of models with occasionally binding constraints, Journal of Applied Econometrics, 34(7), 1073-1085
* Del Negro, Marco and Frank Schorfheide (2004): “Priors from General Equilibrium Models for VARs”, *International Economic Review*, 45(2), 643–673.
* Dennis, Richard (2007): “Optimal Policy In Rational Expectations Models: New Solution Algorithms”, *Macroeconomic Dynamics*, 11(1), 31–55.
* Duffie, Darrel and Kenneth J. Singleton (1993): “Simulated Moments Estimation of Markov Models of Asset Prices”, *Econometrica*, 61(4), 929-952.
......@@ -49,7 +49,7 @@ Bibliography
* Hansen, Lars P. (1982): “Large sample properties of generalized method of moments estimators,” Econometrica, 50(4), 1029–1054.
* Hansen, Nikolaus and Stefan Kern (2004): “Evaluating the CMA Evolution Strategy on Multimodal Test Functions”. In: *Eighth International Conference on Parallel Problem Solving from Nature PPSN VIII*, Proceedings, Berlin: Springer, 282–291.
* Harvey, Andrew C. and Garry D.A. Phillips (1979): “Maximum likelihood estimation of regression models with autoregressive-moving average disturbances,” *Biometrika*, 66(1), 49–58.
* Herbst, Edward and Schorfheide, Frank (2014): "Sequential monte-carlo sampling for DSGE models," *Journal of Applied Econometrics*, 29, 1073-1098.
* Herbst, Edward and Schorfheide, Frank (2014): Sequential Monte Carlo Sampling for DSGE Models, *Journal of Applied Econometrics*, 29, 1073-1098.
* Herbst, Edward (2015): “Using the “Chandrasekhar Recursions” for Likelihood Evaluation of DSGE Models,” *Computational Economics*, 45(4), 693–705.
* Ireland, Peter (2004): “A Method for Taking Models to the Data,” *Journal of Economic Dynamics and Control*, 28, 1205–26.
* Iskrev, Nikolay (2010): “Local identification in DSGE models,” *Journal of Monetary Economics*, 57(2), 189–202.
......
# -*- coding: utf-8 -*-
# Copyright © 2018-2023 Dynare Team
# Copyright © 2018-2025 Dynare Team
#
# This file is part of Dynare.
#
......@@ -34,7 +34,7 @@ html_static_path = ['_static']
master_doc = 'index'
project = u'Dynare'
copyright = u'1996–2023 Dynare Team'
copyright = u'1996–2025 Dynare Team'
author = u'Dynare Team'
add_function_parentheses = False
......@@ -71,12 +71,11 @@ latex_elements = {
warningBorderColor={RGB}{255,50,50},OuterLinkColor={RGB}{34,139,34}, \
InnerLinkColor={RGB}{51,51,255},TitleColor={RGB}{51,51,255}',
'papersize': 'a4paper',
'preamble': r'\DeclareUnicodeCharacter{200B}{}', # Part of the workaround for #1707
}
latex_documents = [
(master_doc, 'dynare-manual.tex', u'Dynare Reference Manual',
u'Dynare team', 'manual'),
u'Dynare Team', 'manual'),
]
man_pages = [
......
......@@ -8,17 +8,17 @@
Dynare misc commands
####################
.. matcomm:: send_endogenous_variables_to_workspace
.. matcomm:: send_endogenous_variables_to_workspace ;
Puts the simulation results for the endogenous variables stored in ``oo_.endo_simul``
into vectors with the same name as the respective variables into the base workspace.
.. matcomm:: send_exogenous_variables_to_workspace
.. matcomm:: send_exogenous_variables_to_workspace ;
Puts the simulation results for the exogenous variables stored in ``oo_.exo_simul``
into vectors with the same name as the respective variables into the base workspace.
.. matcomm:: send_irfs_to_workspace
.. matcomm:: send_irfs_to_workspace ;
Puts the IRFs stored in ``oo_.irfs`` into vectors with the same name into the base workspace.
......@@ -230,27 +230,97 @@ Dynare misc commands
Searches all occurrences of a variable in a model, and prints the
equations where the variable appear in the command line window. If OPTION is
set to `withparamvalues`, the values of the parameters (if available) are
displayed instead of the name of the parameters.
displayed instead of the name of the parameters. Requires the `json` command
line option to be set.
*Example*
Assuming that we already ran a `.mod` file and that the workspace has not
been cleaned after, we can search for all the equations containing variable `X`
Assuming that we already ran a `.mod` file and that the workspace has not
been cleaned after, we can search for all the equations containing variable `X`
::
::
>> search X
>> search X
Y = alpha*X/(1-X)+e;
Y = alpha*X/(1-X)+e;
diff(X) = beta*(X(-1)-mX) + gamma1*Z + gamma2*R + u;
diff(X) = beta*(X(-1)-mX) + gamma1*Z + gamma2*R + u;
To replace the parameters with estimated or calibrated parameters:
To replace the parameters with estimated or calibrated parameters:
::
::
>> search X withparamvalues
>> search X withparamvalues
Y = 1.254634*X/(1-X)+e;
Y = 1.254634*X/(1-X)+e;
diff(X) = -0.031459*(X(-1)-mX) + 0.1*Z - 0.2*R + u;
diff(X) = -0.031459*(X(-1)-mX) + 0.1*Z - 0.2*R + u;
|br|
.. matcomm:: dplot [OPTION VALUE[ ...]]
Plot expressions extracting data from different dseries objects.
*Options*
.. option:: --expression EXPRESSION
``EXPRESSION`` is a mathematical expression involving variables
available in the dseries objects, dseries methods, numbers or
parameters. All the referenced objects are supposed to be
available in the calling workspace.
.. option:: --dseries NAME
``NAME`` is the name of a dseries object from which the
variables involved in ``EXPRESSION`` will be extracted.
.. option:: --range DATE1:DATE2
This option is not mandatory and allows to plot the expressions
only over a sub-range. ``DATE1`` and ``DATE2`` must be dates as
defined in :ref:`dates in a mod file`.
.. option:: --style MATLAB_SCRIPT_NAME
Name of a Matlab script (without extension) containing Matlab
commands to customize the produced figure.
.. option:: --title MATLAB_STRING
Adds a title to the figure.
.. option:: --with-legend
Prints a legend below the produced plot.
*Remarks*
- More than one --expression argument is allowed, and they must come first.
- For each dseries object we plot all the expressions. We use two
nested loops, the outer loop is over the dseries objects and the
inner loop over the expressions. This determines the ordering of
the plotted lines.
- All dseries objects must be defined in the calling workspace, if a
dseries object is missing the routine throws a warning (we only
build the plots for the available dseries objects), if all dseries
objects are missing the routine throws an error.
- If the range is not provided, the expressions cannot involve leads or lags.
*Example*
::
>> toto = dseries(randn(100,3), dates('2000Q1'), {'x','y','z'});
>> noddy = dseries(randn(100,3), dates('2000Q1'), {'x','y','z'});
>> b = 3;
>> dplot --expression 2/b*cumsum(x/y(-1)-1) --dseries toto --dseries noddy --range 2001Q1:2024Q1 --title 'This is my plot'
will produce plots for ``2/b*cumsum(x/y(-1)-1)``, where ``x`` and
``y`` are variables in dseries objects ``toto`` and ``noddy``, in
the same figure.
......@@ -79,3 +79,10 @@ description, please refer to the comments inside the files themselves.
File demonstrating how to conduct optimal policy experiments in a
simple New Keynesian model under commitment (Ramsey) with a user-defined
conditional steady state file
``rbc_irf_matching.mod``
Baseline RBC model with government spending shocks estimated via impulse response function (IRF) matching.
Both Frequentist (Maximum Likelihood) and Bayesian (Slice Sampling) approaches are presented.
Additionally, it is shown how to estimate an AR(2)-process
by working with the roots of the autoregressive process instead of the coefficients
......@@ -11,7 +11,7 @@ Currently the development team of Dynare is composed of:
* Willi Mutschler (University of Tübingen)
* Johannes Pfeifer (University of the Bundeswehr Munich)
* Marco Ratto (European Commission, Joint Research Centre - JRC)
* Normann Rion (CY Cergy Paris Université and CEPREMAP)
* Normann Rion (CEPREMAP)
* Sébastien Villemot (CEPREMAP)
The following people used to be members of the team:
......@@ -26,7 +26,7 @@ The following people used to be members of the team:
* Ferhat Mihoubi
* George Perendia
Copyright © 1996-2023, Dynare Team.
Copyright © 1996-2025, Dynare Team.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
......
......@@ -8,14 +8,14 @@ Software requirements
=====================
Packaged versions of Dynare are available for Windows (10 and 11), several
GNU/Linux distributions (Debian, Ubuntu, Linux Mint, Arch Linux), macOS (13
Ventura), and FreeBSD. Dynare should work on other systems, but some
GNU/Linux distributions (Debian, Ubuntu, Linux Mint, Arch Linux), macOS (15
“Sequoia”), and FreeBSD. Dynare should work on other systems, but some
compilation steps are necessary in that case.
In order to run Dynare, you need one of the following:
* MATLAB, any version ranging from 9.5 (R2018b) to 23.2 (R2023b);
* GNU Octave, any version ranging from 7.1.0 to 8.4.0, with the ``statistics`` package
* MATLAB, any version ranging from 9.5 (R2018b) to 24.2 (R2024b);
* GNU Octave, any version ranging from 7.1.0 to 9.4.0, with the ``statistics`` package
from `Octave-Forge`_. Note however that the Dynare installer for Windows
requires a more specific version of Octave, as indicated on the download
page.
......@@ -23,8 +23,16 @@ In order to run Dynare, you need one of the following:
The following optional extensions are also useful to benefit from
extra features, but are in no way required:
* If under MATLAB: the Optimization Toolbox, the Statistics Toolbox,
the Control System Toolbox;
* If under MATLAB: the
* Optimization Toolbox (providing various optimizers
like ``fminsearch``, ``fmincon``, or ``fminunc``, used in e.g. ``mode_compute``,
``opt_algo`` or ``ALGO``),
* Statistics Toolbox (for faster and sometimes more robust implementations of
statistical distributions),
* Global Optimization Toolbox (for ``particleswarm`` and ``simulannealbnd``, used in
e.g. ``mode_compute``, ``opt_algo`` or ``ALGO``)
* Control System Toolbox (for the Lyapunov solver ``dlyapchol`` triggered with ``lyapunov=square_root_solver``)
* If under Octave, the following `Octave-Forge`_ packages: ``optim``, ``io``,
``control``.
......@@ -91,6 +99,18 @@ Debian, Ubuntu and Linux Mint).
On macOS
--------
.. warning::
Installing into ``/Applications/dynare`` might fail if you have older versions of Dynare already installed in ``/Applications/Dynare``.
To fix this, modify the ownership by executing the following command in Terminal.app::
sudo chown -R "$USER":staff /Applications/Dynare
Alternatively, you can modify the installation path in the automated installed using *Customize* and *Location*.
After installation, the folder will contain several sub-directories, among which are ``matlab``, ``mex``, and ``doc``.
Several versions of Dynare can coexist (by default in ``/Applications/Dynare``),
as long as you correctly adjust your path settings (see :ref:`words-warning`).
With MATLAB
^^^^^^^^^^^
......@@ -100,15 +120,6 @@ and follow the instructions.
This installation does not require administrative privileges.
If for some reason admin rights are requested, use *Change Install Location* and select *Install for me only*.
The default installation directory is ``/Applications/Dynare/x.y-arch``.
Installing into ``/Applications/dynare`` might fail if you have older versions of Dynare already installed in ``/Applications/Dynare``.
To fix this, modify the ownership by executing the following command in Terminal.app::
sudo chown -R "$USER":staff /Applications/Dynare
Alternatively, you can modify the installation path in the automated installed using *Customize* and *Location*.
After installation, the folder will contain several sub-directories, among which are ``matlab``, ``mex``, and ``doc``.
Several versions of Dynare can coexist (by default in ``/Applications/Dynare``),
as long as you correctly adjust your path settings (see :ref:`words-warning`).
It is recommended to install the Xcode Command Line Tools (this is an Apple product)
and GCC via Homebrew_ (see :ref:`prerequisites-macos`).
......@@ -133,6 +144,8 @@ once)::
octave:1> pkg install -forge io statistics control struct optim
If you want to use the `x13` functionality of `dseries`, you also need to build the `x13as` binary. [#fx13]_
On FreeBSD
----------
......@@ -325,3 +338,8 @@ Dynare unusable.
.. _Dynare wiki: https://git.dynare.org/Dynare/dynare/wikis
.. _Octave-Forge: https://octave.sourceforge.io/
.. _Homebrew: https://brew.sh
.. rubric:: Footnotes
.. [#fx13] See the instructions at `<https://forum.dynare.org/t/missing-installation-package/27350/4>`__.
\ No newline at end of file
......@@ -94,26 +94,24 @@ Citing Dynare in your research
You should cite Dynare if you use it in your research. The
recommended way todo this is to cite the present manual, as:
Stéphane Adjemian, Houtan Bastani, Michel Juillard, Frédéric Karamé,
Ferhat Mihoubi, Willi Mutschler, Johannes Pfeifer, Marco Ratto,
Normann Rion and Sébastien Villemot (2022), “Dynare: Reference Manual,
Version 5,” *Dynare Working Papers*, 72, CEPREMAP
Stéphane Adjemian, Michel Juillard, Frédéric Karamé, Willi Mutschler,
Johannes Pfeifer, Marco Ratto, Normann Rion and Sébastien Villemot (2024),
“Dynare: Reference Manual, Version 6,” *Dynare Working Papers*, 80, CEPREMAP
For convenience, you can copy and paste the following into your BibTeX file:
.. code-block:: bibtex
@TechReport{Adjemianetal2022,
author = {Adjemian, St\'ephane and Bastani, Houtan and
Juillard, Michel and Karam\'e, Fr\'ederic and
Mihoubi, Ferhat and Mutschler, Willi
and Pfeifer, Johannes and Ratto, Marco and
@TechReport{Adjemianetal2024,
author = {Adjemian, St\'ephane and Juillard, Michel and
Karam\'e, Fr\'ederic and Mutschler, Willi and
Pfeifer, Johannes and Ratto, Marco and
Rion, Normann and Villemot, S\'ebastien},
title = {Dynare: Reference Manual Version 5},
year = {2022},
title = {Dynare: Reference Manual, Version 6},
year = {2024},
institution = {CEPREMAP},
type = {Dynare Working Papers},
number = {72},
number = {80},
}
If you want to give a URL, use the address of the Dynare website:
......
......@@ -125,23 +125,20 @@ by the ``dynare`` command.
.. option:: noclearall
By default, ``dynare`` will issue a ``clear all`` command to
MATLAB (<R2015b) or Octave, thereby deleting all workspace
variables and functions; this option instructs ``dynare`` not
to clear the workspace. Note that starting with MATLAB 2015b
``dynare`` only deletes the global variables and the functions
using persistent variables, in order to benefit from the JIT
(Just In Time) compilation. In this case the option instructs
``dynare`` not to clear the globals and functions.
By default, ``dynare`` deletes all the global variables and the
functions using persistent variables, in order to benefit from the JIT
(just-in-time) compilation. This option instructs ``dynare`` not to
clear those.
.. option:: onlyclearglobals
By default, ``dynare`` will issue a ``clear all`` command to
MATLAB versions before 2015b and to Octave, thereby deleting
all workspace variables; this option instructs ``dynare`` to
clear only the global variables (i.e. ``M_, options_, oo_,
estim_params_, bayestopt_``, and ``dataset_``), leaving the
other variables in the workspace.
By default, ``dynare`` deletes all the global variables and the
functions using persistent variables, in order to benefit from the JIT
(just-in-time) compilation. This option instructs ``dynare`` to clear
only its own global variables (*i.e.* ``M_, options_, oo_,
estim_params_, bayestopt_``, ``dataset_``, ``dataset_info`` and
``estimation_info``), leaving the other variables in the workspace, and
not clearing functions using persistent variables.
.. option:: debug
......
......@@ -54,7 +54,7 @@ are introduced by ``/*`` and terminated by ``*/``.
*/
 
Note that these comment marks should not be used in native MATLAB code regions
where the `%` should be preferred instead to introduce a comment. In a
where the ``%`` should be preferred instead to introduce a comment. In a
``verbatim`` block, see :ref:`verbatim`, this would result in a crash since
``//`` is not a valid MATLAB statement).
 
......@@ -86,10 +86,10 @@ observed:
(see :ref:`macro-exp`);
* VARIABLE_NAME (sometimes VAR_NAME) indicates a variable name
starting with an alphabetical character and can’t contain:
()+-\*/^=!;:@#. or accentuated characters;
``()+-\*/^=!;:@#.`` or accentuated characters;
* PARAMETER_NAME (sometimes PARAM_NAME) indicates a parameter name
starting with an alphabetical character and can’t contain:
()+-\*/^=!;:@#. or accentuated characters;
``()+-\*/^=!;:@#.`` or accentuated characters;
* LATEX_NAME (sometimes TEX_NAME) indicates a valid
LaTeX expression in math mode (not including the
dollar signs);
......@@ -98,7 +98,13 @@ observed:
system; it is necessary to put it between quotes when specifying the
extension or if the filename contains a non-alphanumeric character;
* QUOTED_STRING indicates an arbitrary string enclosed between (single)
quotes.
quotes;
* DATE indicates a time period which can be either a year (e.g. ``2024Y`` or
``2024A``), a half-year (``2024S1`` or ``2024H1``), a quarter (``2024Q2``) or a month
(``2024M3``) (see :ref:`dates in a mod file`). Optionally, the time period can
be followed by a plus sign and a number of periods, in which case the date is
shifted accordingly (e.g. ``2023Q1+6`` is accepted and is equivalent to
``2024Q3``).
 
 
.. _var-decl:
......@@ -1259,7 +1265,8 @@ command, the list of transformed model equations using the
``write_latex_dynamic_model command``, and the list of static model
equations using the ``write_latex_static_model`` command.
 
.. command:: write_latex_original_model (OPTIONS);
.. command:: write_latex_original_model ;
write_latex_original_model (OPTIONS);
 
|br| This command creates two LaTeX files: one
containing the model as defined in the model block and one
......@@ -1334,7 +1341,8 @@ equations using the ``write_latex_static_model`` command.
See :opt:`write_equation_tags`
 
 
.. command:: write_latex_static_model (OPTIONS);
.. command:: write_latex_static_model ;
write_latex_static_model (OPTIONS);
 
|br| This command creates two LaTeX files: one
containing the static model and one containing the LaTeX
......@@ -1369,7 +1377,7 @@ equations using the ``write_latex_static_model`` command.
 
See :opt:`write_equation_tags`.
 
.. command:: write_latex_steady_state_model
.. command:: write_latex_steady_state_model ;
 
|br| This command creates two LaTeX files: one containing the steady
state model and one containing the LaTeX document header
......@@ -2046,7 +2054,7 @@ in this case ``initval`` is used to specify the terminal conditions.
 
.. option:: last_obs = {INTEGER | DATE}
 
The observaton number or the date (see
The observation number or the date (see
:ref:`dates-members`) of the last observation to be used in
the file.
 
......@@ -2945,8 +2953,8 @@ Finding the steady state with Dynare nonlinear solver
 
``5``
 
Newton algorithm with a sparse Gaussian elimination
(SPE) (requires ``bytecode`` option, see
Newton algorithm with a sparse Gaussian elimination (SPE)
solver at each iteration (requires ``bytecode`` option, see
:ref:`model-decl`).
 
``6``
......@@ -2964,7 +2972,7 @@ Finding the steady state with Dynare nonlinear solver
``8``
 
Newton algorithm with a Stabilized Bi-Conjugate
Gradient (BICGSTAB) solver at each iteration (requires
Gradient (BiCGStab) solver at each iteration (requires
bytecode and/or block option, see :ref:`model-decl`).
 
``9``
......@@ -3001,19 +3009,23 @@ Finding the steady state with Dynare nonlinear solver
blocks that can be evaluated rather than solved; and evaluations
of the residual and Jacobian of the model are more efficient
because only the relevant elements are recomputed at every
iteration.
iteration. This option is typically used with the
``perfect_foresight_solver`` command with purely backward,
forward or static models, or with routines for semi-structural
models, and it must *not* be combined with option ``block`` of
the ``model`` block. Also note that for those models, the block
decomposition is performed as if ``mfs=3`` had been passed to
the ``model`` block, and the decomposition is slightly
different because it is computed in a time-recursive fashion
(*i.e.* in such a way that the simulation is meant to be done
with the outer loop on periods and the inner loop on blocks;
while for models with both leads and lags, the outer loop is on
blocks and the inner loop is on periods).
 
``14``
 
Computes a block decomposition and then applies a trust region
solver with autoscaling on those smaller blocks rather than on
the full nonlinear system. This is similar to ``4``, but is
typically more efficient. The block decomposition is done at
the preprocessor level, which brings two benefits: it
identifies blocks that can be evaluated rather than solved; and
evaluations of the residual and Jacobian of the model are more
efficient because only the relevant elements are recomputed at
every iteration.
Same as ``12``, except that it applies a trust region solver
(similar to ``4``) to the blocks.
 
|br| Default value is ``4``.
 
......@@ -3619,6 +3631,20 @@ speed-up on large models.
Used to specify path for all endogenous and exogenous variables.
Strictly equivalent to :comm:`initval_file`.
 
.. option:: endval_steady
In scenarios with a permanent shock, specifies that the terminal
condition is a steady state, even if the ``steady`` command has not been
called after the ``endval`` block. As a consequence, the subsequent
``perfect_foresight_solver`` command will compute the terminal steady
state itself (given the value of the exogenous variables given in the
``endval`` block). In practice, this option is useful when the permanent
shock is very large, in which case the homotopy procedure inside
``perfect_foresight_solver`` will find both the terminal steady state
and the transitional dynamics within the same loop (which is less costly
than first computing the terminal steady state by homotopy, then
computing the transitional dynamics by homotopy).
*Output*
 
The paths for the exogenous variables are stored into
......@@ -3680,60 +3706,64 @@ speed-up on large models.
``0``
 
Use a Newton algorithm with a direct sparse LU solver at each
iteration, applied on the stacked system of all the equations at
every period (Default).
iteration, applied to the stacked system of all equations in all
periods (Default).
 
``1``
 
Use the Laffargue-Boucekkine-Juillard (LBJ) algorithm proposed
in *Juillard (1996)*. It is slower than ``stack_solve_algo=0``,
but may be less memory consuming on big models. Note that if the
``block`` option is used (see :ref:`model-decl`), a simple
Newton algorithm with sparse matrices is used for blocks which
are purely backward or forward (of type ``SOLVE BACKWARD`` or
``SOLVE FORWARD``, see :comm:`model_info`), since LBJ only makes
sense on blocks with both leads and lags (of type ``SOLVE TWO
BOUNDARIES``).
in *Juillard (1996)* on top of a LU solver. It is slower
than ``stack_solve_algo=0``, but may be less memory consuming on
big models. Note that if the ``block`` option is used (see
:ref:`model-decl`), a simple Newton algorithm with sparse
matrices, applied to the stacked system of all block equations
in all periods, is used for blocks which are purely backward or
forward (of type ``SOLVE BACKWARD`` or ``SOLVE FORWARD``, see
:comm:`model_info`), since LBJ only makes sense on blocks with
both leads and lags (of type ``SOLVE TWO BOUNDARIES``).
 
``2``
 
Use a Newton algorithm with a Generalized Minimal
Residual (GMRES) solver at each iteration (requires
``bytecode`` and/or ``block`` option, see
:ref:`model-decl`)
Use a Newton algorithm with a Generalized Minimal Residual
(GMRES) solver at each iteration, applied on the stacked system
of all equations in all periods (requires ``bytecode`` and/or
``block`` option, see :ref:`model-decl`)
 
``3``
 
Use a Newton algorithm with a Stabilized Bi-Conjugate
Gradient (BICGSTAB) solver at each iteration (requires
``bytecode`` and/or ``block`` option, see
:ref:`model-decl`).
Use a Newton algorithm with a Stabilized Bi-Conjugate Gradient
(BiCGStab) solver at each iteration, applied on the stacked
system of all equations in all periods (requires ``bytecode``
and/or ``block`` option, see :ref:`model-decl`).
 
``4``
 
Use a Newton algorithm with an optimal path length at
each iteration (requires ``bytecode`` and/or ``block``
option, see :ref:`model-decl`).
Use a Newton algorithm with a direct sparse LU solver and an
optimal path length at each iteration, applied on the stacked
system of all equations in all periods (requires ``bytecode``
and/or ``block`` option, see :ref:`model-decl`).
 
``5``
 
Use a Newton algorithm with a sparse Gaussian
elimination (SPE) solver at each iteration (requires
``bytecode`` option, see :ref:`model-decl`).
Use the Laffargue-Boucekkine-Juillard (LBJ) algorithm proposed
in *Juillard (1996)* on top of a sparse Gaussian elimination
(SPE) solver. The latter takes advantage of the similarity of
the Jacobian across periods when searching for the pivots
(requires ``bytecode`` option, see :ref:`model-decl`).
 
``6``
 
Synonymous for ``stack_solve_algo=1``. Kept for historical
reasons.
Synonymous for ``stack_solve_algo=1``. Kept for backward
compatibility.
 
``7``
 
Allows the user to solve the perfect foresight model
with the solvers available through option
``solve_algo`` (See :ref:`solve_algo <solvalg>` for a
list of possible values, note that values 5, 6, 7 and
8, which require ``bytecode`` and/or ``block`` options,
are not allowed). For instance, the following
Allows the user to solve the perfect foresight model with the
solvers available through option ``solve_algo``, applied on the
stacked system of all equations in all periods (See
:ref:`solve_algo <solvalg>` for a list of possible values, note
that values ``5``, ``6``, ``7`` and ``8``, which require ``bytecode`` and/or
``block`` options, are not allowed). For instance, the following
commands::
 
perfect_foresight_setup(periods=400);
......@@ -3750,7 +3780,10 @@ speed-up on large models.
.. option:: solve_algo
 
See :ref:`solve_algo <solvalg>`. Allows selecting the solver
used with ``stack_solve_algo=7``.
used with ``stack_solve_algo=7``. Also used for purely backward, forward
and static models (when neither the ``block`` nor the ``bytecode`` option
of the ``model`` block is specified); for those models, the values
``12`` and ``14`` are especially relevant.
 
.. option:: no_homotopy
 
......@@ -3791,6 +3824,11 @@ speed-up on large models.
the homotopy procedure has been able to find a solution, then the approximate
solution returned is :math:`\frac{y(s^*)-y(0)}{s^*}`.
 
If linearization is triggered, the variable
:mvar:`oo_.deterministic_simulation.homotopy_linearization` is set, and
the simulation corresponding to share :math:`s^*` is stored in
:mvar:`oo_.deterministic_simulation.sim1`.
.. option:: homotopy_marginal_linearization_fallback [= DOUBLE]
 
Whenever the homotopy procedure is not able to find a solution for 100%
......@@ -3810,6 +3848,13 @@ speed-up on large models.
of :math:`\epsilon` is ``0.01`` by default, but can be modified by
passing some other value to the option.
 
If marginal linearization is triggered, the variable
:mvar:`oo_.deterministic_simulation.homotopy_marginal_linearization` is
set. Moreover, the simulation corresponding to share :math:`s^*` is
stored in :mvar:`oo_.deterministic_simulation.sim1`, and the one
corresponding to share :math:`s^*-\epsilon` is stored in
:mvar:`oo_.deterministic_simulation.sim2`.
.. option:: homotopy_max_completion_share = DOUBLE
 
Instructs Dynare, within the homotopy procedure, to not try to compute
......@@ -3819,7 +3864,13 @@ speed-up on large models.
``homotopy_marginal_linearization_fallback`` option. It is typically
used in situations where it is known that homotopy will fail to go
beyond a certain point, so as to save computing time, while at the same
time getting an approximate solution.
time getting an approximate solution. Default: ``1``.
.. option:: homotopy_exclude_varexo = (VARIABLE_NAME...)
A list of exogenous variables which are to be excluded from the homotopy
procedure, *i.e.* which must be kept at their value corresponding to
100% of the shock during all homotopy iterations.
 
.. option:: markowitz = DOUBLE
 
......@@ -3837,9 +3888,9 @@ speed-up on large models.
.. option:: lmmcp
 
Solves the perfect foresight model with a Levenberg-Marquardt
mixed complementarity problem (LMMCP) solver (*Kanzow and Petra
(2004)*), which allows to consider inequality constraints on
the endogenous variables (such as a ZLB on the nominal interest
mixed complementarity problem (LMMCP) solver (*Kanzow and Petra,
2004*), which allows to consider inequality constraints on
the endogenous variables (such as a zero lower bound, henceforth ZLB, on the nominal interest
rate or a model with irreversible investment). This option is
equivalent to ``stack_solve_algo=7`` **and**
``solve_algo=10``. Using the LMMCP solver avoids the need for min/max
......@@ -3850,7 +3901,7 @@ speed-up on large models.
.. math::
LB = X &\Rightarrow F(X)>0\\
LB\leq X \leq UB &\Rightarrow F(X)=0\\
LB < X < UB &\Rightarrow F(X)=0\\
 
X =UB &\Rightarrow F(X)<0.
......@@ -3898,7 +3949,7 @@ speed-up on large models.
``rho*r(-1) + (1-rho)*(gpi*Infl+gy*YGap) + e`` is
below ``r=-1.94478``. In contrast, specifying the equation as
 
``rho*r(-1) + (1-rho)*(gpi*Infl+gy*YGap) + e = r;```
``rho*r(-1) + (1-rho)*(gpi*Infl+gy*YGap) + e = r;``
 
would be wrong.
 
......@@ -3931,20 +3982,6 @@ speed-up on large models.
``endval`` or a subsequent ``steady``. Only available with option
``stack_solve_algo==0`` or ``stack_solve_algo==7``.
 
.. option:: endval_steady
In scenarios with a permanent shock, specifies that the terminal
condition is a steady state, even if the ``steady`` command has not been
called after the ``endval`` block. As a consequence, the
``perfect_foresight_solver`` command will compute the terminal steady
state itself (given the value of the exogenous variables given in the
``endval`` block). In practice, this option is useful when the permanent
shock is very large, in which case the homotopy procedure inside
``perfect_foresight_solver`` will find both the terminal steady state
and the transitional dynamics within the same loop (which is less costly
than first computing the terminal steady state by homotopy, then
computing the transitional dynamics by homotopy).
.. option:: steady_solve_algo = INTEGER
 
See :ref:`solve_algo <solvalg>`. Used when computing the terminal steady
......@@ -3978,8 +4015,11 @@ speed-up on large models.
*Output*
 
The simulated endogenous variables are available in global matrix
``oo_.endo_simul``.
:mvar:`oo_.endo_simul`.
 
The variable :mvar:`oo_.deterministic_simulation.status` indicates whether
the simulation was successful or not.
 
.. command:: simul ;
simul (OPTIONS...);
......@@ -3996,29 +4036,28 @@ speed-up on large models.
.. matvar:: oo_.endo_simul
 
|br| This variable stores the result of a deterministic simulation
(computed by ``perfect_foresight_solver`` or ``simul``) or of a
stochastic simulation (computed by ``stoch_simul`` with the
periods option or by ``extended_path``). The variables are
arranged row by row, in order of declaration (as in
``M_.endo_names``). Note that this variable also contains initial
and terminal conditions, so it has more columns than the value of the
``periods`` option: the first simulation period is in
column ``1+M_.maximum_lag``, and the total number of columns is
(computed by ``perfect_foresight_solver`` or
``perfect_foresight_with_expectation_errors_solver``) or of a stochastic
simulation (computed by ``stoch_simul`` with the ``periods`` option or by
``extended_path``). The variables are arranged row by row, in order of
declaration (as in ``M_.endo_names``). Note that this variable also
contains initial and terminal conditions, so it has more columns than the
value of the ``periods`` option: the first simulation period is in column
``1+M_.maximum_lag``, and the total number of columns is
``M_.maximum_lag+periods+M_.maximum_lead``.
 
.. matvar:: oo_.exo_simul
 
|br| This variable stores the path of exogenous variables during a
simulation (computed by ``perfect_foresight_solver``, ``simul``,
``stoch_simul`` or ``extended_path``). The variables are arranged
in columns, in order of declaration (as in
``M_.exo_names``). Periods are in rows. Note that this convention
regarding columns and rows is the opposite of the convention for
``oo_.endo_simul``! Also note that this variable also contains initial
and terminal conditions, so it has more rows than the value of the
``periods`` option: the first simulation period is in row
``1+M_.maximum_lag``, and the total number of rows is
``M_.maximum_lag+periods+M_.maximum_lead``.
simulation (computed by ``perfect_foresight_solver``,
``perfect_foresight_with_expectation_errors_solver``, ``stoch_simul`` or
``extended_path``). The variables are arranged in columns, in order of
declaration (as in ``M_.exo_names``). Periods are in rows. Note that this
convention regarding columns and rows is the opposite of the convention for
``oo_.endo_simul``! Also note that this variable also contains initial and
terminal conditions, so it has more rows than the value of the ``periods``
option: the first simulation period is in row ``1+M_.maximum_lag``, and the
total number of rows is ``M_.maximum_lag+periods+M_.maximum_lead``.
 
.. matvar:: oo_.initial_steady_state
 
......@@ -4051,6 +4090,42 @@ speed-up on large models.
variables, so in practice it is either 1 or 0 (the latter value corresponds
to a purely backward or static model).
 
.. matvar:: oo_.deterministic_simulation.status
|br| Set to ``true`` by the :comm:`perfect_foresight_solver` command if the
simulation succeeded, otherwise set to ``false``.
.. matvar:: oo_.deterministic_simulation.homotopy_linearization
|br| Set to ``true`` by the :comm:`perfect_foresight_solver` command if
linearization has been used to compute an approximate solution.
.. matvar:: oo_.deterministic_simulation.homotopy_marginal_linearization
|br| Set to ``true`` by the :comm:`perfect_foresight_solver` command if
marginal linearization has been used to compute an approximate solution.
.. matvar:: oo_.deterministic_simulation.sim1
|br| Set by the :comm:`perfect_foresight_solver` command if either
linearization or marginal linearization has been used to compute an
approximate solution. This structure contains the simulation corresponding
to the greatest share of the shocks for which an exact solution could be
computed. The subfield ``homotopy_completion_share`` contains that share.
The subfields ``endo_simul``, ``exo_simul``, ``steady_state`` and
``exo_steady_state`` respectively contain the path of endogenous, the path
of exogenous, the steady state of endogenous and the steady state of
exogenous for that simulation (with the same conventions as the fields of
of the same name in ``oo_``).
.. matvar:: oo_.deterministic_simulation.sim2
|br| Set by the :comm:`perfect_foresight_solver` command if marginal
linearization has been used to compute an approximate solution. This
structure contains the simulation corresponding to a share marginally
smaller that the one in :mvar:`oo_.deterministic_simulation.sim1`. The
subfields are the same as in :mvar:`oo_.deterministic_simulation.sim1`.
Perfect foresight with expectation errors
-----------------------------------------
 
......@@ -4396,8 +4471,8 @@ and ``endval`` blocks which are given a special ``learnt_in`` option.
By default, every time the information set changes, the simulation with
the new information set is shorter than the previous one (because the
terminal date is getting closer). When this option is set, every new
simulation has the same length (as specified by the `periods`` option
of :comm:`perfect_foresight_with_expectation_errors_setup`; as a
simulation has the same length (as specified by the ``periods`` option
of :comm:`perfect_foresight_with_expectation_errors_setup`); as a
consequence, the simulated paths as stored in ``oo_.endo_simul`` will
be longer when this option is set (if `s` is the last period in which
the information set is modified, then they will contain `s+periods-1`
......@@ -5571,11 +5646,22 @@ All of these elements are discussed in the following.
or the piecewise Kalman filter (default). An issue that can arise in the context of
estimation is a structural shock dropping out of the model in a particular regime.
For example, at the zero lower bound on interest rates, the monetary policy shock
in the Taylor rule will not appear anymore. This may create a problem
of stochastic singularity if there are then more observables than shocks. To
avoid this issue, the data points for the zero interest rate should be set
to NaN and the standard deviation of the associated shock set to 0 for the
corresponding periods using the ``heteroskedastic_shocks`` block.
in the Taylor rule will not appear anymore. This may create a problem if there are
then more observables than shocks. The way to handle this issue depends on the type of filter used.
The first step is to set the data points for the zero interest rate period to NaN. For the piecewise
Kalman filter, the standard deviation of the associated shock needs to be set to 0 for the
corresponding periods using the ``heteroskedastic_shocks`` block. This avoids stochastic singularity.
However, this approach does not work for the inversion filter as the ``heteroskedastic_shocks`` block
does not do anything here. For the inversion filter, as many shocks as observables are required
at each point in time. Dynare assumes a one-to-one mapping between the declared shocks in
``varexo`` and declared observables in ``varobs``. For example, if the second declared observable
is NaN in a given period, Dynare will drop the second declared shock.
.. warning:: If there are missing values, it is imperative for the inversion filter that the
declaration order of shocks and observables is conformable. Sticking with our example, if the nominal
interest is the second ``varobs`` and is set to NaN, the inversion filter will drop the second
declared shock. If that second declared shock is, e.g., a TFP shock, it will be dropped instead
of the intended monetary policy shock.
 
Note that models with unit roots will require the user to specify the ``diffuse_filter`` option as
otherwise Blanchard-Kahn errors will be triggered. For the piecewise Kalman filter, the
......@@ -5768,6 +5854,14 @@ All of these elements are discussed in the following.
 
See :opt:`simul_check_ahead_periods <simul_check_ahead_periods = INTEGER>`.
 
.. option:: simul_reset_check_ahead_periods
See :opt:`simul_reset_check_ahead_periods`.
.. option:: simul_max_check_ahead_periods
See :opt:`simul_max_check_ahead_periods <simul_max_check_ahead_periods = INTEGER>`.
.. option:: simul_curb_retrench
 
See :opt:`simul_curb_retrench`.
......@@ -6491,8 +6585,8 @@ observed variables.
 
Do not use the kalman filter to evaluate the likelihood, but instead
evaluate the conditional likelihood, based on the first order reduced
form of the model, by assuming that the initial state vector is 0 for all
the endogenous variables. This approach requires that:
form of the model, by assuming that the initial state vector is at its
steady state. This approach requires that:
 
1. The number of structural innovations be equal to the number of observed variables.
 
......@@ -6507,7 +6601,7 @@ observed variables.
Note however that the conditional likelihood is sensitive to the choice
for the initial condition, which can be an issue if the data are
initially far from the steady state. This option is not compatible with
``analytical_derivation``.
``analytic_derivation``.
 
.. option:: conf_sig = DOUBLE
 
......@@ -6897,9 +6991,9 @@ observed variables.
 
.. option:: prior_trunc = DOUBLE
 
Probability of extreme values of the prior density that is
Probability of extreme values of the prior density in each tail that is
ignored when computing bounds for the parameters. Default:
``1e-32``.
``1e-10``.
 
.. option:: huge_number = DOUBLE
 
......@@ -7367,7 +7461,7 @@ observed variables.
Triggers the computation of the posterior distribution of
IRFs. The length of the IRFs are controlled by the ``irf``
option. Results are stored in ``oo_.PosteriorIRF.dsge`` (see
below for a description of this variable).
below for a description of this variable). Not compatible with OccBin.
 
.. option:: relative_irf
 
......@@ -7469,13 +7563,9 @@ observed variables.
 
Instructs Dynare to use the *Herbst and Schorfheide (2014)*
version of the Sequential Monte-Carlo sampler instead of the
standard Random-Walk Metropolis-Hastings.
``'dsmh'``
standard Random-Walk Metropolis-Hastings. Does not yet support
``moments_varendo``, ``bayesian_irf``, and ``smoother``.
 
Instructs Dynare to use the Dynamic Striated Metropolis Hastings
sampler proposed by *Waggoner, Wu and Zha (2016)* instead of the
standard Random-Walk Metropolis-Hastings.
 
.. option:: posterior_sampler_options = (NAME, VALUE, ...)
 
......@@ -7663,7 +7753,7 @@ observed variables.
stored in ``oo_.PosteriorTheoreticalMoments`` (see
:mvar:`oo_.PosteriorTheoreticalMoments`). The number of lags in
the autocorrelation function is controlled by the ``ar``
option.
option. Not compatible with OccBin.
 
.. option:: contemporaneous_correlation
 
......@@ -7748,7 +7838,7 @@ observed variables.
the posterior mode. If a Metropolis-Hastings is computed, the
distribution of forecasts is stored in variables
``oo_.PointForecast`` and ``oo_.MeanForecast``. See
:ref:`fore`, for a description of these variables.
:ref:`fore`, for a description of these variables. Not compatible with OccBin.
 
.. option:: tex
 
......@@ -7953,6 +8043,26 @@ observed variables.
 
See :opt:`aim_solver`.
 
.. option:: dr = OPTION
See :opt:`dr <dr = OPTION>`. Default: ``default``, i.e. generalized
Schur decomposition.
.. option:: dr_cycle_reduction_tol = DOUBLE
See :opt:`dr_cycle_reduction_tol <dr_cycle_reduction_tol = DOUBLE>`.
Default: ``1e-7``.
.. option:: dr_logarithmic_reduction_tol = DOUBLE
See :opt:`dr_logarithmic_reduction_tol <dr_logarithmic_reduction_tol = DOUBLE>`.
Default: ``1e-12``.
.. option:: dr_logarithmic_reduction_maxiter = INTEGER
See :opt:`dr_logarithmic_reduction_maxiter <dr_logarithmic_reduction_maxiter = INTEGER>`.
Default: ``100``.
.. option:: lyapunov = OPTION
 
Determines the algorithm used to solve the Lyapunov equation to
......@@ -9308,7 +9418,7 @@ Method of moments specific blocks
* the first column contains the names of the endogenous variables
* the second column contains the names of the exogenous variables
* the third column contains a nested cell array that contains
the list of horizons, values and weights.
the list of horizons, values and weights.
 
 
.. block:: matched_irfs_weights ;
......@@ -11303,7 +11413,7 @@ the :comm:`bvar_forecast` command.
 
.. math::
 
\varepsilon_{c,t} = R_{c,c}^{-1}\bigl( y_{c,t} - T_{c,c}y_{c,t} - T_{c,u}y_{u,t} - R_{c,u}\varepsilon_{u,t}\bigr)
\varepsilon_{c,t} = R_{c,c}^{-1}\bigl( y_{c,t} - T_{c,c}y_{c,t-1} - T_{c,u}y_{u,t-1} - R_{c,u}\varepsilon_{u,t}\bigr)
 
and :math:`y_{u,t}` can be updated by evaluating the second block of equations:
 
......@@ -11435,9 +11545,9 @@ the :comm:`bvar_forecast` command.
oo_.conditional_forecast.uncond.FORECAST_MOMENT.VARIABLE_NAME
 
 
.. matvar:: forecasts.instruments
.. matvar:: oo_.conditional_forecast.instruments
 
Variable set by the ``conditional_forecast command``. Stores
Variable set by the ``conditional_forecast`` command. Stores
the names of the exogenous instruments.
 
 
......@@ -11468,10 +11578,10 @@ the :comm:`bvar_forecast` command.
 
|br| Describes the path of constrained endogenous, before calling
``conditional_forecast``. The syntax is similar to deterministic
shocks in ``shocks``, see ``conditional_forecast`` for an example.
shocks in ``shocks``, see :comm:`conditional_forecast` for an
example and :ref:`shocks-exo` for the detailed syntax reference.
 
The syntax of the block is the same as for the deterministic
shocks in the ``shocks`` blocks (see :ref:`shocks-exo`). Note that
Note that
you need to specify the full path for all constrained endogenous
variables between the first and last specified period. If an
intermediate period is not specified, a value of 0 is
......@@ -11605,18 +11715,17 @@ is described with the function ``flip_plan``:
Once the forecast scenario if fully described, the forecast is
computed with the command ``det_cond_forecast``:
 
.. matcomm:: DSERIES = det_cond_forecast (HANDLE[, DSERIES [, DATES]]);
.. matcomm:: DSERIES = det_cond_forecast (HANDLE, DSERIES, DATES);
 
Computes the forecast or the conditional forecast using an
extended path method for the given forecast scenario (first
argument). The past values of the endogenous and exogenous
variables provided with a dseries class (see :ref:`dseries class
members <dseries-members>`) can be indicated in the second
argument. By default, the past values of the variables are equal
to their steady-state values. The initial date of the forecast can
be provided in the third argument. By default, the forecast will
start at the first date indicated in the ``init_plan``
command. This function returns a dataset containing the historical
argument). The first argument is a handle to the forecast scenario
as created by `init_plan` and associated commands.
The second argument contains the past values of the endogenous and the path
of exogenous variables, in a dseries object (see :ref:`dseries class
members <dseries-members>`). The third argument is the date range of the
forecast, typically the range used when creating the scenario handle.
This function returns a dataset containing the historical
and forecast values for the endogenous and exogenous variables.
 
 
......@@ -11632,11 +11741,12 @@ computed with the command ``det_cond_forecast``:
...
smoothed = dseries('smoothed_variables.csv');
 
fplan = init_plan(2013Q4:2029Q4);
fplan = flip_plan(fplan, 'y', 'u', 'surprise', 2013Q4:2014Q4, [1 1.1 1.2 1.1 ]);
fplan = flip_plan(fplan, 'r', 'e', 'perfect_foresight', 2013Q4:2014Q4, [2 1.9 1.9 1.9 ]);
frng = 2013Q4:2029Q4;
fplan = init_plan(frng);
fplan = flip_plan(fplan, 'y', 'u', 'surprise', frng(1:4), [1 1.1 1.2 1.1]);
fplan = flip_plan(fplan, 'r', 'e', 'perfect_foresight', frng(1:4), [2 1.9 1.9 1.9]);
 
dset_forecast = det_cond_forecast(fplan, smoothed);
dset_forecast = det_cond_forecast(fplan, smoothed, frng);
 
plot(dset_forecast.{'y','u'});
plot(dset_forecast.{'r','e'});
......@@ -11739,7 +11849,7 @@ with ``discretionary_policy`` or for optimal simple rules with ``osr``
 
With ``discretionary_policy``, the objective function must be quadratic.
 
.. command:: evaluate_planner_objective;
.. command:: evaluate_planner_objective ;
evaluate_planner_objective (OPTIONS...);
 
This command computes, displays, and stores the value of the
......@@ -12385,8 +12495,9 @@ Performing sensitivity analysis
If equal to ``0``, ANOVA mapping (Type I error) If equal to
``1``, Screening analysis (Type II error). If equal to ``2``,
Analytic derivatives (similar to Type II error, only valid
when identification=1). Default: ``1`` when
``identification=1``, ``0`` otherwise.
when identification=1). The ANOVA mapping requires the SS-ANOVA-R MATLAB
Toolbox available at https://joint-research-centre.ec.europa.eu/system/files/2025-01/ss_anova_recurs.zip
Default: ``1`` when ``identification=1``, ``0`` otherwise.
 
.. option:: morris_nliv = INTEGER
 
......@@ -14256,7 +14367,7 @@ assumed that each equation is written as ``VARIABLE = EXPRESSION`` or
``T(VARIABLE) = EXPRESSION`` where ``T(VARIABLE)`` stands for a transformation
of an endogenous variable (``log`` or ``diff``). This representation, where each
equation determines the endogenous variable on the LHS, can be exploited when
simulating the model (see algorithms 12 and 14 in :ref:`solve_algo <solvalg>`)
simulating the model (see algorithms ``12`` and ``14`` in :ref:`solve_algo <solvalg>`)
and is mandatory to define auxiliary models used for computing expectations (see
below).
 
......@@ -14293,7 +14404,7 @@ a trend target to which the endogenous variables may be attracted in the long-ru
:math:`n\times 1` vector of parameters, :math:`A_i` (:math:`i=0,\ldots,p`)
are :math:`n\times n` matrices of parameters, and :math:`A_0` is non
singular square matrix. Vector :math:`\mathbf{c}` and matrices :math:`A_i`
(:math:`i=0,\ldots,p`) are set by Dynare by parsing the equations in the
(:math:`i=0,\ldots,p`) are set by parsing the equations in the
``model`` block. Then, Dynare builds a VAR(1)-companion form model for
:math:`\mathcal{Y}_t = (1, Y_t, \ldots, Y_{t-p+1})'` as:
 
......@@ -14504,7 +14615,7 @@ up to time :math:`t-\tau`, :math:`\mathcal{Y}_{\underline{t-\tau}}`) is:
 
In a semi-structural model, variables appearing in :math:`t+h` (*e.g.*
the expected output gap in a dynamic IS curve or expected inflation in a
(New Keynesian) Phillips curve) will be replaced by the expectation implied by an auxiliary VAR
New Keynesian Phillips curve) will be replaced by the expectation implied by an auxiliary VAR
model. Another use case is for the computation of permanent
incomes. Typically, consumption will depend on something like:
 
......@@ -14512,13 +14623,13 @@ incomes. Typically, consumption will depend on something like:
 
\sum_{h=0}^{\infty} \beta^h y_{t+h|t-\tau}
 
Assuming that $0<\beta<1$ and knowing the limit of geometric series, the conditional expectation of this variable can be evaluated based on the same auxiliary model:
Assuming that :math:`0<\beta<1` and knowing the limit of geometric series, the conditional expectation of this variable can be evaluated based on the same auxiliary model:
 
.. math ::
 
\mathbb E \left[\sum_{h=0}^{\infty} \beta^h y_{t+h}\Biggl| \mathcal{Y}_{\underline{t-\tau}}\right] = \alpha \mathcal{C}^\tau(I-\beta\mathcal{C})^{-1}\mathcal{Y}_{t-\tau}
 
More generally, it is possible to consider finite discounted sums.
Finite discounted sums can also be considered.
 
.. command:: var_expectation_model (OPTIONS...);
 
......@@ -14528,9 +14639,9 @@ More generally, it is possible to consider finite discounted sums.
 
.. math ::
 
\sum_{h=a}^b \mathbb \beta^{h-\tau}\mathbb E[y_{t+h}|\mathcal{Y}_{\underline{t-\tau}}]
\sum_{h=a}^b \beta^{h-\tau}\mathbb E[y_{t+h}|\mathcal{Y}_{\underline{t-\tau}}]
 
where :math:`(a,b)\in\mathbb N^2` with :math:`a<b`, :math:`\beta\in(0,1]` is a discount factor,
where :math:`(a,b)\in\mathbb N^2` with :math:`a<b` and :math:`a<\infty`, :math:`\beta\in(0,1]` is a discount factor,
and :math:`\tau` is a finite positive integer.
 
*Options*
......@@ -14553,14 +14664,19 @@ More generally, it is possible to consider finite discounted sums.
 
.. option:: horizon = INTEGER | [INTEGER:INTEGER]
 
The upper limit :math:`b` of the horizon :math:`h` (in which case :math:`a=0`), or range of periods
:math:`a:b` over which the discounted sum is computed (the upper bound can be ``Inf``).
If the value of ``horizon`` is a finite integer scalar, the following expectation is computed:
.. math ::
\beta^{h-\tau}\mathbb E[y_{t+h}|\mathcal{Y}_{\underline{t-\tau}}]
otherwise the value is a range of periods :math:`a:b` over which the expected discounted sum is computed (the upper bound can be ``Inf``).
 
.. option:: time_shift = INTEGER
 
Shift of the information set (:math:`\tau`), default value is 0.
 
.. operator:: var_expectation (NAME_OF_VAR_EXPECTATION_MODEL);
 
|br| This operator is used instead of a leaded variable, e.g. ``X(1)``, in the
......@@ -14703,7 +14819,7 @@ simply add the exogenous variables to the PAC equation (without the weight
``trend_component_model``, to compute the VAR based expectations for the
expected changes in the target, *i.e.* to evaluate
:math:`\sum_{i=0}^{\infty} d_i \Delta y^{\star}_{t+i}`. The infinite sum
will then be replaced by a linear combination of the variables involved in
will then be replaced by a linear combination, defined by a vector :math:`h`, of the variables involved in
the companion representation of the auxiliary model. The weights defining
the linear combination are nonlinear functions of the
:math:`(a_i)_{i=0}^{m-1}` coefficients in the PAC equation. This option is
......@@ -14723,6 +14839,21 @@ simply add the exogenous variables to the PAC equation (without the weight
or expression is given) is consistent with the asymptotic growth rate of the
endogenous variable.
 
.. option:: kind = dd | dl
Instructs Dynare how to compute the vector :math:`h`, the weights
defining the linear combination of the companion VAR
variables. The default value ``dd`` must be used if the target
appears in first difference in the auxiliary model, see equation
(A.79) in *Brayton et alii (2000)*, while value ``dl`` must be
used if the target shows up in level in the auxiliary model,
equation (A.74) in *Brayton et alii (2000)*.
.. option:: auxname = STRING
Name the auxiliary variable, created by the preprocessor, that
will define the expectation term in the PAC equation.
 
.. operator:: pac_expectation (NAME_OF_PAC_MODEL);
 
......@@ -14733,7 +14864,89 @@ simply add the exogenous variables to the PAC equation (without the weight
the variables involved in the companion representation of the auxiliary model
or by a recursive forward equation.
 
|br|
The PAC equation target can be composite and defined as a weighted sum
of stationary and non stationary components. Such a target requires an
additional equation in the model block, with the target variable on
the left hand-side and the components in the right hand-side. Each
component must be an endogenous variable in the auxiliary model. The
characteristics of each component must be described in the
``pac_target_info`` block, see below, and the
``pac_target_nonstationary`` operator must be used in the error
correction term of the PAC equation to link the target to the provided
description. Note that composite targets make only sense if the
auxiliary model is not a trend component model (where all the
variables are non stationary).
.. block:: pac_target_info (NAME_OF_PAC_MODEL);
|br| This block enables the user to provide the properties of each
component of a target in PAC models with a composite target. The
``NAME_OF_PAC_MODEL`` argument refers to a PAC model (must match
the value of option ``model_name`` in the declaration of a PAC
model).
On the first line of the block, the name of the composite target
variable must be provided using the following syntax::
target VARIABLE_NAME ;
where ``VARIABLE_NAME`` is a declared endogenous variable, its
associated equation is not part of the auxiliary model but all the
components (the variables on the right hand-side) must be defined
in the auxiliary model. Next, the following line declares the name
of the auxilary variable that will appear in the error correction
term, this variable contains only the non stationary components of
the target::
auxname_target_nonstationary NAME ;
The block should contain the following group of lines for each
stationary component::
component STATIONARY_VARIABLE_NAME ;
kind ll ;
auxname AUX_VAR_NAME ;
where ``STATIONARY_VARIABLE_NAME`` is the name of a stationary
variable appearing in the right hand-side of the equation defining
the target ``VARIABLE_NAME``. The second line instructs Dynare that
the component appears in levels in the auxiliary model and in the
PAC expectations. The third line specifies the name of the
auxiliary variable created by Dynare for the component of the PAC
expectation related to ``STATIONARY_VARIABLE_NAME``.
The block should contain the following group of lines for each
nonstationary component::
component NONSTATIONARY_VARIABLE_NAME ;
kind dd | dl ;
auxname AUX_VAR_NAME ;
growth PARAMETER_NAME | VARIABLE_NAME | EXPRESSION | DOUBLE ;
where ``NONSTATIONARY_VARIABLE_NAME`` is the name of a
nonstationary variable appearing in the right hand-side of the
equation defining the target ``VARIABLE_NAME``. The second line
instructs Dynare on how to calculate the weights that define the linear
combination of the companion VAR variables. Use value ``dd`` if the
target appears in first difference in the auxiliary model, or
``dl`` if the target shows up in level in the auxiliary model. The
third line sets the name of the auxiliary variable created by
Dynare for the component of the PAC expectation related to
``NONSTATIONARY_VARIABLE_NAME``. The fourth line is mandatory if a
growth neutrality correction is required. The provided value for
this option must be consistent with the asymptotic growth rate of
the PAC endogenous variable.
.. operator:: pac_target_nonstationary (NAME_OF_PAC_MODEL);
|br| This operator is only required in presence of a composite
target in the PAC equation. The operator, used in the error
correction term of the PAC equation, selects the non stationary
components of the target.
 
.. matcomm:: pac.initialize(NAME_OF_PAC_MODEL);
.. matcomm:: pac.update(NAME_OF_PAC_MODEL);
......@@ -14746,33 +14959,33 @@ simply add the exogenous variables to the PAC equation (without the weight
the infinite sum in the MCE case).
 
 
*Example*
*Example (trend component auxiliary model)*
 
::
 
trend_component_model(model_name=toto, eqtags=['eq:x1', 'eq:x2', 'eq:x1bar', 'eq:x2bar'], targets=['eq:x1bar', 'eq:x2bar']);
 
pac_model(auxiliary_model_name=toto, discount=beta, growth=diff(x1(-1)), model_name=pacman);
pac_model(auxiliary_model_name=toto, discount=beta, model_name=pacman);
 
model;
 
[name='eq:y']
y = rho_1*y(-1) + rho_2*y(-2) + ey;
[name='eq:y']
y = (1-rho_1-rho_2)*diff(x2(-1)) + rho_1*y(-1) + rho_2*y(-2) + ey;
 
[name='eq:x1']
diff(x1) = a_x1_0*(x1(-1)-x1bar(-1)) + a_x1_1*diff(x1(-1)) + a_x1_2*diff(x1(-2)) + a_x1_x2_1*diff(x2(-1)) + a_x1_x2_2*diff(x2(-2)) + ex1;
[name='eq:x1']
diff(x1) = a_x1_0*(x1(-1)-x1bar(-1)) + a_x1_1*diff(x1(-1)) + a_x1_2*diff(x1(-2)) + a_x1_x2_1*diff(x2(-1)) + a_x1_x2_2*diff(x2(-2)) + ex1;
 
[name='eq:x2']
diff(x2) = a_x2_0*(x2(-1)-x2bar(-1)) + a_x2_1*diff(x1(-1)) + a_x2_2*diff(x1(-2)) + a_x2_x1_1*diff(x2(-1)) + a_x2_x1_2*diff(x2(-2)) + ex2;
[name='eq:x2']
diff(x2) = a_x2_0*(x2(-1)-x2bar(-1)) + a_x2_1*diff(x1(-1)) + a_x2_2*diff(x1(-2)) + a_x2_x1_1*diff(x2(-1)) + a_x2_x1_2*diff(x2(-2)) + ex2;
 
[name='eq:x1bar']
x1bar = x1bar(-1) + ex1bar;
[name='eq:x1bar']
x1bar = x1bar(-1) + ex1bar;
 
[name='eq:x2bar']
x2bar = x2bar(-1) + ex2bar;
[name='eq:x2bar']
x2bar = x2bar(-1) + ex2bar;
 
[name='zpac']
diff(z) = e_c_m*(x1(-1)-z(-1)) + c_z_1*diff(z(-1)) + c_z_2*diff(z(-2)) + pac_expectation(pacman) + ez;
[name='zpac']
diff(z) = e_c_m*(x1(-1)-z(-1)) + c_z_1*diff(z(-1)) + c_z_2*diff(z(-2)) + pac_expectation(pacman) + ez;
 
end;
 
......@@ -14781,6 +14994,51 @@ simply add the exogenous variables to the PAC equation (without the weight
pac.update.expectation('pacman');
 
 
*Example (VAR auxiliary model and composite target)*
::
var_model(model_name=toto, eqtags=['eq:x', 'eq:y']);
pac_model(auxiliary_model_name=toto, discount=beta, model_name=pacman);
pac_target_info(pacman);
target v;
auxname_target_nonstationary vns;
component y;
auxname pv_y_;
kind ll;
component x;
growth diff(x(-1));
auxname pv_dx_;
kind dd;
end;
model;
[name='eq:y']
y = a_y_1*y(-1) + a_y_2*diff(x(-1)) + b_y_1*y(-2) + b_y_2*diff(x(-2)) + ey ;
[name='eq:x']
diff(x) = b_x_1*y(-2) + b_x_2*diff(x(-1)) + ex ;
[name='eq:v']
v = x + d_y*y ; // Composite PAC target, no residuals here only variables defined in the auxiliary model.
[name='zpac']
diff(z) = e_c_m*(pac_target_nonstationary(pacman)-z(-1)) + c_z_1*diff(z(-1)) + c_z_2*diff(z(-2)) + pac_expectation(pacman) + ez;
end;
pac.initialize('pacman');
pac.update.expectation('pacman');
Estimation of a PAC equation
----------------------------
 
......
......@@ -22,6 +22,8 @@ Dates
=====
.. highlight:: matlab
.. _dates in a mod file:
Dates in a mod file
-------------------
......@@ -29,10 +31,15 @@ Dynare understands dates in a mod file. Users can declare annual, bi-annual,
quarterly, or monthly dates using the following syntax::
1990Y
1990A
1990S2
1990H2
1990Q4
1990M11
Note that there are two syntaxes for annual dates (`1990A` is equivalent to
`1990Y`), and for bi-annual dates (`1990H2` is equivalent to `1990S2`).
Behind the scene, Dynare’s preprocessor translates these expressions
into instantiations of the MATLAB/Octave’s class ``dates`` described
below. Basic operations can be performed on dates:
......@@ -52,7 +59,7 @@ below. Basic operations can be performed on dates:
Has two functions: difference and subtraction. If the second
argument is a date, calculates the difference between the first
date and the secmond date (e.g. ``1951Q2-1950Q1`` is equal to
date and the second date (e.g. ``1951Q2-1950Q1`` is equal to
``5``). If the second argument is an integer ``X``, subtracts
``X`` periods from the date (e.g. ``1951Q2-2`` is equal to
``1950Q4``).
......@@ -67,7 +74,7 @@ below. Basic operations can be performed on dates:
Can be used to create a range of dates. For instance, ``r =
1950Q1:1951Q1`` creates a ``dates`` object with five elements:
``1950Q1, 1950Q2, 1950Q3, 1950Q4`` and ``1951Q1``. By default the
``1950Q1``, ``1950Q2``, ``1950Q3``, ``1950Q4`` and ``1951Q1``. By default the
increment between each element is one period. This default can be
changed using, for instance, the following instruction:
``1950Q1:2:1951Q1`` which will instantiate a ``dates`` object with
......
# -*- coding: utf-8 -*-
# Copyright © 2018-2019 Dynare Team
# Copyright © 2018-2024 Dynare Team
#
# This file is part of Dynare.
#
......@@ -80,9 +80,7 @@ class DynObject(ObjectDescription):
signode += addnodes.desc_name(name, name)
if self.has_arguments:
if not arglist:
signode += addnodes.desc_parameterlist()
else:
if arglist:
signode += addnodes.desc_addname(arglist,arglist)
return fullname, prefix
......@@ -99,7 +97,7 @@ class DynObject(ObjectDescription):
self.state_machine.reporter.warning(
'duplicate object description of %s, ' % fullname +
'other instance in ' +
self.env.doc2path(objects[fullname][0]),line=self.lineno)
str(self.env.doc2path(objects[fullname][0])),line=self.lineno)
objects[fullname] = (self.env.docname, self.objtype)
indextext = self.get_index_text(fullname,name_obj)
......@@ -244,7 +242,7 @@ class DynSimpleObject(ObjectDescription):
self.state_machine.reporter.warning(
'duplicate object description of %s, ' % fullname +
'other instance in ' +
self.env.doc2path(objects[fullname][0]), line=self.lineno)
str(self.env.doc2path(objects[fullname][0])), line=self.lineno)
objects[fullname] = self.env.docname, self.objtype
indextext = self.get_index_text(fullname,name_obj)
......
......@@ -60,7 +60,7 @@ class DynareLexer(RegexLexer):
"addSeries","addParagraph","addVspace","write","compile")
operators = (
"STEADY_STATE","EXPECTATION","var_expectation","pac_expectation")
"STEADY_STATE","EXPECTATION","var_expectation","pac_expectation","pac_target_nonstationary")
macro_dirs = (
"@#includepath", "@#include", "@#define", "@#if",
......@@ -83,7 +83,8 @@ class DynareLexer(RegexLexer):
'osr_params_bounds','ramsey_constraints','irf_calibration',
'moment_calibration','identification','svar_identification',
'matched_moments','occbin_constraints','surprise','overwrite','bind','relax',
'verbatim','end','node','cluster','paths','hooks'), prefix=r'\b', suffix=r'\s*\b'),Keyword.Reserved),
'verbatim','end','node','cluster','paths','hooks','target','pac_target_info','auxname_target_nonstationary',
'component', 'growth', 'auxname', 'kind'), prefix=r'\b', suffix=r'\s*\b'),Keyword.Reserved),
# FIXME: Commands following multiline comments are not highlighted properly.
(words(commands + report_commands,
......
......@@ -32,6 +32,10 @@ function [ys,params,check] = NK_baseline_steadystate(ys,exo,M_,options_)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
% make parameter explicitly known to Matlab to avoid naming conflicts; actual value is read out
% in next eval-loop
delta=0;
% read out parameters to access them with their name
NumberOfParameters = M_.param_nbr;
for ii = 1:NumberOfParameters
......
// --+ options: json=compute, stochastic +--
var y x z v;
varexo ex ey ez ;
parameters a_y_1 a_y_2 b_y_1 b_y_2 b_x_1 b_x_2 d_y; // VAR parameters
parameters beta e_c_m c_z_1 c_z_2; // PAC equation parameters
a_y_1 = .2;
a_y_2 = .3;
b_y_1 = .1;
b_y_2 = .4;
b_x_1 = -.1;
b_x_2 = -.2;
d_y = .5;
beta = .9;
e_c_m = .1;
c_z_1 = .7;
c_z_2 = -.3;
var_model(model_name=toto, eqtags=['eq:x', 'eq:y']);
pac_model(auxiliary_model_name=toto, discount=beta, model_name=pacman);
pac_target_info(pacman);
target v;
auxname_target_nonstationary vns;
component y;
auxname pv_y_;
kind ll;
component x;
growth diff(x(-1));
auxname pv_dx_;
kind dd;
end;
model;
[name='eq:y']
y = a_y_1*y(-1) + a_y_2*diff(x(-1)) + b_y_1*y(-2) + b_y_2*diff(x(-2)) + ey ;
[name='eq:x']
diff(x) = b_x_1*y(-2) + b_x_2*diff(x(-1)) + ex ;
[name='eq:v']
v = x + d_y*y ; // Composite target, no residuals here only variables defined in the auxiliary VAR model.
[name='zpac']
diff(z) = e_c_m*(pac_target_nonstationary(pacman)-z(-1)) + c_z_1*diff(z(-1)) + c_z_2*diff(z(-2)) + pac_expectation(pacman) + ez;
end;
shocks;
var ex = .10;
var ey = .15;
var ez = .05;
end;
// Initialize the PAC model (build the Companion VAR representation for the auxiliary model).
pac.initialize('pacman');
// Update the parameters of the PAC expectation model (h0 and h1 vectors).
pac.update.expectation('pacman');
/*
**
** Simulate artificial dataset
**
*/
// Set initial conditions to zero.
initialconditions = dseries(zeros(10, M_.endo_nbr+M_.exo_nbr), 2000Q1, vertcat(M_.endo_names,M_.exo_names));
// Simulate the model for 5000 periods
TrueData = simul_backward_model(initialconditions, 5000);
/*
**
** Estimate PAC equation (using the artificial data)
**
*/
// Provide initial conditions for the estimated parameters
clear eparams
eparams.e_c_m = .9;
eparams.c_z_1 = .5;
eparams.c_z_2 = .2;
edata = TrueData; // Set the dataset used for estimation
edata.ez = dseries(NaN, 2000Q1); // Remove residuals for the PAC equation from the database.
pac.estimate.nls('zpac', eparams, edata, 2005Q1:2005Q1+4000, 'fmincon'); // Should produce a table with the estimates (close to the calibration given in lines 21-23)