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
26 results
Show changes
Commits on Source (561)
Showing
with 2428 additions and 714 deletions
......@@ -8,6 +8,12 @@
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# Effective configuration can be obtained with:
# clang-format --dump-config
# The RemoveParentheses and RemoveSemicolon option are not permanently set,
# because the clang-format manual (as of version 19) states that these
# options can lead to incorrect formatting and thus their result should be
# carefully reviewed.
Language: Cpp
Standard: c++20
ColumnLimit: 100
......@@ -19,9 +25,12 @@ BreakInheritanceList: AfterColon
Cpp11BracedListStyle: true
DeriveLineEnding: false
IndentPPDirectives: AfterHash
InsertNewlineAtEOF: true
PackConstructorInitializers: NextLine
PPIndentWidth: 1
PointerAlignment: Left
# RemoveParentheses: ReturnStatement
# RemoveSemicolon: true
SpaceAfterTemplateKeyword: false
SpaceBeforeParens: ControlStatements
SpaceBeforeCpp11BracedList: true
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,12 @@ 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
# + if on master: use 7-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 ]] && [[ $CI_COMMIT_REF_NAME == master ]]; then export VERSION=7-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'
......@@ -107,7 +107,7 @@ pkg_macOS_x86_64:
script:
# Enforce the arm64 meson for rewrite, as a workaround to https://github.com/mesonbuild/meson/issues/12282
- env PATH="/opt/homebrew/bin:$PATH" meson rewrite kwargs set project / version "$VERSION"
- ln -s ~/tarballs macOS/deps/x86_64
- ln -s ~/tarballs macOS/deps/
- make -C macOS build-x86_64
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
......@@ -127,7 +127,7 @@ pkg_macOS_arm64:
script:
# Enforce the arm64 meson for rewrite, as a workaround to https://github.com/mesonbuild/meson/issues/12282
- env PATH="/opt/homebrew/bin:$PATH" meson rewrite kwargs set project / version "$VERSION"
- ln -s ~/tarballs macOS/deps/arm64
- ln -s ~/tarballs macOS/deps/
- make -C macOS build-arm64
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
......@@ -184,6 +184,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.
......
......@@ -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,35 +244,36 @@ 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/
mkdir -p /home/$USER/dynare/x13as
cd /home/$USER/dynare/x13as
wget 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
wget https://www2.census.gov/software/x-13arima-seats/x13as/unix-linux/program-archives/x13as_asciisrc-v1-1-b61.tar.gz
tar xf x13as_asciisrc-v1-1-b61.tar.gz
sed -i "s|-static| |" makefile.gf # this removes '-static' in the makefile.gf
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
```
......@@ -453,10 +494,10 @@ cp slicot.a $DYNAREDIR/slicot/lib/libslicot64_pic.a
```sh
mkdir -p $DYNAREDIR/x13as
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
curl -O https://www2.census.gov/software/x-13arima-seats/x13as/unix-linux/program-archives/x13as_asciisrc-v1-1-b61.tar.gz
tar xf x13as_asciisrc-v1-1-b61.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.
......
......@@ -14,10 +14,11 @@ Bibliography
* Backus, David K., Patrick J. Kehoe, and Finn E. Kydland (1992): “International Real Business Cycles,” *Journal of Political Economy*, 100(4), 745–775.
* Baxter, Marianne and Robert G. King (1999): “Measuring Business Cycles: Approximate Band-pass Filters for Economic Time Series,” *Review of Economics and Statistics*, 81(4), 575–593.
* 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.
* Boehl, Gregor (2022): “DIME MCMC: A Swiss Army Knife for Bayesian Inference”, *SSRN No. 4250395*
* 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 +30,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 +50,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.
......@@ -64,7 +65,7 @@ Bibliography
* Koopman, S. J. and J. Durbin (2003): “Filtering and Smoothing of State Vector for Diffuse State Space Models,” *Journal of Time Series Analysis*, 24(1), 85–98.
* Kuntsevich, Alexei V. and Franz Kappel (1997): “SolvOpt - The solver for local nonlinear optimization problems (version 1.1, Matlab, C, FORTRAN)”, University of Graz, Graz, Austria.
* Laffargue, Jean-Pierre (1990): “Résolution d’un modèle macroéconomique avec anticipations rationnelles”, *Annales d’Économie et Statistique*, 17, 97–119.
* Liu, Jane and Mike West (2001): “Combined parameter and state estimation in simulation-based filtering”, in *Sequential Monte Carlo Methods in Practice*, Eds. Doucet, Freitas and Gordon, Springer Verlag.
* Liu, Jane and Mike West (2001): “Combined parameter and state estimation in simulation-based filtering”, in *Sequential Monte Carlo Methods in Practice*, Eds. Doucet, Freitas and Gordon, Springer Verlag, Chapter 10, 197-223.
* Murray, Lawrence M., Emlyn M. Jones and John Parslow (2013): “On Disturbance State-Space Models and the Particle Marginal Metropolis-Hastings Sampler”, *SIAM/ASA Journal on Uncertainty Quantification*, 1, 494–521.
* Mutschler, Willi (2015): “Identification of DSGE models - The effect of higher-order approximation and pruning“, *Journal of Economic Dynamics & Control*, 56, 34-54.
* Mutschler, Willi (2018): “Higher-order statistics for DSGE models”, *Econometrics and Statistics*, 6(C), 44-56.
......
# -*- 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,15 @@ 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
# Add support for the perpendicular symbol input as UTF-8
'preamble': r'''
\DeclareUnicodeCharacter{27C2}{\ensuremath{\perp}}
'''
}
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,17 @@ 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``)
* Parallel Computing Toolbox (to speed up the ``dime`` sampler)
* If under Octave, the following `Octave-Forge`_ packages: ``optim``, ``io``,
``control``.
......@@ -91,6 +100,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 +121,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 +145,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 +339,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
......@@ -160,7 +157,7 @@ by the ``dynare`` command.
Instructs ``dynare`` to save the intermediary file which is obtained
after macro processing (see :ref:`macro-proc-lang`); the saved output
will go in the file specified, or if no file is specified in
``FILENAME-macroexp.mod``. See the :ref:`note on quotes<quote-note>`
``FILENAME_macroexp.mod``. See the :ref:`note on quotes<quote-note>`
for info on passing a ``FILENAME`` argument containing spaces.
.. option:: onlymacro
......
......@@ -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:
......@@ -962,7 +968,10 @@ The model is declared inside a ``model`` block:
equal sign, and the expression for which this new variable will
stand. Later on, every time this variable appears in the model,
Dynare will substitute it by the expression assigned to the
variable. Note that the scope of this variable is restricted to
variable (if the model-local variable appears with a lead or a lag
attached to it between parenthesis, the substitution will be done by
shifting the expression accordingly).
Note that the scope of this variable is restricted to
the model block; it cannot be used outside. To assign a LaTeX name
to the model local variable, use the declaration syntax outlined
by :comm:`model_local_variable`. A model local variable declaration
......@@ -992,7 +1001,7 @@ The model is declared inside a ``model`` block:
 
model;
 
[name='Taylor rule',mcp = 'r > -1.94478']
[name='Taylor rule', endogenous='r']
r = rho*r(-1) + (1-rho)*(gpi*Infl+gy*YGap) + e;
 
end;
......@@ -1259,7 +1268,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 +1344,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 +1380,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 +2057,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.
 
......@@ -2580,7 +2591,7 @@ blocks.
group of three lines::
 
var VARIABLE_NAME;
periods INTEGER[:INTEGER] [[,] INTEGER[:INTEGER]]...;
periods INTEGER[:INTEGER] | DATE[:DATE] [[,] INTEGER[:INTEGER] | DATE[:DATE]]...;
values DOUBLE | (EXPRESSION) [[,] DOUBLE | (EXPRESSION) ]...;
 
It is possible to specify shocks which last several periods and
......@@ -2597,15 +2608,21 @@ blocks.
arbitrary expressions are also allowed, but you have to enclose
them inside parentheses.
 
The feasible range of ``periods`` is from 0 to the number of ``periods``
specified in ``perfect_foresight_setup``.
.. warning:: Note that the first endogenous simulation period is period 1.
Thus, a shock value specified for the initial period 0 may conflict with
(i.e. may overwrite or be overwritten by) values for the
initial period specified with ``initval`` or ``endval`` (depending on
the exact context). Users should always verify the correct setting
of ``oo_.exo_simul`` after ``perfect_foresight_setup``.
The feasible range of ``periods``, when specified as integers, is from 0 to
the number of ``periods`` specified in :comm:`perfect_foresight_setup` or
:comm:`perfect_foresight_with_expectation_errors_setup`. Alternatively, it
is possible to use real dates if the ``first_simulation_period`` and/or
``last_simulation_period`` option has been passed to the aforementioned
commands.
.. warning:: Note that the first endogenous simulation period is period 1
(when specified as an integer). Thus, a shock value specified for the
initial period 0 may conflict with (i.e. may overwrite or be
overwritten by) values for the initial period specified with
``initval`` or ``endval`` (depending on the exact context). Users
should always verify the correct setting of ``oo_.exo_simul`` after
``perfect_foresight_setup`` or
``perfect_foresight_with_expectation_errors_setup``.
 
*Example* (with scalar values)
 
......@@ -2640,6 +2657,21 @@ blocks.
values (xx);
end;
 
*Example* (with dates)
::
shocks;
var e;
periods 2023Q1;
values 0.5;
var u;
periods 2023Q2:2023Q4 2024Q1;
values 0 0.1;
end;
|br| *In stochastic context*
 
For stochastic simulations, the ``shocks`` block specifies the non
......@@ -2910,6 +2942,9 @@ Finding the steady state with Dynare nonlinear solver
along. Iteration will cease when the attempted step size is smaller than
``tolx``. Default: ``eps^(2/3)``
 
.. option:: non_zero
See :opt:`non_zero`.
 
.. _solvalg:
 
......@@ -2945,27 +2980,24 @@ 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``
 
Newton algorithm with a sparse LU solver at each
iteration (requires ``bytecode`` and/or ``block``
option, see :ref:`model-decl`).
iteration.
 
``7``
 
Newton algorithm with a Generalized Minimal Residual
(GMRES) solver at each iteration (requires ``bytecode``
and/or ``block`` option, see :ref:`model-decl`).
(GMRES) solver at each iteration.
 
``8``
 
Newton algorithm with a Stabilized Bi-Conjugate
Gradient (BICGSTAB) solver at each iteration (requires
bytecode and/or block option, see :ref:`model-decl`).
Gradient (BiCGStab) solver at each iteration.
 
``9``
 
......@@ -2976,14 +3008,14 @@ Finding the steady state with Dynare nonlinear solver
 
Levenberg-Marquardt mixed complementarity problem
(LMMCP) solver (*Kanzow and Petra (2004)*). The complementarity
conditions are specified with an ``mcp`` equation tag, see
conditions are specified using the perpendicular symbol, see
:opt:`lmmcp`.
 
``11``
 
