Commit Graph

2958 Commits (5.x)

Author SHA1 Message Date
Sébastien Villemot 5d0ad3f666
include_eqs/exclude_eqs: fix equation number in error message 2021-12-13 16:47:35 +01:00
Sébastien Villemot f44155d43a
Fix logic of include_eqs in the presence of [static]/[dynamic] equations
In a model with [static]/[dynamic] equations, if the user was using include_eqs
with a list of equations that does *not* contain equations marked
[static]/[dynamic], then the call to ModelTree::includeExcludeEquations(…,
static_equations=true) would have an empty list of equation tags (as stored
in tag_eqns).

The right behaviour in this case is to exclude all static equations. However,
the code would exclude none, and this would disrupt the equilibrium between
[static] and [dynamic] equations (since all [dynamic] equations were excluded
by the other call to the same method).

The fix consists in removing the shortcut that returns from the method if
tag_eqns is empty.

(cherry picked from commit a73b0d911a)
2021-12-13 12:19:16 +01:00
Sébastien Villemot 4deb397d18
Bump version number 2021-12-08 14:35:47 +01:00
Johannes Pfeifer 1341963d32
occbin_write_regimes: add option to select type
(cherry picked from commit 164e2debdc)
2021-12-07 18:13:25 +01:00
Sébastien Villemot 7fff5c4c30
Occbin: use element-by-element multiply, divide and power in occbin_difference.m
This file operates on vectors.

Ref. dynare#1826

(cherry picked from commit 81abea042b)
2021-12-07 18:11:13 +01:00
Sébastien Villemot f257b96060
When looking for unused endos/exos, also search in equations marked [static]
(cherry picked from commit fe974c4c31)
2021-12-07 11:37:27 +01:00
Sébastien Villemot cac24dad7e
Substitute model-local variables in equations marked [static]
(cherry picked from commit 8d4cab6fe3)
2021-12-07 11:37:27 +01:00
Sébastien Villemot ced586febf
Symbolic detrending engine: correctly handle equations marked [static]
Incidentally, this also fixes a detrending bug in the Occbin engine (since the
latter internally generates a [static] equation).

Ref. dynare#1827

By the way, perform a small code simplification.

(cherry picked from commit 7b8fc8edb7)
2021-12-07 11:37:27 +01:00
Sébastien Villemot bdbafdc34c
No longer consider an equation of the form “x(+1) = 0” as defining x to be a constant
Fix this by restricting the detection of constant equations to those where the
variable appears without a lead or lag.

Closes: #83
(cherry picked from commit 1cc512962c)
2021-11-22 10:23:57 +01:00
Sébastien Villemot 008a0dbb9e
With nostrict, really ignore unused endogenous in initval/endval/histval
Closes: #82
(cherry picked from commit b51f122e59)
2021-11-22 10:23:57 +01:00
Sébastien Villemot 0c1a9fa916
Fix handling of undeclared variables in the planner_objective statement
Closes: #81
(cherry picked from commit 02ee077663)
2021-11-22 10:23:57 +01:00
Sébastien Villemot a2977dd07c
Macroprocessor: make the removal of “@#line” directives and extra newlines consistent across LF and CR+LF conventions
Simplify the algorithm using only regexps, and add comments.

(cherry picked from commit 1e4eadb266)
2021-11-22 10:23:57 +01:00
Sébastien Villemot 67b8ef1a19
Macroprocessor: fix line counter inside @{} constructs
There were two bugs:
– with the LF convention, newlines were counted twice
– with the CR+LF convention, they were counted four times (because the CR was
  included in yyleng, alongside the LF)

The fix consists in implementing a location_increment() method similar to the
one used for the Dynare parser. This is the most robust solution.

By the way, mark the method DynareFlex::location_increment() method static.