PATH mixed complementarity problem solver of *Ferris
and Munson (1999)*. The complementarity conditions are
specified with an ``mcp`` equation tag, see
specified using the perpendicular symbol, see
:opt:`lmmcp`. Dynare only provides the interface for
using the solver. Due to licence restrictions, you have
to download the solver’s most current version yourself
......@@ -3001,19 +3033,25 @@ 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 :bck:`model` block or :comm:`model_options` command. Also
note that for those models, the block decomposition is
performed as if ``mfs=3`` had been passed to the :bck:`model`
block or :comm:`model_options` command, 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``.
 
......@@ -3087,6 +3125,10 @@ Finding the steady state with Dynare nonlinear solver
unit roots as, in this case, the steady state is not unique or
doesn’t exist.
 
.. option:: noprint
See :opt:`noprint`.
.. _steady_markowitz:
 
.. option:: markowitz = DOUBLE
......@@ -3520,14 +3562,15 @@ Getting information about the model
 
|br| Prints the equations and the Jacobian matrix of the dynamic
model stored in the bytecode binary format file. Can only be used
in conjunction with the ``bytecode`` option of the ``model``
block.
in conjunction with the ``bytecode`` option of the :bck:`model`
block or :comm:`model_options` command.
 
.. command:: print_bytecode_static_model ;
 
|br| Prints the equations and the Jacobian matrix of the static model
stored in the bytecode binary format file. Can only be used in
conjunction with the ``bytecode`` option of the ``model`` block.
conjunction with the ``bytecode`` option of the :bck:`model`
block or :comm:`model_options` command.
 
 
.. _det-simul:
......@@ -3612,13 +3655,45 @@ speed-up on large models.
 
.. option:: periods = INTEGER
 
Number of periods of the simulation.
Number of periods of the simulation. This option is mandatory, unless
both ``first_simulation_period`` and ``last_simulation_period`` options
are given.
.. option:: first_simulation_period = DATE
Assign a date to the first simulation period, i.e. the first period in
which endogenous variables are solved for. When this option is set, it
becomes possible to declare shocks using dates, and
:comm:`perfect_foresight_solver` returns the result of the simulation as
a time series object in :mvar:`Simulated_time_series`.
.. option:: last_simulation_period = DATE
Assign a date to the last simulation period, i.e. the last period in
which endogenous variables are solved for. When this option is set, it
becomes possible to declare shocks using dates, and
:comm:`perfect_foresight_solver` returns the result of the simulation as
a time series object in :mvar:`Simulated_time_series`.
 
.. option:: datafile = FILENAME
 
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 +3755,62 @@ 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.
 
``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.
 
``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 +3827,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 :bck:`model` block or :comm:`model_options` command is specified);
for those models, the values ``12`` and ``14`` are especially relevant.
 
.. option:: no_homotopy
 
......@@ -3791,6 +3871,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 +3895,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 +3911,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 +3935,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,24 +3948,24 @@ 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.
where :math:`X` denotes the vector of endogenous variables, :math:`F(X)` the equations
of the model, :math:`LB` denotes a lower bound, and :math:`UB` an upper bound. Such a setup
is implemented by attaching an equation tag (see :ref:`model-decl`)
with the ``mcp`` keyword to the affected equations. This tag states that
the equation to which the tag is attached has to hold unless the inequality
constraint within the tag is binding.
is implemented by specifying the complementarity condition after the
equation to which it is attached, the two being separated by the
perpendicular symbol (the latter can be input either in UTF-8, as ⟂,
corresponding to Unicode codepoint U+27C2; or alternatively as pure ASCII, as
_|_, *i.e.* a vertical bar enclosed within two underscores).
 
For instance, a ZLB on the nominal interest rate would be specified
as follows in the model block::
 
model;
...
[mcp = 'r > -1.94478']
r = rho*r(-1) + (1-rho)*(gpi*Infl+gy*YGap) + e;
r = rho*r(-1) + (1-rho)*(gpi*Infl+gy*YGap) + e ⟂ r > -1.94478;
...
end;
 
......@@ -3878,12 +3976,11 @@ speed-up on large models.
``r<=-1.94478``, in which case the ``r`` is fixed at
``-1.94478`` (thereby being equivalent to a complementary
slackness condition). By restricting the value of ``r`` coming
out of this equation, the ``mcp`` tag also avoids using
out of this equation, the complementarity condition also avoids using
``max(r,-1.94478)`` for other occurrences of ``r`` in the rest
of the model. Two things are important to keep in mind. First, because the
``mcp`` tag effectively replaces a complementary slackness
condition, it cannot be simply attached to any
equation. Rather, it must be attached to the correct affected
of the model. Two things are important to keep in mind. First, the complementary slackness
condition cannot be simply attached to any
equation; it must be attached to the correct affected
equation as otherwise the solver will solve a different problem
than originally intended. Second, the sign of the residual of the dynamic
equation must conform to the MCP setup outlined above. In case of the ZLB,
......@@ -3898,15 +3995,17 @@ 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.
 
Note that in the current implementation, the content of the
``mcp`` equation tag is not parsed by the preprocessor. The
inequalities must therefore be as simple as possible: an
endogenous variable, followed by a relational operator,
followed by a number (not a variable, parameter or expression).
Note that both the lower and the upper bounds can be specified at the
same time in a given complementarity condition. Moreover, arbitrary
functions of parameters can appear in the bounds. As an example, the
following complementarity condition is syntactically correct (assuming
that ``alpha`` is a parameter):
``… ⟂ -1.94478 < r < 1+2*alpha;``
 
.. option:: endogenous_terminal_period
 
......@@ -3919,7 +4018,7 @@ speed-up on large models.
shooting and relaxation approaches. Note that round off errors
are more important with this mixed strategy (user should check
the reported value of the maximum absolute error). Only
available with option ``stack_solve_algo==0``.
available with ``stack_solve_algo`` option equal to ``0``.
 
 
.. option:: linear_approximation
......@@ -3928,22 +4027,8 @@ speed-up on large models.
model. The model must be stationary and a steady state
needs to be provided. Linearization is conducted about the
last defined steady state, which can derive from ``initval``,
``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).
``endval`` or a subsequent ``steady``. Only available with
``stack_solve_algo`` option equal to ``0`` or ``7``.
 
.. option:: steady_solve_algo = INTEGER
 
......@@ -3978,8 +4063,15 @@ speed-up on large models.
*Output*
 
The simulated endogenous variables are available in global matrix
``oo_.endo_simul``.
:mvar:`oo_.endo_simul`.
 
If any of the ``first_simulation_period`` or ``last_simulation_period``
option was passed to the preceding :comm:`perfect_foresight_setup` command,
a time series object containing both endogenous and exogenous variables is
stored in the workspace variable :mvar:`Simulated_time_series`.
The variable :mvar:`oo_.deterministic_simulation.status` indicates whether
the simulation was successful or not.
 
.. command:: simul ;
simul (OPTIONS...);
......@@ -3996,29 +4088,36 @@ 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:: Simulated_time_series
|br| This variable stores, as a :class:`dseries` object, the path of both
endogenous and exogenous variables after a deterministic simulation
(computed by ``perfect_foresight_solver`` or
``perfect_foresight_with_expectation_errors_solver`` using the
``first_simulation_period`` and/or ``last_simulation_period`` option).
 
.. matvar:: oo_.initial_steady_state
 
......@@ -4051,6 +4150,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
-----------------------------------------
 
......@@ -4072,16 +4207,16 @@ Such a scenario can be solved by Dynare using the
``perfect_foresight_with_expectation_errors_solver`` commands, alongside ``shocks``
and ``endval`` blocks which are given a special ``learnt_in`` option.
 
.. block:: shocks(learnt_in=INTEGER) ;
shocks(learnt_in=INTEGER,overwrite) ;
.. block:: shocks(learnt_in=INTEGER|DATE) ;
shocks(learnt_in=INTEGER|DATE, overwrite) ;
 
|br| The ``shocks(learnt_in=INTEGER)`` syntax can be used to specify temporary
|br| The ``shocks(learnt_in=INTEGER|DATE)`` syntax can be used to specify temporary
shocks that are learnt in a specific period. It should contain one or more
occurences of the following group of three lines, with the same semantics
as a regular :bck:`shocks` block::
 
var VARIABLE_NAME;
periods INTEGER[:INTEGER] [[,] INTEGER[:INTEGER]]...;
periods INTEGER[:INTEGER] | DATE[:DATE] [[,] INTEGER[:INTEGER] | DATE[:DATE]]...;
values DOUBLE | (EXPRESSION) [[,] DOUBLE | (EXPRESSION) ]...;
 
If the period in which information is learnt is greater or equal than 2,
......@@ -4095,8 +4230,11 @@ and ``endval`` blocks which are given a special ``learnt_in`` option.
 
The ``overwrite`` option says that this block cancels and replaces previous
``shocks`` and ``mshocks`` blocks that have the same ``learnt_in`` option.
Note that a block with an integer-valued ``learnt_in`` option never
overwrites a block with a date-valued ``learnt_in`` option, even if they
correspond to the same period.
 
Note that a ``shocks(learnt_in=1)`` block is equivalent to a regular
Also note that a ``shocks(learnt_in=1)`` block is equivalent to a regular
:bck:`shocks` block.
 
*Example*
......@@ -4131,9 +4269,20 @@ and ``endval`` blocks which are given a special ``learnt_in`` option.
- from the perspective of periods 4 (and following), ``x`` is expected to
be equal to 1.3 in period 4, and to 2.8 in period 5.
 
.. block:: endval(learnt_in=INTEGER) ;
*Example* (with dates)
::
shocks(learnt_in=2023Q1);
var x;
periods 2023Q1:2023Q2 2023Q3:2023Q4 2024Q1;
values 1 1.2 1.4;
end;
 
|br| The ``endval(learnt_in=INTEGER)`` can be used to specify terminal
.. block:: endval(learnt_in=INTEGER|DATE) ;
|br| The ``endval(learnt_in=INTEGER|DATE)`` can be used to specify terminal
conditions that are learnt in a specific period.
 
Note that an ``endval(learnt_in=1)`` block is equivalent to a regular
......@@ -4187,16 +4336,25 @@ and ``endval`` blocks which are given a special ``learnt_in`` option.
the desired behaviour, a ``shocks(learnt_in=3)`` block will have to be
added to reinstate the temporary shock.
 
.. block:: mshocks(learnt_in=INTEGER) ;
mshocks(learnt_in=INTEGER,OPTIONS...) ;
*Example* (with a date)
::
endval(learnt_in = 2024Q1);
x = 1.1;
end;
.. block:: mshocks(learnt_in=INTEGER|DATE) ;
mshocks(learnt_in=INTEGER|DATE,OPTIONS...) ;
 
|br| The ``mshocks(learnt_in=INTEGER)`` syntax can be used to specify temporary
|br| The ``mshocks(learnt_in=INTEGER|DATE)`` syntax can be used to specify temporary
shocks that are learnt in a specific period, specified in a multiplicative
way. It should contain one or more occurences of the following group of
three lines, with the same semantics as a regular :bck:`mshocks` block::
 
var VARIABLE_NAME;
periods INTEGER[:INTEGER] [[,] INTEGER[:INTEGER]]...;
periods INTEGER[:INTEGER] | DATE[:DATE] [[,] INTEGER[:INTEGER] | DATE[:DATE]]...;
values DOUBLE | (EXPRESSION) [[,] DOUBLE | (EXPRESSION) ]...;
 
As in the regular :bck:`mshocks` block (without the ``learnt_in`` option),
......@@ -4216,7 +4374,10 @@ and ``endval`` blocks which are given a special ``learnt_in`` option.
.. option:: overwrite
 
This block cancels and replaces previous ``shocks`` and ``mshocks``
blocks that have the same ``learnt_in`` option.
blocks that have the same ``learnt_in`` option. Note that a block with
an integer-valued ``learnt_in`` option never overwrites a block with a
date-valued ``learnt_in`` option, even if they correspond to the same
period.
 
.. option:: relative_to_initval
 
......@@ -4239,6 +4400,17 @@ and ``endval`` blocks which are given a special ``learnt_in`` option.
from the perspective of period 2 is used (as specified in the relevant
``endval(learnt_in=…`` block)).
 
*Example* (with dates)
::
mshocks(learnt_in=2024Q2);
var x;
periods 2024Q3:2024Q4;
values 1.1;
end;
.. command:: perfect_foresight_with_expectation_errors_setup ;
perfect_foresight_with_expectation_errors_setup (OPTIONS...);
 
......@@ -4265,6 +4437,14 @@ and ``endval`` blocks which are given a special ``learnt_in`` option.
 
Number of periods of the simulation.
 
.. option:: first_simulation_period = DATE
Same meaning as the eponymous option of :comm:`perfect_foresight_setup`.
.. option:: last_simulation_period = DATE
Same meaning as the eponymous option of :comm:`perfect_foresight_setup`.
.. option:: datafile = FILENAME
 