(cherry picked from commit 1de3476546)
2021-11-22 10:23:57 +01:00
Sébastien Villemot 8e7dd47a16
Macroprocessor: fix newlines in output when under Windows and input uses CR+LF convention
If the input .mod file uses CR+LF convention, and if the user is under Windows,
then the output of the macroprocessor (as given by the “savemacro” option) had
incorrect end of lines: those would be CR+CR+LF.

The reason is that some TextNode(s) internally created by the macroprocessor
would themselves contain CR+LF sequences, which would then be transformed into
CR+CR+LF in the output (because MinGW transforms LF into CR+LF in output
streams).

The fix consists in changing the nature of the EOL token: the parsed text is no
longer attached to it, so that the Bison file now systematically turns it into
a LF inside TextNode(s).

Closes: #80
(cherry picked from commit 487c372900)
2021-11-22 10:23:57 +01:00
Sébastien Villemot c63d08007c
Fix error message when using pac_expectation with occbin_constraints
By the way, also fix the argument name (the model is not a VAR).

(cherry picked from commit 0123326123)
2021-10-29 14:12:13 +02:00
Sébastien Villemot ff564cbc9a
PAC: add growth correction term for definition of Z₁ in the MCE case
(cherry picked from commit 5bef185370)
2021-10-25 19:18:36 +02:00
Sébastien Villemot d430f47616
Improve message for GCC installation under macOS
(cherry picked from commit 8bb8e59410)
2021-10-08 15:51:37 +02:00
Sébastien Villemot 990cee70c2
PAC: better error message in case of name conflict for the growth neutrality correction parameter
(cherry picked from commit 78e295115a)
2021-10-06 16:42:22 +02:00
Johannes Pfeifer dfed3e98ab
ramsey_model: Fix error message logic
one of the statements being present is sufficient

(cherry picked from commit b496c4ba2c)
2021-09-24 16:54:28 +02:00
Sébastien Villemot 784b2d6d40
Remove unused steady_state_growth option to pac_model
(cherry picked from commit eb006ecaeb)
2021-09-22 17:29:53 +02:00
Johannes Pfeifer 0ccb986da8
Rename mh_mode to correct mh_posterior_mode_estimation option
Closes https://git.dynare.org/Dynare/preprocessor/-/issues/60

(cherry picked from commit 8d14e18cdb)
2021-09-22 17:28:32 +02:00
Sébastien Villemot d03b74469a
ramsey_{model,policy}, discretionary_policy: check that instruments are declared endogenous
Closes: #72
(cherry picked from commit b12746190d)
2021-09-21 18:41:41 +02:00
Sébastien Villemot 37b38b46cc
Fix use_dll on macOS + Octave
Enforce GCC with mkoctfile. Otherwise Clang will be used, and it does not
accept our custom optimization flags.

Ref. dynare#1797

(cherry picked from commit 3d215020ae)
2021-09-13 16:52:27 +02:00
Sébastien Villemot b1a0ebf513
Fix bug introduced in previous commit that triggers a crash for DSGE-VAR models
(cherry picked from commit 989347f448)
2021-09-08 19:00:58 +02:00
Sébastien Villemot 79efd2ec17
estimated_params*: add a check that prevents (apparently) recursive prior definitions
Closes: #77
(cherry picked from commit cb19ece049)
2021-09-08 17:11:48 +02:00
Sébastien Villemot 04e42fa821
estimated_params_{bounds,init} now check that a parameter (or correlation) is never declared twice
This check was previously only implemented in estimated_params.

(cherry picked from commit 62ba9a434a)
2021-09-08 17:11:47 +02:00
Sébastien Villemot ce43e91b57
PAC: generate the “growth_neutrality_param_index” MATLAB field for MCE models
Previously it was only generated in the case of backward PAC models.

(cherry picked from commit 784dd4122a)
2021-09-01 11:31:08 +02:00
Sébastien Villemot d528467234
Ensure that the “discount” option of “pac_model” is a parameter
Ref. Madysson/estimation-codes#4

(cherry picked from commit 6863494db2)
2021-08-31 13:58:59 +02:00
Johannes Pfeifer 4f8713134f
method_of_moments: move to namespace
(cherry picked from commit 3f37d9692c)
2021-08-31 13:56:19 +02:00
Stéphane Adjemian (Charybdis) 2f2e02e007
Fix warning (missing option in occbin_setup).
(cherry picked from commit 79d5a2d687)
2021-08-18 15:29:06 +02:00
Stéphane Adjemian 0bbba398a1
Merge branch 'occbin_options' into 'master'
Occbin: Add missing options

See merge request Dynare/preprocessor!49
2021-08-16 12:09:37 +02:00
Sébastien Villemot 0a6b71a375
Bump version number 2021-07-23 15:40:27 +02:00
Sébastien Villemot bb19d98712 Merge branch 'results_file' into 'master'
Move results file to output folder

See merge request Dynare/preprocessor!48
2021-07-23 11:58:46 +00:00
Johannes Pfeifer 361b789e88 Move results file to output folder 2021-07-22 19:36:12 +02:00
Sébastien Villemot 5cfe6303e2
Cosmetic changes 2021-07-22 16:49:59 +02:00
Sébastien Villemot 30972e44ef Merge branch 'smoother2histval' into 'master'
Introduce option consider_all_endogenous_and_auxiliary

See merge request Dynare/preprocessor!46
2021-07-22 10:21:03 +00:00
Johannes Pfeifer 5da01faa74 Introduce option consider_all_endogenous_and_auxiliary 2021-07-22 11:49:36 +02:00
Sébastien Villemot 2fc8b71ac6
CI: bump Julia and Boost/Windows versions 2021-07-21 20:16:19 +02:00
Sébastien Villemot e1f7d8c735
VAR models: add a parameter representing the constant in the development of the pac_expectation operator 2021-07-21 17:53:55 +02:00
Sébastien Villemot da9e0acc2d
VAR models: add a parameter representing the constant in the development of the var_expectation operator 2021-07-21 17:53:55 +02:00
Sébastien Villemot 1a5fb4d5e6
DynamicModel: make PAC data members private 2021-07-21 17:53:55 +02:00
Stéphane Adjemian (Ryûk) 8305b94d29
Fix constant definition in reduced form VAR. 2021-07-21 17:53:55 +02:00
Stéphane Adjemian (Ryûk) c6a7d56b36
Fix constants in var model (it has to be a vector). 2021-07-21 17:53:55 +02:00
Sébastien Villemot a6add6127b
VAR models: output vector of constants in varmatrices.m 2021-07-21 17:53:54 +02:00
Sébastien Villemot 1cf03a5f07
Cosmetic improvement 2021-07-21 17:53:54 +02:00
Sébastien Villemot 5498ce98ee
Use NumConstNode* type for DataTree constants (previously they were just expr_t) 2021-07-21 17:53:54 +02:00
Sébastien Villemot 15d7432105
Occbin: add more sanity checks on expressions in “occbin_constraints” block
— forbid leads and lags
— forbid expectation operators

This is implemented by moving the occbin_constraints expression to a separate
DataTree. As a side-effect, this removes the spurious non-linearity warning in
a stochastic context (because we were introducing inequalities and abs()
operators in the main DynamicModel tree).
2021-07-21 16:33:23 +02:00
Sébastien Villemot ed31d1cb5e
Remove unused functions 2021-07-21 16:33:23 +02:00
Sébastien Villemot 6ae3d3131f
Occbin: handle external functions in “occbin_constraints” 2021-07-21 16:33:19 +02:00
Sébastien Villemot 0d6eb053d4
Ensure that “pac_expectation” operators are never inserted into a static model
The implementation of PacExpectationNode::toStatic() did not make sense. It
should normally never be called, hence we error out at this point.

Also do a cosmetic change in the PacExpectationNode::clone() methode.
2021-07-21 16:33:14 +02:00