Used to specify the information about future shocks and their
......@@ -4396,12 +4576,14 @@ 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`
periods, excluding initial and terminal conditions).
periods, excluding initial and terminal conditions). Note that this
option is not available if ``last_simulation_period`` option has been
passed to :comm:`perfect_foresight_with_expectation_errors_setup`.
 
*Output*
 
......@@ -4410,6 +4592,12 @@ and ``endval`` blocks which are given a special ``learnt_in`` option.
last period of the information set are available in ``oo_.steady_state``
and ``oo_.exo_steady_state``.
 
If any of the ``first_simulation_period`` or ``last_simulation_period``
option was passed to the preceding
:comm:`perfect_foresight_with_expectation_errors_setup` command, a time
series object containing both endogenous and exogenous variables is stored
in the workspace variable :mvar:`Simulated_time_series`.
.. matvar:: oo_.pfwee.shocks_info
 
|br| This variable stores the temporary shocks used during perfect
......@@ -4431,6 +4619,144 @@ and ``endval`` blocks which are given a special ``learnt_in`` option.
the terminal condition for exogenous indexed ``k``, as anticipated from
period ``s``, is stored in ``oo_.pfwee.terminal_info(k,s)``.
 
Controlling the path of endogenous variables
--------------------------------------------
In the usual perfect foresight problem, the user controls the path of exogenous
variables for the simulation periods and the initial and terminal
conditions for endogenous variables, while Dynare solves for the path of
endogenous variables for the simulation periods.
However, Dynare offers the possibility of controlling the value of some
endogenous variables for some simulation periods (in which case some exogenous
variables must be left free and are thus solved for by Dynare, to avoid
over-determination of the problem). This exercise is called “conditional
forecasting” in some contexts (even though one may argue that this is not
really forecasting, since perfect foresight by the agents is assumed; for the
stochastic case, see the :comm:`conditional_forecast` command).
The description of controlled endogenous variables is done using the
``perfect_foresight_controlled_paths`` block. The information given therein is
then processed by the :comm:`perfect_foresight_setup` (or
:comm:`perfect_foresight_with_expectation_errors_setup`) command, so
that the next :comm:`perfect_foresight_solver` (or
:comm:`perfect_foresight_with_expectation_errors_solver`) command
computes the simulation with controlled paths. In particular,
:mvar:`oo_.exo_simul` will contain the computed value of exogenous variables
that have been left free.
.. block:: perfect_foresight_controlled_paths ;
perfect_foresight_controlled_paths(OPTIONS...);
|br| This block is used to tell the perfect foresight solver that the value
of some endogenous variables will be controlled (in other words, they will
be exogenized). It also gives the period(s) for which this control applies,
the value(s) imposed to the endogenous variable(s), and the exogenous
variable(s) that are left free at the same period(s) (in other words,
those exogenous are endogenized).
The block should contain one or more occurrences of the following
group of four lines::
exogenize ENDOGENOUS_NAME;
periods INTEGER[:INTEGER] | DATE[:DATE] [[,] INTEGER[:INTEGER] | DATE[:DATE]]...;
values DOUBLE | (EXPRESSION) [[,] DOUBLE | (EXPRESSION) ]...;
endogenize EXOGENOUS_NAME;
Note that it is possible to have both
``perfect_foresight_controlled_paths`` and regular :bck:`shocks` blocks in
the same ``.mod`` file (assuming of course that taken together they do not
impose inconsistent constraints).
The ``perfect_foresight_controlled_paths`` block requires that the
:opt:`stack_solve_algo <stack_solve_algo = INTEGER>` option be equal to
either ``0``, ``1``, ``2``, ``3``, ``6`` or ``7``, and is incompatible with
the :opt:`block` and :opt:`bytecode` options of the :bck:`model` block and
:comm:`model_options` command.
*Options*
.. option:: learnt_in = INTEGER | DATE
Used in conjunction with
:comm:`perfect_foresight_with_expectation_errors_setup` and
:comm:`perfect_foresight_with_expectation_errors_solver` commands,
specifies the period or date at which this controlled paths block is
learnt by agents.
*Example (perfect foresight)*
::
var c k;
varexo x z;
...
shocks;
var x;
periods 1;
values 1.2;
end;
perfect_foresight_controlled_paths;
exogenize c;
periods 2 4:5;
values 1.6 1.7;
endogenize x;
exogenize k;
periods 7:9;
values 13;
endogenize z;
end;
perfect_foresight_setup(periods = 100);
perfect_foresight_solver;
In this example, the exogenous variable ``x`` is equal to 1.2 in
period 1, but in periods 2, 4 and 5 it will be endogenized so that
endogenous variable `c` is equal to 1.6 in period 2 and then 1.7 in
periods 4 and 5. Similarly, the exogenous variable ``z`` will be
endogenized in periods 7 to 9 so that the endogenous variable ``k`` is
equal to 13 over the same periods.
*Example (perfect foresight with expectation errors)*
::
var c;
varexo x;
...
perfect_foresight_controlled_paths;
exogenize c;
periods 2002Y 2003Y:2005Y;
values 1.6 1.7;
endogenize x;
end;
perfect_foresight_controlled_paths(learnt_in=2004Y);
exogenize c;
periods 2004Y:2005Y;
values 1.8;
endogenize x;
end;
perfect_foresight_with_expectation_errors_setup(periods = 30,
first_simulation_period = 2001Y);
perfect_foresight_with_expectation_errors_solver;
In this example, agents in year 2001 (at beginning of the simulation)
compute their plan under the assumption that the endogenous variable
``c`` will be equal to 1.6 in year 2002 and 1.7 from years 2003 to
2005, and that exogenous variable ``x`` will behave so as to fulfill
that constraint. Then, when 2004 arrives, they recompute their plan
under the assumption that ``c`` will be equal to 1.8 in years 2004 and
2005 (and again that ``x`` will be endogenized accordingly).
.. _stoch-sol:
 
Stochastic solution and simulation
......@@ -4822,6 +5148,11 @@ Computing the stochastic solution
The convergence criterion used in the cycle reduction
algorithm. Its default value is ``1e-7``.
 
.. option:: dr_cycle_reduction_maxiter = INTEGER
The maximum number of iterations used in the cycle
reduction algorithm. Its default value is ``100``.
.. option:: dr_logarithmic_reduction_tol = DOUBLE
 
The convergence criterion used in the logarithmic reduction
......@@ -5152,7 +5483,7 @@ which is described below.
agents believe that there will no more shocks after period
:math:`t+S`. This is an experimental feature and can be quite
slow. A non-zero value is not compatible with the ``bytecode``
option of the ``model`` block.
option of the :bck:`model` block or :comm:`model_options` command.
Default: ``0``.
 
.. option:: hybrid
......@@ -5168,7 +5499,14 @@ which is described below.
(2004)*), which allows to consider inequality constraints on
the endogenous variables (such as a ZLB on the nominal interest
rate or a model with irreversible investment). For specifying the
necessary ``mcp`` tag, see :opt:`lmmcp`.
necessary complementarity conditions, see :opt:`lmmcp`.
.. option:: use_first_order_solution
Utilize the model simulation based on a first-order local
approximation as the initial guess for the nonlinear solver in
each period. If this is not applied, solution in previous
period is used.
 
 
Typology and ordering of variables
......@@ -5571,11 +5909,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 +6117,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 +6848,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 +6864,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
 
......@@ -6776,13 +7133,10 @@ observed variables.
 
``11``
 
This is not strictly speaking an optimization
algorithm. The (estimated) parameters are treated as
state variables and estimated jointly with the
original state variables of the model using a
nonlinear filter. The algorithm implemented in Dynare
is described in *Liu and West (2001)*, and works with
``k`` order local approximations of the model.
Currently not in use. The Liu and West (2020) filter that
used to be available under this option value is now triggered with
``posterior_sampling_method='online'``.
 
``12``
 
......@@ -6897,9 +7251,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`` for ``posterior_sampling_method=slice`` and ``0`` otherwise .
 
.. option:: huge_number = DOUBLE
 
......@@ -7367,7 +7721,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
 
......@@ -7420,6 +7774,12 @@ observed variables.
density is recentered to the previous draw in every
step.
 
``'dime_mcmc'``
Instructs Dynare to use the Differential-Independence Mixture Ensemble ("DIME") MCMC sampler of *Boehl (2022)* instead of the standard Random-Walk Metropolis-Hastings. DIME is robust for odd shaped, multimodal, black-box distributions and shown to require significantly less likelihood evaluations than alternative samplers. Many chains run simultaneously, thereby further increasing sampling speed. The algorithm is based on a gradient-free global multi-start optimizer and does not require any posterior mode density maximization prior to MCMC sampling. DIME proposals are generated from an endogenous and adaptive proposal distribution, thereby providing close-to-optimal proposal distributions for black box target distributions without manual fine-tuning. Does not yet support ``moments_varendo``, ``bayesian_irf``, and ``smoother``.
Note that, since DIME is using parameter transformations, setting parameter bounds is often counterproductive. The ``prior_trunc`` option is disabled and set to zero.
``'tailored_random_block_metropolis_hastings'``
 
Instructs Dynare to use the Tailored randomized block
......@@ -7469,7 +7829,8 @@ 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.
standard Random-Walk Metropolis-Hastings. Does not yet support
``moments_varendo``, ``bayesian_irf``, and ``smoother``.
 
``'dsmh'``
 
......@@ -7477,6 +7838,15 @@ observed variables.
sampler proposed by *Waggoner, Wu and Zha (2016)* instead of the
standard Random-Walk Metropolis-Hastings.
 
``'online'``
Instructs Dynare to treat the (estimated) parameters as
state variables and estimate them jointly with the
original state variables of the model using a
nonlinear filter. The algorithm implemented in Dynare
is described in *Liu and West (2001)*, and works with
``k`` order local approximations of the model.
.. option:: posterior_sampler_options = (NAME, VALUE, ...)
 
A list of NAME and VALUE pairs. Can be used to set options for
......@@ -7535,6 +7905,42 @@ observed variables.
the draws when the current ``_mh*_blck`` file is
full. Default: ``0``
 
``'dime_mcmc'``
Available options are:
``'niter'``
Number of iterations. Default value is 1500.
``'nchain'``
Number of chains/particles. A range between :math:`4 ndim` and :math:`6 ndim` is recommended. For very difficult problems, double the number of chains. Default value is: :math:`5 ndim`.
``'tune'``
Number of ensemble iterations to keep after burnin. Default value is chosen to obtain at least 50,000 samples.
``'aimh_prob'``
Probability to draw a global transition kernel. By default this is set to :math:`0.1`. It is usually not necessary to change this value.
``'df_proposal_dist'``
Degrees of freedom of the multivariate t distribution used for global kernel proposals. Defaults to :math:`10`.
``'rho'``
Decay parameter for the mean and covariances of the global transistion kernel. Defaults to :math:`0.999`.
``'gamma'``
Mean stretch factor for the proposal vector. By default, it is :math:`2.38 / \sqrt{2\,\mathrm{ndim}}` as recommended by *ter Braak (2006)*
``'sigma'``
Standard deviation of the Gaussian used to stretch the proposal vector. This is normally negligible. Defaults to :math:`1e-5`.
``'independent_metropolis_hastings'``
 
Takes the same options as in the case of ``random_walk_metropolis_hastings``.
......@@ -7663,7 +8069,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 +8154,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 +8359,31 @@ 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_cycle_reduction_maxiter = INTEGER
See :opt:`dr_cycle_reduction_maxiter <dr_cycle_reduction_maxiter = INTEGER>`.
Default: ``100``.
.. 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
......@@ -8277,7 +8708,8 @@ observed variables.
 
``'liu_west_delta'``
 
Set the value for delta for the Liu/West online filter. Default: ``0.99``.
Set the value for delta for the Liu/West online filter (``posterior_sampling_method='online'``).
Default: ``0.99``.
 
``'unscented_alpha'``
 
......@@ -9308,7 +9740,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 ;
......@@ -9871,6 +10303,11 @@ Numerical algorithms options
See :opt:`dr_cycle_reduction_tol <dr_cycle_reduction_tol = DOUBLE>`.
Default: ``1e-7``.
 
.. option:: dr_cycle_reduction_maxiter = INTEGER
See :opt:`dr_cycle_reduction_maxiter <dr_cycle_reduction_maxiter = INTEGER>`.
Default: ``100``.
.. option:: dr_logarithmic_reduction_tol = DOUBLE
 
See :opt:`dr_logarithmic_reduction_tol <dr_logarithmic_reduction_tol = DOUBLE>`.
......@@ -11303,7 +11740,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 +11872,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 +11905,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 +12042,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 +12068,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 +12176,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
......@@ -12038,7 +12475,7 @@ Optimal policy under discretion
You must ensure that your objective is quadratic. Regarding the model, it must
either be linear or solved at first order with an analytical steady state provided.
In the first case, you should set the ``linear`` option of the
``model`` block.
:bck:`model` block or :comm:`model_options` command.
 
It is possible to use the :comm:`estimation` command after the
``discretionary_policy`` command, in order to estimate the model with
......@@ -12385,8 +12822,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 +14694,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 +14731,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 +14942,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 +14950,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 +14966,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 +14991,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 +15146,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 +15166,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 +15191,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 +15286,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 +15321,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
----------------------------
 
......@@ -15861,7 +16446,7 @@ Misc commands
``pdflatex`` and automatically tries to load all required
packages. Requires the following LaTeX packages:
``breqn``, ``psfrag``, ``graphicx``, ``epstopdf``, ``longtable``,
``booktabs``, ``caption``, ``float,`` ``amsmath``, ``amsfonts``,
``booktabs``, ``caption``, ``float,`` ``amsmath``, ``amsfonts``, ``amssymb``,
and ``morefloats``.
 
 
......
......@@ -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
......@@ -261,6 +268,39 @@ The dates class
do4 = dates('Q',1950, 1);
do5 = dates('D',1973, 1, 25);
|br|
A ``dates`` object with multiple elements can be considered a one-dimensional array of dates. Standard array operations can be applied to a ``dates`` object:
- square brackets can be used to concatenate dates objects::
>> A = dates('1938Q4');
>> B = dates('1945Q3');
>> C = [A, B];
- semicolons can be used to create ranges of dates::
>> A = dates('2009Q2');
>> B = A:A+2;
>> B
B = <dates: 2009Q2, 2009Q3, 2009Q4>
- objects can be indexed by an integer or a vector of integer::
>> B(1)
ans = <dates: 2009Q2>
>> B(end)
ans = <dates: 2009Q4>
>> B(1:2)
ans = <dates: 2009Q2, 2009Q3>
|br|
A list of the available methods, by alphabetical order, is given
below. Note that by default the methods do not allow in place
......@@ -299,8 +339,10 @@ The dates class
particularly useful if the methods are called in loops, since this
saves the object instantiation overhead.
|br|
.. datesmethod:: C = append (A, B)
C = append_ (A, B)
append_ (B)
|br| Appends ``dates`` object ``B``, or a string that can be
interpreted as a date, to the ``dates`` object ``A``. If ``B``
......@@ -784,8 +826,8 @@ The dates class
.. datesmethod:: C = pop (A)
C = pop (A, B)
C = pop_ (A)
C = pop_ (A, B)
pop_ ()
pop_ (B)
|br| Pop method for ``dates`` class. If only one input is
provided, the method removes the last element of a ``dates``
......@@ -808,7 +850,7 @@ The dates class
.. datesmethod:: C = remove (A, B)
C = remove_ (A, B)
remove_ (B)
|br| Remove method for ``dates`` class. Both inputs have to be ``dates`` objects, removes dates in ``B`` from ``A``.
......@@ -848,7 +890,7 @@ The dates class
.. datesmethod:: B = sort (A)
B = sort_ (A)
sort_ ()
|br| Sort method for ``dates`` objects. Returns a ``dates`` object
with elements sorted by increasing order.
......@@ -934,7 +976,7 @@ The dates class
.. datesmethod:: B = unique (A)
B = unique_ (A)
unique_ ()
|br| Overloads the MATLAB/Octave ``unique`` function. Returns
a ``dates`` object with repetitions removed (only the last
......@@ -1117,7 +1159,7 @@ The dseries class
.. dseriesmethod:: A = abs (B)
abs_ (B)
abs_ ()
|br| Overloads the ``abs()`` function for ``dseries``
objects. Returns the absolute value of the variables in
......@@ -1147,9 +1189,32 @@ The dseries class
1973Q2 | 0.51222 | 0.4948
1973Q3 | 0.99791 | 0.22677
*Example (in-place modification version)*
::
>> ts0 = dseries(randn(3,2),'1973Q1',{'A1'; 'A2'},{'A_1'; 'A_2'});
>> ts0
ts0 is a dseries object:
| A1 | A2
1973Q1 | -0.67284 | 1.4367
1973Q2 | -0.51222 | -0.4948
1973Q3 | 0.99791 | 0.22677
>> ts0.abs_();
>> ts0
ts0 is a dseries object:
| abs(A1) | abs(A2)
1973Q1 | 0.67284 | 1.4367
1973Q2 | 0.51222 | 0.4948
1973Q3 | 0.99791 | 0.22677
.. dseriesmethod:: [A, B] = align (A, B)
align_ (A, B)
align_ (B)
If ``dseries`` objects ``A`` and ``B`` are defined on
different time ranges, this function extends ``A`` and/or
......@@ -1204,8 +1269,60 @@ The dseries class
2001Q2 | 0.12801
*Example (in-place modification version)*
::
>> ts0 = dseries(rand(5,1),dates('2000Q1')); % 2000Q1 -> 2001Q1
>> ts1 = dseries(rand(3,1),dates('2000Q4')); % 2000Q4 -> 2001Q2
>> ts0
ts0 is a dseries object:
| Variable_1
2000Q1 | 0.80028
2000Q2 | 0.14189
2000Q3 | 0.42176
2000Q4 | 0.91574
2001Q1 | 0.79221
>> ts1
ts1 is a dseries object:
| Variable_1
2000Q4 | 0.95949
2001Q1 | 0.65574
2001Q2 | 0.035712
>> align_(ts0, ts1); % 2000Q1 -> 2001Q2
>> ts0
ts0 is a dseries object:
| Variable_1
2000Q1 | 0.80028
2000Q2 | 0.14189
2000Q3 | 0.42176
2000Q4 | 0.91574
2001Q1 | 0.79221
2001Q2 | NaN
>> ts1
ts1 is a dseries object:
| Variable_1
2000Q1 | NaN
2000Q2 | NaN
2000Q3 | NaN
2000Q4 | 0.95949
2001Q1 | 0.65574
2001Q2 | 0.035712
.. dseriesmethod:: C = backcast (A, B[, diff])
backcast_ (A, B[, diff])
backcast_ (B[, diff])
Backcasts ``dseries`` object ``A`` with ``dseries`` object B's
growth rates (except if the last optional argument, ``diff``,
......@@ -1213,8 +1330,8 @@ The dseries class
``dseries`` objects must have the same frequency.
.. dseriesmethod:: B = baxter_king_filter (A, hf, lf, K)
baxter_king_filter_ (A, hf, lf, K)
.. dseriesmethod:: B = baxter_king_filter (A[, hf[, lf[, K]]])
baxter_king_filter_ ([hf[, lf[, K]]])
|br| Implementation of the *Baxter and King* (1999) band pass
filter for ``dseries`` objects. This filter isolates business
......@@ -1260,7 +1377,7 @@ The dseries class
.. dseriesmethod:: B = center (A[, geometric])
center_ (A[, geometric])
center_ ([geometric])
|br| Centers variables in ``dseries`` object ``A`` around their
arithmetic means, except if the optional argument ``geometric``
......@@ -1269,7 +1386,7 @@ The dseries class
.. dseriesmethod:: C = chain (A, B)
chain_ (A, B)
chain_ (B)
|br| Merge two ``dseries`` objects along the time
dimension. The two objects must have the same number of
......@@ -1282,7 +1399,7 @@ The dseries class
::
>> ts = dseries([1; 2; 3; 4],dates(`1950Q1'))
>> ts = dseries([1; 2; 3; 4],dates('1950Q1'))
ts is a dseries object:
......@@ -1292,7 +1409,7 @@ The dseries class
1950Q3 | 3
1950Q4 | 4
>> us = dseries([3; 4; 5; 6],dates(`1950Q3'))
>> us = dseries([3; 4; 5; 6],dates('1950Q3'))
us is a dseries object:
......@@ -1314,6 +1431,25 @@ The dseries class
1951Q1 | 5
1951Q2 | 6
*Example (in-place modification version)*
::
>> ts = dseries([1; 2; 3; 4],dates('1950Q1'))
>> us = dseries([3; 4; 5; 6],dates('1950Q3'))
>> ts.chain_(us);
>> ts
ts is a dseries object:
| Variable_1
1950Q1 | 1
1950Q2 | 2
1950Q3 | 3
1950Q4 | 4
1951Q1 | 5
1951Q2 | 6
.. dseriesmethod:: [error_flag, message ] = check (A)
......@@ -1384,7 +1520,7 @@ The dseries class
.. dseriesmethod:: B = cumprod (A[, d[, v]])
cumprod_ (A[, d[, v]])
cumprod_ ([d[, v]])
|br| Overloads the MATLAB/Octave ``cumprod`` function for
``dseries`` objects. The cumulated product cannot be computed
......@@ -1447,7 +1583,7 @@ The dseries class
.. dseriesmethod:: B = cumsum (A[, d[, v]])
cumsum (A[, d[, v]])
cumsum_ ([d[, v]])
|br| Overloads the MATLAB/Octave ``cumsum`` function for
``dseries`` objects. The cumulated sum cannot be computed if
......@@ -1518,22 +1654,23 @@ The dseries class
10Y | 10.1416
.. dseriesmethod:: B = detrend (A, m)
detrend_ (A, m)
.. dseriesmethod:: B = detrend (A[, m])
detrend_ ([m])
|br| Detrends ``dseries`` object ``A`` with a fitted
polynomial of order ``m``. Note that each variable is
detrended with a different polynomial.
polynomial of order ``m``. Default value fir ``m`` is 0 (time
series are detrended by removing the average). Note that each
variable is detrended with a different polynomial.
.. dseriesmethod:: B = dgrowth (A)
dgrowth_ (A)
dgrowth_ ()
|br| Computes daily growth rates.
.. dseriesmethod:: B = diff (A)
diff_ (A)
diff_ ()
|br| Returns the first difference of ``dseries`` object ``A``.
......@@ -1623,6 +1760,29 @@ The dseries class
>> ts0 = dseries(rand(10,1));
>> ts1 = ts0.exp();
*Exemple (in-place modification version)*
::
>> ts0 = dseries(rand(3,1))
ts0 is a dseries object:
| Variable_1
1Y | 0.82953
2Y | 0.84909
3Y | 0.37253
>> ts0.exp_();
>> ts0
ts0 is a dseries object:
| Variable_1
1Y | 2.2922
2Y | 2.3375
3Y | 1.4514
.. dseriesmethod:: C = extract (A, B[, ...])
......@@ -1671,9 +1831,40 @@ The dseries class
1973Q4 | -0.03705 | -0.35899 | 0.85838 | -1.4675 | -2.1666 | -0.62032
.. dseriesmethod:: fill_(name, v)
|br| Assign the value ``v`` to the variable ``name`` in a
dseries object. If ``name`` is a character row array, it should
correspond to an existing variable within the dseries
object. When ``v`` is a scalar, its value will be applied to
all periods uniformly. If ``v`` is a vector, its length must
match the number of observations in the dseries object.You can
invoke this method for a batch of variables by providing a 1 by
n cell array of character row arrays as the first argument. When
"v" is a row vector with n elements, the method will be applied
uniformly across all periods. If "v" is a matrix, it must have
n columns, and the number of rows should correspond to the
number of periods.
*Example*
::
>> ts = dseries(rand(3,3));
>> ts.fill_({'Variable_1', 'Variable_3'}, [1 3]);
>> ts
ts is a dseries object:
| Variable_1 | Variable_2 | Variable_3
1Y | 1 | 0.91338 | 3
2Y | 1 | 0.63236 | 3
3Y | 1 | 0.09754 | 3
.. dseriesmethod:: f = firstdate (A)
|br| Returns the first period in ``dseries`` object ``A``.
|br| Returns the initial period in the ``dseries`` object ``A``.
.. dseriesmethod:: f = firstobservedperiod (A)
......@@ -1704,7 +1895,67 @@ The dseries class
4
.. dseriesmethod:: D = horzcat (A, B[, ...])
.. dseriesmethod:: l = ge (A, B)
l = gt (A, B)
|br| Overloads the ``gt`` (>) and ``ge`` (>=) binary operators. Returns a logical array.
*Example*
::
>> ts = dseries(randn(3,1))
ts is a dseries object:
| Variable_1
1Y | -1.2075
2Y | 0.71724
3Y | 1.6302
>> ts>1
ans =
3x1 logical array
0
0
1
>> ds = dseries(randn(3,1))
ds is a dseries object:
| Variable_1
1Y | 0.48889
2Y | 1.0347
3Y | 0.72689
>> ds>ts
ans =
3x1 logical array
1
1
0
.. dseriesmethod:: B = hdiff (A)
hdiff_ ()
|br| Computes bi-annual differences.
.. dseriesmethod:: B = hgrowth (A)
hgrowth_ ()
|br| Computes bi-annual growth rates.
.. dseriesmethod:: D = horzcat (A, B[, ...])
|br| Overloads the ``horzcat`` MATLAB/Octave’s method for
``dseries`` objects. Returns a ``dseries`` object ``D``
......@@ -1740,7 +1991,7 @@ The dseries class
.. dseriesmethod:: B = hpcycle (A[, lambda])
hpcycle_ (A[, lambda])
hpcycle_ ([lambda])
|br| Extracts the cycle component from a ``dseries`` ``A``
object using the *Hodrick and Prescott (1997)* filter and
......@@ -1781,7 +2032,7 @@ The dseries class
.. dseriesmethod:: B = hptrend (A[, lambda])
hptrend_ (A[, lambda])
hptrend_ ([lambda])
|br| Extracts the trend component from a ``dseries`` A object
using the *Hodrick and Prescott (1997)* filter and returns a
......@@ -1878,10 +2129,12 @@ The dseries class
.. dseriesmethod:: B = lag (A[, p])
lag_ (A[, p])
lag_ ([p])
|br| Returns lagged time series. Default value of integer scalar ``p``, the number
of lags, is ``1``.
|br| Returns lagged time series. Default value of integer
scalar ``p``, the number of lags, is ``1``. The `dseries`
class overloads the parentheses, so that `ts.lag(p)` is
equivalent to `ts(-p)`.
*Example*
......@@ -1946,7 +2199,7 @@ The dseries class
.. dseriesmethod:: l = lastdate (B)
|br| Returns the last period in ``dseries`` object ``B``.
|br| Retrieves the final period from the ``dseries`` object ``B``.
*Example*
......@@ -1960,23 +2213,76 @@ The dseries class
.. dseriesmethod:: f = lastobservedperiod (A)
|br| Returns the last period where all the variables in ``dseries`` object ``A`` are observed (non NaN).
|br| Returns the last period in which all variables of the
``dseries`` object ``A`` are fully observed (i.e., contain no
NaN values).
.. dseriesmethod:: f = lastobservedperiods (A)
|br| Returns for each variable the last period without missing
observations in ``dseries`` object ``A``. Output argument ``f`` is a
structure, each field name is the name of a variable in ``A``, each field
content is a singleton ``date`` object.
|br| Returns the last period without missing observations for
each variable in the ``dseries`` object ``A``. The output
argument ``f`` is a structure where each field name corresponds
to a variable in ``A``, and the content of each field is a
singleton ``date`` object.
.. dseriesmethod:: l = le (A, B)
l = lt (A, B)
|br| Overloads the ``gt`` (<) and ``ge`` (<=) binary operators. Returns a logical array.
*Example*
::
>> ts = dseries(randn(3,1))
ts is a dseries object:
| Variable_1
1Y | -1.2075
2Y | 0.71724
3Y | 1.6302
>> ts<1
ans =
3x1 logical array
1
1
0
>> ds = dseries(randn(3,1))
ds is a dseries object:
| Variable_1
1Y | 0.48889
2Y | 1.0347
3Y | 0.72689
>> ds<ts
ans =
3x1 logical array
0
0
1
.. dseriesmethod:: B = lead (A[, p])
lead_ (A[, p])
lead_ ([p])
|br| Returns lead time series. Default value of integer scalar
``p``, the number of leads, is ``1``. As in the ``lag``
method, the ``dseries`` class overloads the parenthesis so
that ``ts.lead(p)`` is equivalent to ``ts(p)``.
|br| Returns a lead time series. The default value for the
integer scalar ``p``, which represents the number of leads, is
``1``. Similar to the ``lag`` method, the ``dseries`` class
overloads the parentheses, making ``ts.lead(p)`` equivalent to
``ts(p)``.
*Example*
......@@ -2005,11 +2311,11 @@ The dseries class
*Remark*
The overloading of the parenthesis for ``dseries`` objects,
allows to easily create new ``dseries`` objects by
copying/pasting equations declared in the ``model`` block. For
instance, if an Euler equation is defined in the ``model``
block::
The overload of parentheses for ``dseries`` objects simplifies
the creation of new ``dseries`` instances by enabling the
direct copying and pasting of equations defined within the
``model`` block. For example, if an Euler equation is
specified in the ``model`` block,::
model;
...
......@@ -2050,7 +2356,7 @@ The dseries class
.. dseriesmethod:: B = log (A)
log_ (A)
log_ ()
|br| Overloads the MATLAB/Octave ``log`` function for
``dseries`` objects.
......@@ -2063,37 +2369,36 @@ The dseries class
>> ts1 = ts0.log();
.. dseriesmethod:: B = mdiff (A)
mdiff_ (A)
mdiff_ ()
B = mgrowth (A)
mgrowth_ (A)
mgrowth_ ()
|br| Computes monthly differences or growth rates of variables in
``dseries`` object ``A``.
|br| Calculates the monthly differences or growth rates of
variables in the ``dseries`` object ``A``.
.. dseriesmethod:: B = mean (A[, geometric])
|br| Overloads the MATLAB/Octave ``mean`` function for
``dseries`` objects. Returns the mean of each variable in
``dseries`` object ``A``. If the second argument is ``true``
the geometric mean is computed, otherwise (default) the
arithmetic mean is reported.
|br| This function overloads the MATLAB/Octave ``mean``
function specifically for ``dseries`` objects. It calculates
the mean for each variable within the ``dseries`` object
``A``. If the second argument is set to ``true``, the
geometric mean is calculated; otherwise, the arithmetic mean
is computed by default.
.. dseriesmethod:: C = merge (A, B[, legacy])
|br| Merges two ``dseries`` objects ``A`` and ``B`` in
``dseries`` object ``C``. Objects ``A`` and ``B`` need to have
common frequency but can be defined on different time
ranges. If a variable, say ``x``, is defined both in
``dseries`` objects ``A`` and ``B``, then the ``merge`` will
select the variable ``x`` as defined in the second input
argument, ``B``, except for the NaN elements in ``B`` if
corresponding elements in ``A`` (ie same periods) are well
defined numbers. This behaviour can be changed by setting the
optional argument ``legacy`` equal to true, in which case the
second variable overwrites the first one even if the second
variable has NaNs.
|br| Merges two ``dseries`` objects, ``A`` and ``B``, into a new
``dseries`` object ``C``. The objects ``A`` and ``B`` must share a
common frequency, although they can cover different time
ranges. If a variable, such as ``x``, exists in both ``dseries``
objects, the ``merge`` function will prioritize the definition
from the second input, ``B``, while retaining the values from
``A`` for any corresponding periods where ``B`` has NaN
values. This behavior can be altered by setting the optional
argument ``legacy`` to true, in which case the second variable
will replace the first, even if it contains NaN values.
*Example*
......@@ -2141,30 +2446,29 @@ The dseries class
.. dseriesmethod:: C = minus (A, B)
|br| Overloads the MATLAB/Octave ``minus`` (``-``) operator
for ``dseries`` objects, element by element subtraction. If
both ``A`` and ``B`` are ``dseries`` objects, they do not need
to be defined over the same time ranges. If ``A`` and ``B``
are ``dseries`` objects with :math:`T_A` and :math:`T_B`
for ``dseries`` objects, allowing for element-by-element
subtraction. When both ``A`` and ``B`` are ``dseries``
objects, they do not need to be defined over the same time
ranges. If ``A`` and ``B`` have :math:`T_A` and :math:`T_B`
observations and :math:`N_A` and :math:`N_B` variables, then
:math:`N_A` must be equal to :math:`N_B` or :math:`1` and
:math:`N_B` must be equal to :math:`N_A` or :math:`1`. If
:math:`T_A=T_B`, ``isequal(A.init,B.init)`` returns ``1`` and
:math:`N_A=N_B`, then the ``minus`` operator will compute for
each couple :math:`(t,n)`, with :math:`1\le t\le T_A` and
:math:`1\le n\le N_A`,
``C.data(t,n)=A.data(t,n)-B.data(t,n)``. If :math:`N_B` is
equal to :math:`1` and :math:`N_A>1`, the smaller ``dseries``
object (``B``) is “broadcast” across the larger ``dseries``
(``A``) so that they have compatible shapes, the ``minus``
operator will subtract the variable defined in ``B`` from each
variable in ``A``. If ``B`` is a double scalar, then the
method ``minus`` will subtract ``B`` from all the
observations/variables in ``A``. If ``B`` is a row vector of
length :math:`N_A`, then the ``minus`` method will subtract
``B(i)`` from all the observations of variable ``i``, for
:math:`N_A` must equal :math:`N_B` or :math:`1`, and
:math:`N_B` must equal :math:`N_A` or :math:`1`. If
:math:`T_A=T_B`, ``isequal(A.init,B.init)`` returns ``1``,
and :math:`N_A=N_B`, then the ``minus`` operator will compute
for each pair :math:`(t,n)`, where :math:`1\le t\le T_A` and
:math:`1\le n\le N_A`, the operation
``C.data(t,n)=A.data(t,n)-B.data(t,n)``. If :math:`N_B` equals
:math:`1` and :math:`N_A>1`, the smaller ``dseries`` object
(``B``) is “broadcasted” across the larger ``dseries`` (``A``),
ensuring compatible shapes for the subtraction of the variable
defined in ``B`` from each variable in ``A``. If ``B`` is a
double scalar, the ``minus`` method will subtract ``B`` from
all observations and variables in ``A``. If ``B`` is a row
vector of length :math:`N_A`, the ``minus`` method will
subtract ``B(i)`` from all observations of variable ``i``, for
:math:`i=1,...,N_A`. If ``B`` is a column vector of length
:math:`T_A`, then the ``minus`` method will subtract ``B``
from all the variables.
:math:`T_A`, the ``minus`` method will subtract ``B`` from all
the variables.
*Example*
......@@ -2211,15 +2515,16 @@ The dseries class
.. dseriesmethod:: C = mpower (A, B)
|br| Overloads the MATLAB/Octave ``mpower`` (``^``) operator for ``dseries``
objects and computes element-by-element power. ``A`` is a
|br| Overloads the MATLAB/Octave ``mpower`` (``^``) operator
for ``dseries`` objects, performing element-wise
exponentiation. Given a ``dseries`` object ``A`` with ``N``
variables and ``T`` observations, if ``B`` is a real scalar,
then ``mpower(A,B)`` yields a ``dseries`` object ``C`` where
``C.data(t,n) = A.data(t,n)^B``. If ``B`` is also a
``dseries`` object with ``N`` variables and ``T``
observations. If ``B`` is a real scalar, then ``mpower(A,B)``
returns a ``dseries`` object ``C`` with
``C.data(t,n)=A.data(t,n)^C``. If ``B`` is a ``dseries``
object with ``N`` variables and ``T`` observations then
``mpower(A,B)`` returns a ``dseries`` object ``C`` with
``C.data(t,n)=A.data(t,n)^C.data(t,n)``.
observations, then ``mpower(A,B)`` produces a ``dseries``
object ``C`` such that ``C.data(t,n) =
A.data(t,n)^{C.data(t,n)}``.
*Example*
......@@ -2247,31 +2552,31 @@ The dseries class
.. dseriesmethod:: C = mrdivide (A, B)
|br| Overloads the MATLAB/Octave ``mrdivide`` (``/``) operator for
``dseries`` objects, element by element division (like the
``./`` MATLAB/Octave operator). If both ``A`` and ``B`` are
``dseries`` objects, they do not need to be defined over the
same time ranges. If ``A`` and ``B`` are ``dseries`` objects
with :math:`T_A` and :math:`T_B` observations and :math:`N_A`
and :math:`N_B` variables, then :math:`N_A` must be equal to
:math:`N_B` or :math:`1` and :math:`N_B` must be equal to
:math:`N_A` or :math:`1`. If :math:`T_A=T_B`,
``isequal(A.init,B.init)`` returns ``1`` and :math:`N_A=N_B`,
then the ``mrdivide`` operator will compute for each couple
:math:`(t,n)`, with :math:`1\le t\le T_A` and :math:`1\le n\le
N_A`, ``C.data(t,n)=A.data(t,n)/B.data(t,n)``. If :math:`N_B`
is equal to :math:`1` and :math:`N_A>1`, the smaller
``dseries`` object (``B``) is “broadcast” across the larger
``dseries`` (``A``) so that they have compatible shapes. In
this case the ``mrdivide`` operator will divide each variable
defined in A by the variable in B, observation per
observation. If B is a double scalar, then ``mrdivide`` will
divide all the observations/variables in ``A`` by ``B``. If
``B`` is a row vector of length :math:`N_A`, then ``mrdivide``
will divide all the observations of variable ``i`` by
``B(i)``, for :math:`i=1,...,N_A`. If ``B`` is a column vector
of length :math:`T_A`, then ``mrdivide`` will perform a
division of all the variables by ``B``, element by element.
|br| Overloads the MATLAB/Octave ``mrdivide`` (``/``) operator
for ``dseries`` objects, enabling element-wise division
similar to the ``./`` operator in MATLAB/Octave. When both
``A`` and ``B`` are ``dseries`` objects, they can have
different time ranges. If ``A`` contains :math:`T_A`
observations and :math:`N_A` variables, and ``B`` has
:math:`T_B` observations and :math:`N_B` variables, then
:math:`N_A` must equal :math:`N_B` or :math:`1`, and vice
versa. If :math:`T_A=T_B` and ``isequal(A.init,B.init)``
returns ``1``, along with :math:`N_A=N_B`, the ``mrdivide``
operator calculates for each pair :math:`(t,n)`, where
:math:`1\le t\le T_A` and :math:`1\le n\le N_A`, the value of
``C.data(t,n)=A.data(t,n)/B.data(t,n)``. If :math:`N_B` equals
:math:`1` and :math:`N_A>1`, the smaller ``dseries`` object
(``B``) is “broadcast” across the larger one (``A``) to ensure
compatible shapes. In this case, the ``mrdivide`` operator
divides each variable in ``A`` by the variable in ``B``,
observation by observation. If ``B`` is a double scalar, then
``mrdivide`` will divide all observations and variables in
``A`` by ``B``. If ``B`` is a row vector of length
:math:`N_A`, then ``mrdivide`` will divide each observation of
variable ``i`` by ``B(i)``, for :math:`i=1,...,N_A`. If ``B``
is a column vector of length :math:`T_A`, then ``mrdivide``
will perform an element-wise division of all variables by
``B``.
*Example*
......@@ -2300,62 +2605,62 @@ The dseries class
.. dseriesmethod:: C = mtimes (A, B)
|br| Overloads the MATLAB/Octave ``mtimes`` (``*``) operator
for ``dseries`` objects and the Hadammard product (the .*
MATLAB/Octave operator). If both ``A`` and ``B`` are
``dseries`` objects, they do not need to be defined over the
same time ranges. If ``A`` and ``B`` are ``dseries`` objects
with :math:`T_A` and :math:`_B` observations and :math:`N_A`
and :math:`N_B` variables, then :math:`N_A` must be equal to
:math:`N_B` or :math:`1` and :math:`N_B` must be equal to
:math:`N_A` or :math:`1`. If :math:`T_A=T_B`,
``isequal(A.init,B.init)`` returns ``1`` and :math:`N_A=N_B`,
then the ``mtimes`` operator will compute for each couple
:math:`(t,n)`, with :math:`1\le t\le T_A` and :math:`1\le n\le
N_A`, ``C.data(t,n)=A.data(t,n)*B.data(t,n)``. If :math:`N_B`
is equal to :math:`1` and :math:`N_A>1`, the smaller
``dseries`` object (``B``) is “broadcast” across the larger
``dseries`` (``A``) so that they have compatible shapes,
``mtimes`` operator will multiply each variable defined in
``A`` by the variable in ``B``, observation per
observation. If ``B`` is a double scalar, then the method
``mtimes`` will multiply all the observations/variables in
for ``dseries`` objects, enabling element-wise multiplication
similar to the ``.*`` operator in MATLAB/Octave. When both
``A`` and ``B`` are ``dseries`` objects, they can have
different time ranges. If ``A`` contains :math:`T_A`
observations and :math:`N_A` variables, and ``B`` has
:math:`T_B` observations and :math:`N_B` variables, then
:math:`N_A` must equal :math:`N_B` or :math:`1`, and vice
versa. If :math:`T_A=T_B` and ``isequal(A.init,B.init)``
returns ``1``, along with :math:`N_A=N_B`, the ``mtimes``
operator calculates for each pair :math:`(t,n)`, where
:math:`1\le t\le T_A` and :math:`1\le n\le N_A`, the value of
``C.data(t,n)=A.data(t,n)*B.data(t,n)``. If :math:`N_B` equals
:math:`1` and :math:`N_A>1`, the smaller ``dseries`` object
(``B``) is “broadcasted” across the larger one (``A``) to ensure
compatible shapes. In this case, the ``mtimes`` operator
multiply each variable in ``A`` by the variable in ``B``,
observation by observation. If ``B`` is a double scalar, then
``mtimes`` will multiply all observations and variables in
``A`` by ``B``. If ``B`` is a row vector of length
:math:`N_A`, then the ``mtimes`` method will multiply all the
observations of variable ``i`` by ``B(i)``, for
:math:`i=1,...,N_A`. If ``B`` is a column vector of length
:math:`T_A`, then the ``mtimes`` method will perform a
multiplication of all the variables by ``B``, element by
element.
:math:`N_A`, then ``mtimes`` will multiply each observation of
variable ``i`` by ``B(i)``, for :math:`i=1,...,N_A`. If ``B``
is a column vector of length :math:`T_A`, then ``mtimes``
will perform an element-wise multiplication of all variables by
``B``.
.. dseriesmethod:: B = nanmean (A[, geometric])
|br| Overloads the MATLAB/Octave ``nanmean`` function for
``dseries`` objects. Returns the mean of each variable in
``dseries`` object ``A`` ignoring the NaN values. If the
second argument is ``true`` the geometric mean is computed,
otherwise (default) the arithmetic mean is reported.
``dseries`` objects. Computes the mean of each variable in the
``dseries`` object ``A``, excluding NaN values. If the second
argument is ``true``, the geometric mean is calculated;
otherwise, the default is to report the arithmetic mean.
.. dseriesmethod:: B = nanstd (A[, geometric])
|br| Overloads the MATLAB/Octave ``nanstd`` function for
``dseries`` objects. Returns the standard deviation of each
variable in ``dseries`` object ``A`` ignoring the NaN
values. If the second argument is ``true`` the geometric std
is computed, default value of the second argument is
``dseries`` objects. This function calculates the standard
deviation for each variable within the ``dseries`` object
``A``, while disregarding any NaN values. If the second
argument is set to ``true``, the geometric standard deviation
will be computed; the default value for the second argument is
``false``.
.. dseriesmethod:: C = ne (A, B)
|br| Overloads the MATLAB/Octave ``ne`` (not equal, ``~=``)
operator. ``dseries`` objects ``A`` and ``B`` must have the
same number of observations (say, :math:`T`) and variables
(:math:`N`). The returned argument is a :math:`T` by :math:`N`
matrix of zeros and ones. Element :math:`(i,j)` of ``C`` is
equal to ``1`` if and only if observation :math:`i` for
variable :math:`j` in ``A`` and ``B`` are not equal.
operator. The ``dseries`` objects ``A`` and ``B`` must contain
the same number of observations (denoted as :math:`T`) and
variables (denoted as :math:`N`). The output is a :math:`T` by
:math:`N` matrix consisting of zeros and ones. The element
:math:`(i,j)` of the matrix ``C`` is equal to ``1`` if and
only if observation :math:`i` for variable :math:`j` in ``A``
and ``B`` are not equal.
*Example*
......@@ -2392,25 +2697,25 @@ The dseries class
.. dseriesmethod:: B = onesidedhpcycle (A[, lambda[, init]])
onesidedhpcycle_ (A[, lambda[, init]])
onesidedhpcycle_ ([lambda[, init]])
|br| Extracts the cycle component from a ``dseries`` ``A``
object using a one sided HP filter (with a Kalman filter) and
returns a ``dseries`` object, ``B``. The default value for
``lambda``, the smoothing parameter, is ``1600``. By default,
if ``ìnit`` is not provided, the initial value is based on the
first two observations.
object using a one-sided HP filter (implemented with a Kalman
filter) and returns a ``dseries`` object, ``B``. The default
value for ``lambda``, the smoothing parameter, is set to
``1600``. By default, if ``init`` is not provided, the initial
value is determined from the first two observations.
.. dseriesmethod:: B = onesidedhptrend (A[, lambda[, init]])
onesidedhptrend_ (A[, lambda[, init]])
|br| Extracts the trend component from a ``dseries`` ``A``
object using a one sided HP filter (with a Kalman filter) and
returns a ``dseries`` object, ``B``. The default value for
``lambda``, the smoothing parameter, is ``1600``. By default,
if ``ìnit`` is not provided, the initial value is based on the
first two observations.
object using a one-sided HP filter (implemented with a Kalman
filter) and returns a ``dseries`` object, ``B``. The default
value for ``lambda``, the smoothing parameter, is set to
``1600``. By default, if ``init`` is not provided, the initial
value is derived from the first two observations.
.. dseriesmethod:: h = plot (A)
......@@ -2418,27 +2723,28 @@ The dseries class
h = plot (A[, ...])
h = plot (A, B[, ...])
|br| Overloads MATLAB/Octave’s ``plot`` function for
``dseries`` objects. Returns a MATLAB/Octave plot handle, that
can be used to modify the properties of the plotted time
series. If only one ``dseries`` object, ``A``, is passed as
argument, then the plot function will put the associated dates
on the x-abscissa. If this ``dseries`` object contains only
one variable, additional arguments can be passed to modify the
properties of the plot (as one would do with the
MATLAB/Octave’s version of the plot function). If ``dseries``
object ``A`` contains more than one variable, it is not
possible to pass these additional arguments and the properties
of the plotted time series must be modified using the returned
plot handle and the MATLAB/Octave ``set`` function (see
example below). If two ``dseries`` objects, ``A`` and ``B``,
are passed as input arguments, the plot function will plot the
variables in ``A`` against the variables in ``B`` (the number
of variables in each object must be the same otherwise an
error is issued). Again, if each object contains only one
variable, additional arguments can be passed to modify the
properties of the plotted time series, otherwise the
MATLAB/Octave ``set`` command has to be used.
|br| Overloads the MATLAB/Octave ``plot`` function for
``dseries`` objects. This function returns a MATLAB/Octave
plot handle, which can be utilized to modify the properties of
the plotted time series. If a single ``dseries`` object,
``A``, is provided as an argument, the plot function will
place the corresponding dates on the x-axis. If this
``dseries`` object contains only one variable, additional
arguments can be included to adjust the plot properties,
similar to how one would with MATLAB/Octave's original plot
function. However, if the ``dseries`` object ``A`` has more
than one variable, additional arguments cannot be passed, and
modifications to the plotted time series properties must be
done using the returned plot handle alongside the
MATLAB/Octave ``set`` function (refer to the example
below). When two ``dseries`` objects, ``A`` and ``B``, are
passed as input arguments, the plot function will display the
variables in ``A`` against those in ``B`` (it is essential
that both objects contain the same number of variables;
otherwise, an error will occur). Once more, if each object
includes only one variable, additional arguments can be
utilized to alter the plotted time series properties;
otherwise, the MATLAB/Octave ``set`` command must be employed.
*Example*
......@@ -2479,7 +2785,7 @@ The dseries class
.. dseriesmethod:: C = plus (A, B)
|br| Overloads the MATLAB/Octave ``plus`` (``+``) operator for
``dseries`` objects, element by element addition. If both
``dseries`` objects, allowing for element-wise addition. When both
``A`` and ``B`` are ``dseries`` objects, they do not need to
be defined over the same time ranges. If ``A`` and ``B`` are
``dseries`` objects with :math:`T_A` and :math:`T_B`
......@@ -2488,28 +2794,28 @@ The dseries class
:math:`N_B` must be equal to :math:`N_A` or :math:`1`. If
:math:`T_A=T_B`, ``isequal(A.init,B.init)`` returns ``1`` and
:math:`N_A=N_B`, then the ``plus`` operator will compute for
each couple :math:`(t,n)`, with :math:`1\le t\le T_A` and
each pair :math:`(t,n)`, with :math:`1\le t\le T_A` and
:math:`1\le n\le N_A`,
``C.data(t,n)=A.data(t,n)+B.data(t,n)``. If :math:`N_B` is
equal to :math:`1` and :math:`N_A>1`, the smaller ``dseries``
object (``B``) is “broadcast” across the larger ``dseries``
(``A``) so that they have compatible shapes, the plus operator
object (``B``) is “broadcasted” across the larger ``dseries``
(``A``) to ensure compatible shapes, the plus operator
will add the variable defined in ``B`` to each variable in
``A``. If ``B`` is a double scalar, then the method ``plus``
will add ``B`` to all the observations/variables in ``A``. If
``B`` is a row vector of length :math:`N_A`, then the ``plus``
method will add ``B(i)`` to all the observations of variable
``i``, for :math:`i=1,...,N_A`. If ``B`` is a column vector of
``i``, for :math:`i=1,\ldots,N_A`. If ``B`` is a column vector of
length :math:`T_A`, then the ``plus`` method will add ``B`` to
all the variables.
.. dseriesmethod:: C = pop (A[, B])
pop_ (A[, B])
pop_ ([B])
|br| Removes variable ``B`` from ``dseries`` object ``A``. By
default, if the second argument is not provided, the last
variable is removed.
|br| Removes the variable ``B`` from the ``dseries`` object
``A``. By default, if the second argument is not specified, the
last variable is removed.
*Example*
......@@ -2528,26 +2834,25 @@ The dseries class
.. dseriesmethod:: A = projection (A, info, periods)
|br| Projects variables in dseries object ``A``. ``info`` is
is a :math:`n \times 3` cell array. Each row provides
informations necessary to project a variable. The first column
contains the name of variable (row char array). the second
column contains the name of the method used to project the
associated variable (row char array), possible values are
``'Trend'``, ``'Constant'``, and ``'AR'``. Last column
provides quantitative information about the projection. If the
second column value is ``'Trend'``, the third column value is
the growth factor of the (exponential) trend. If the second
column value is ``'Constant'``, the third column value is the
level of the variable. If the second column value is ``'AR'``,
the third column value is the autoregressive parameter. The
variables can be projected with an AR(p) model, if the third
column contains a 1×p vector of doubles. The stationarity of
the AR(p) model is not tested. The case of the constant
projection, using the last value of the variable, is covered
with 'Trend' and a growth factor equal to 1, or 'AR' with an
autoregressive parameter equal to one (random walk). This
projection routine only deals with exponential trends.
|br| Projects variables in the dseries object ``A``. The
``info`` variable is a :math:`n \times 3` cell array, where
each row contains essential information for projecting a
variable. The first column holds the variable name (as a
character array), while the second column indicates the
projection method used (also a character array). The possible
values for this column are ``'Trend'``, ``'Constant'``, and
``'AR'``. The third column provides quantitative details
related to the projection: if the second column is
``'Trend'``, the third column specifies the growth factor of
the (exponential) trend; if ``'Constant'``, it indicates the
variable's level; and if ``'AR'``, it denotes the
autoregressive parameter. Variables can be projected using an
AR(p) model if the third column contains a 1×p vector of
doubles. Note that the stationarity of the AR(p) model is not
tested. For constant projections, one can use either `'Trend'`
with a growth factor of 1 or `'AR'` with an autoregressive
parameter of one (indicating a random walk). This projection
routine solely addresses exponential trends.
*Example*
......@@ -2561,8 +2866,8 @@ The dseries class
.. dseriesmethod:: B = qdiff (A)
B = qgrowth (A)
qdiff_ (A)
qgrowth_ (A)
qdiff_ ()
qgrowth_ ()
|br| Computes quarterly differences or growth rates.
......@@ -2596,12 +2901,14 @@ The dseries class
.. dseriesmethod:: C = remove (A, B)
remove_ (A, B)
remove_ (B)
|br| If ``B`` is a row char array, the name of a variable, these methods
are aliases for ``pop`` and ``pop_`` methods with two arguments. They
remove variable ``B`` from ``dseries`` object ``A``. To remove more than
one variable, one can pass a cell of row char arrays for ``B``.
|br| If ``B`` is a row character array representing the name
of a variable, these methods serve as aliases for the ``pop``
and ``pop_`` methods that accept two arguments. They remove
the variable ``B`` from the ``dseries`` object ``A``. To
remove multiple variables, you can pass a cell array of row
character arrays for ``B``.
*Example*
......@@ -2617,11 +2924,11 @@ The dseries class
2Y | 1 | 1
3Y | 1 | 1
A shorter syntax is available: ``remove(ts,'Variable_2')``
is equivalent to ``ts{'Variable_2'} = []`` (``[]`` can be
replaced by any empty object). This alternative syntax is
useful if more than one variable has to be removed. For
instance::
A more concise syntax is available: ``remove(ts,
'Variable_2')``, which is equivalent to ``ts{'Variable_2'}
= []`` (where ``[]`` can be substituted with any empty
object). This alternative syntax proves useful when
removing multiple variables. For example::
ts{'Variable_@2,3,4@'} = [];
......@@ -2632,12 +2939,13 @@ The dseries class
.. dseriesmethod:: B = rename (A, oldname, newname)
rename_ (A, oldname, newname)
rename_ (oldname, newname)
|br| Rename variable ``oldname`` to ``newname`` in ``dseries``
object ``A``. Returns a ``dseries`` object. If more than one
variable needs to be renamed, it is possible to pass cells of
char arrays as second and third arguments.
|br| Renames the variable ``oldname`` to ``newname`` in the
``dseries`` object ``A``. This function returns a ``dseries``
object. If multiple variables need to be renamed, you can
provide cell arrays of row character arrays as the second and
third arguments.
*Example*
......@@ -2654,12 +2962,12 @@ The dseries class
.. dseriesmethod:: C = rename (A, newname)
rename_ (A, newname)
rename_ (newname)
|br| Replace the names in ``A`` with those passed in the cell
string array ``newname``. ``newname`` must have the same
number of elements as ``dseries`` object ``A`` has
variables. Returns a ``dseries`` object.
|br| Replace the names in ``A`` with those specified in the
cell of row character arrays ``newname``. The cell ``newname`` must contain
the same number of elements as there are variables in the
``dseries`` object ``A``.
*Example*
......@@ -2686,12 +2994,12 @@ The dseries class
.. dseriesmethod:: B = round (A[, n])
round_ (A[, n])
round_ ([n])
|br| Rounds to the nearest decimal or integer. ``n`` is the
precision parameter (number of decimals), default value is 0
meaning that that by default the method rounds to the nearest
integer.
|br| Rounds each value to the nearest decimal or integer. The
parameter ``n`` specifies the precision (number of decimal
places), with a default value of 0, indicating that the method
will round to the nearest integer by default.
*Example*
......@@ -2715,11 +3023,12 @@ The dseries class
.. dseriesmethod:: save (A, basename[, format])
|br| Overloads the MATLAB/Octave ``save`` function and saves
``dseries`` object ``A`` to disk. Possible formats are ``mat``
(this is the default), ``m`` (MATLAB/Octave script), and
``csv`` (MATLAB binary data file). The name of the file
without extension is specified by ``basename``.
|br| Overloads the MATLAB/Octave ``save`` function to save the
``dseries`` object ``A`` to disk. The available formats
include ``mat`` (default, MATLAB binary data file), ``m``
(MATLAB/Octave script), and ``csv`` (comma-separated values
file). The base name of the file, excluding the extension, is
specified by ``basename``.
*Example*
......@@ -2766,13 +3075,14 @@ The dseries class
.. dseriesmethod:: B = set_names(A, s1, s2, ...)
|br| Renames variables in ``dseries`` object ``A`` and returns
a ``dseries`` object ``B`` with new names ``s1``, ``s2``,
... The number of input arguments after the first one
(``dseries`` object ``A``) must be equal to ``A.vobs`` (the
number of variables in ``A``). ``s1`` will be the name of the
first variable in ``B``, ``s2`` the name of the second
variable in ``B``, and so on.
|br| Renames the variables in the ``dseries`` object ``A`` and
returns a new ``dseries`` object ``B`` with the updated names
``s1``, ``s2``, and so forth. The number of input arguments
following the first one (the ``dseries`` object ``A``) must be
equal to ``A.vobs`` (the total number of variables in
``A``). The name ``s1`` will correspond to the first variable
in ``B``, ``s2`` to the second variable in ``B``, and this
pattern continues for the remaining variables.
*Example*
......@@ -2789,13 +3099,13 @@ The dseries class
.. dseriesmethod:: [T, N ] = size(A[, dim])
Overloads the MATLAB/Octave’s ``size`` function. Returns the
number of observations in ``dseries`` object ``A``
(i.e. ``A.nobs``) and the number of variables
(i.e. ``A.vobs``). If a second input argument is passed, the
``size`` function returns the number of observations if
``dim=1`` or the number of variables if ``dim=2`` (for all
other values of ``dim`` an error is issued).
Overloads the MATLAB/Octave ``size`` function to return the
number of observations in the ``dseries`` object ``A`` (i.e.,
``A.nobs``) as well as the number of variables (i.e.,
``A.vobs``). If a second input argument is provided, the
``size`` function will return the number of observations when
``dim=1`` or the number of variables when ``dim=2``. An error
will be issued for any other values of ``dim``.
*Example*
......@@ -2812,18 +3122,20 @@ The dseries class
.. dseriesmethod:: B = std (A[, geometric])
|br| Overloads the MATLAB/Octave ``std`` function for
``dseries`` objects. Returns the standard deviation of each
variable in ``dseries`` object ``A``. If the second argument
is ``true`` the geometric standard deviation is computed
(default value of the second argument is ``false``).
``dseries`` objects. This function returns the standard
deviation of each variable within the ``dseries`` object
``A``. If the second argument is set to ``true``, the
geometric standard deviation is calculated (the default value
for the second argument is ``false``).
.. dseriesmethod:: B = subsample (A, d1, d2)
|br| Returns a subsample, for periods between ``dates`` ``d1``
and ``d2``. The same can be achieved by indexing a
``dseries`` object with a ``dates`` object, but the
``subsample`` method is easier to use programmatically.
|br| Returns a subsample for the period between ``d1`` and
``d2``. While you can achieve the same result by indexing a
``dseries`` object with a ``dates`` object, the ``subsample``
method offers a more straightforward approach for programmatic
use.
*Example*
......@@ -2842,7 +3154,7 @@ The dseries class
.. dseriesmethod:: A = tag (A, a[, b, c])
|br| Add a tag to a variable in ``dseries`` object ``A``.
|br| Adds a tag to a variable in ``dseries`` object ``A``.
*Example*
......@@ -2857,23 +3169,24 @@ The dseries class
.. dseriesmethod:: B = tex_rename (A, name, newtexname)
B = tex_rename (A, newtexname)
tex_rename_ (A, name, newtexname)
tex_rename_ (A, newtexname)
tex_rename_ (name, newtexname)
tex_rename_ (newtexname)
|br| Redefines the tex name of variable ``name`` to
``newtexname`` in ``dseries`` object ``A``. Returns a
``dseries`` object.
|br| Updates the TeX name of the variable ``name`` to
``newtexname`` in the ``dseries`` object ``A``. Returns an
updated ``dseries`` object.
With only two arguments ``A`` and ``newtexname``, it redefines
the tex names of the ``A`` to those contained in
``newtexname``. Here, ``newtexname`` is a cell string array
with the same number of entries as variables in ``A``.
With just two arguments, ``A`` and ``newtexname``, this
function redefines the TeX names of the entries in ``A`` to
those specified in ``newtexname``. The ``newtexname`` argument
must be a cell row character arrays containing the same number of
entries as there are variables in ``A``.
.. dseriesmethod:: B = uminus(A)
|br| Overloads ``uminus`` (``-``, unary minus) for ``dseries``
object.
|br| Overloads the ``uminus`` operator (``-``, unary minus)
for the ``dseries`` object.
*Example*
......@@ -2896,13 +3209,13 @@ The dseries class
.. dseriesmethod:: D = vertcat (A, B[, ...])
|br| Overloads the ``vertcat`` MATLAB/Octave method for
``dseries`` objects. This method is used to append more
observations to a ``dseries`` object. Returns a ``dseries``
object ``D`` containing the variables in ``dseries`` objects
passed as inputs. All the input arguments must be ``dseries``
objects with the same variables defined on different time
ranges.
|br| Overloads the ``vertcat`` method in MATLAB/Octave for
``dseries`` objects. This method facilitates the appending of
additional observations to a ``dseries`` object. It returns a
new ``dseries`` object, ``D``, which contains the variables
from the input ``dseries`` objects. All input arguments must
be ``dseries`` objects that share the same variables but are
defined over different time ranges.
*Example*
......@@ -2923,8 +3236,7 @@ The dseries class
.. dseriesmethod:: B = vobs (A)
|br| Returns the number of variables in ``dseries`` object
``A``.
|br| Returns the count of variables in the ``dseries`` object ``A``.
*Example*
......@@ -2940,10 +3252,10 @@ The dseries class
.. dseriesmethod:: B = ydiff (A)
B = ygrowth (A)
ydiff_ (A)
ygrowth_ (A)
ydiff_ ()
ygrowth_ ()
|br| Computes yearly differences or growth rates.
|br| Calculates annual differences or growth rates.
.. _x13-members:
......@@ -3205,10 +3517,10 @@ X-13 ARIMA-SEATS interface
The above example shows how to remove a seasonal pattern from a time series.
``o.transform('function','auto','savelog','atr')`` instructs the subsequent
``o.automdl()`` command to check whether an additional or a multiplicative
pattern fits the data better and to save the result. The result is saved in
`o.results.autotransform`, which in the present example indicates that a
``o.transform('function','auto','savelog','atr')`` instructs the subsequent
``o.automdl()`` command to check whether an additional or a multiplicative
pattern fits the data better and to save the result. The result is saved in
`o.results.autotransform`, which in the present example indicates that a
log transformation, i.e. a multiplicative model was preferred. The ``o.automdl('savelog','all')`` automatically selects a fitting
ARIMA model and saves all relevant output to the .log-file. The ``o.x11('save','(d11, d10)')`` instructs
``x11`` to save both the final seasonally adjusted series ``d11`` and the final seasonal factor ``d10``
......
# -*- 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,
......
......@@ -15,7 +15,7 @@ function [ys,params,check] = NK_baseline_steadystate(ys,exo,M_,options_)
% - check [scalar] set to 0 if steady state computation worked and to
% 1 of not (allows to impose restrictions on parameters)
% Copyright © 2013-2020 Dynare Team
% Copyright © 2013-2024 Dynare Team
%
% This file is part of Dynare.
%
......@@ -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
......@@ -52,8 +56,6 @@ u=1;
q=1;
d=1;
phi=1;
m=0;
zeta=1;
LambdaYd= (LambdaA+alppha*Lambdamu)/(1-alppha);
mu_z=exp(LambdaYd);
mu_I=exp(Lambdamu);
......
// --+ 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)