Commit Graph

358 Commits (5fe94ed6069da3a7611086d15149322e53f1347d)

Author SHA1 Message Date
Sébastien Villemot 5fe94ed606
Simplify constant equations also in equations marked [static]
The simplifyEquations() methods had to be moved to DynamicModel, in order to
access the static_only_equations member.
2021-12-06 17:17:37 +01:00
Sébastien Villemot fe974c4c31
When looking for unused endos/exos, also search in equations marked [static] 2021-12-06 17:17:37 +01:00
Sébastien Villemot 8d4cab6fe3
Substitute model-local variables in equations marked [static] 2021-12-06 17:17:27 +01:00
Sébastien Villemot 7b8fc8edb7
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.
2021-12-06 12:59:21 +01:00
Sébastien Villemot a210a8fd59
Add several types of auxiliary variables to M_.mapping
In practice, only those auxiliary variables which do not have an orig_symb_id
will be listed (in addition to unary ops, due to an implementation bug).
2021-11-24 11:27:17 +01:00
Sébastien Villemot 2282d4773c
PAC: new auxiliary variable type for pac_expectation operator
Also add the new equation to auxiliary equations in the backward case (but not
in the MCE case, since that equation is recursive).
2021-11-23 14:31:03 +01:00
Sébastien Villemot ae242770f9
PAC: in the backward case, unify h0 and h1 parameters vector into a single vector
There is no reason to keep this distinction.

Additionally, since the data structure is now symmetric with the MCE case,
unify this “h” parameter vector with the “α” parameter vector.
2021-11-23 14:31:03 +01:00
Sébastien Villemot 0f89569f7e
PAC: in the backward case, create an aux. var. for the pac_expectation expression
By the way, refactor the MCE case by merging two routines related to the Z₁ aux. var.
This restores the symmetry with the backward case, now that the latter also has
an aux. var. for the pac_expectation operator. Also store the aux. var. IDs in a
structure common to the backward and MCE cases.
2021-11-23 14:31:03 +01:00
Sébastien Villemot 0e62206203
PAC: drop support for multiple PAC equations associated to a given PAC model 2021-11-23 14:31:02 +01:00
Sébastien Villemot 1041f205ea
PAC: trap a few more cases when an auxiliary param conflicts with a declared one 2021-11-09 15:48:59 +01:00
Sébastien Villemot 37a6ed6261
PAC: rethink the relation between PacModelTable and DynamicModel classes 2021-10-29 14:11:30 +02:00
Sébastien Villemot 127361971f
PAC: refactor with new PacModelTable that replaces PacModelStatement(s)
Incidentally, the auxiliary endogenous variable representing Z₁ and created for
PAC MCE models no longer necessarily appear as the first auxiliary variable (so
this is effectively a revert of 64f55e4a5e).
2021-10-29 14:11:30 +02:00
Sébastien Villemot 5bef185370
PAC: add growth correction term for definition of Z₁ in the MCE case 2021-10-25 17:28:01 +02:00
MichelJuillard 561bee0790 add NNZderivatives to JSON + use AbstractVector for Julia functions 2021-10-06 17:45:11 +02:00
Sébastien Villemot 78e295115a
PAC: better error message in case of name conflict for the growth neutrality correction parameter 2021-10-06 16:41:09 +02:00
Sébastien Villemot 784dd4122a
PAC: generate the “growth_neutrality_param_index” MATLAB field for MCE models
Previously it was only generated in the case of backward PAC models.
2021-08-31 17:54:20 +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 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 ebd9954d33
Occbin: new syntax for constructing multi-regime equations
Ref. #68
2021-07-20 18:18:24 +02:00
Sébastien Villemot 08ac455fcd
Implement “occbin_constraints” block
Consequently drop “occbin” option to “model”.

Incidentally, allow more values in equation tag names (previously some keywords
such as “alpha” were disallowed).

Ref. #68
2021-07-16 11:34:27 +02:00
Sébastien Villemot 365fb27f3d
New “structural” option to “var_model”
As the name implies, this option allows contemporaneous variables on the RHS.

The A0 matrix for contemporaneous variables is added as a second (optional)
output to the generated var_ar.m file. Note that for reduced-form VAR, this
matrix will be the identity.

Also, the user is now allowed to write the VAR models in a more flexible form:
the LHS must still be a single variable, but the RHS can be an arbitrary
expression (as long as it is linear, obviously). Internally, the preprocessor
now uses derivation to compute the coefficients of the AR and A0. This change
applies to both reduced-form and structural VAR models.

Ref. dynare#1785
2021-07-08 12:55:47 +02:00
Sébastien Villemot 67f4777ac3
Remove support for obsolete syntax: var_model(order = 2) X Y Z; 2021-07-07 18:26:09 +02:00
Sébastien Villemot 4cc22897b7
Cosmetic improvements 2021-07-06 19:09:25 +02:00
Sébastien Villemot 8df34c1ca5
VAR and trend component models: improve sanity checks on lead/lags on RHS
In particular, forbid lagged exogenous.
2021-07-06 18:52:38 +02:00
Sébastien Villemot 5a33699f03
VAR / trend component models: cosmetic changes 2021-07-01 17:52:05 +02:00
Sébastien Villemot 74ef3457b4
Use secure URL for link to GNU licenses 2021-06-09 17:21:00 +02:00
Sébastien Villemot c5f9ae89e7
Implement new “occbin” option to “model” block
For the time being, the preprocessor will refuse that this option be used with
any command other than estimation.

By the way, remove occbin_likelihood and occbin_smoother options to estimation.

Ref. dynare#569
2021-05-31 10:00:59 +02:00
MichelJuillard 9773bafc5b Julia: write definition of get_power_deriv inside generated static/dynamic files 2021-04-26 10:52:18 +00:00
Sébastien Villemot dca294de3a
Julia: refactor the auxiliary variable/series files
— rename the files with camel case
— encapsulate the functions with modules
— change the signature of function <MODFILE>_dynamic_set_series!, by removing
  the output argument and appending the exclamation mark, since this function
  modifies one of its arguments, and for symmetry with the static version

Ref. DynareJulia/Dynare.jl#1
2021-04-23 17:57:33 +02:00
Sébastien Villemot 4354d8a578
Julia: do not overwrite steady state / auxiliary variables/series files if contents has not changed
Ref. DynareJulia/Dynare.jl#1
2021-04-23 17:56:54 +02:00
Sébastien Villemot 4cfc7a563b
Julia: do not overwrite Static/Dynamic files if contents has not changed
Ref. DynareJulia/Dynare.jl#1
2021-04-22 18:03:47 +02:00
Sébastien Villemot 81b1d02748
Julia: fix typo in StatsFuns package name
Ref. DynareJulia/Dynare.jl#1
2021-04-22 15:48:25 +02:00
Sébastien Villemot 1f17528383
Julia: update dependencies of Static/Dynamic modules
Ref. DynareJulia/Dynare.jl#1
2021-04-19 17:02:46 +02:00
Sébastien Villemot c2d47fb48e
Julia: remove driver file
The Julia code now uses the JSON output for retrieving the information that
previously was in the driver file.
2021-04-19 17:02:41 +02:00
Michel Juillard fd979f625a
add maximum lead and lag to modfile.json 2021-04-01 17:05:13 +02:00
Sébastien Villemot 4798a5e2bc
Cosmetic change 2021-02-19 20:09:48 +01:00
Sébastien Villemot d3e115194b
Fix output write_latex_original_model for model-local variables
Those variables were substituted out by early substitution methods (which are
also called on the original model, for an unknown reason).

Closes: #65
2021-02-19 17:45:02 +01:00
Sébastien Villemot 2781e3e6f6
A few modernizations using clang-tidy 2021-02-10 16:48:46 +01:00
Sébastien Villemot 89e2daf7c7
C++17 modernization: convert the remaining enums to enum classes 2021-02-01 12:05:06 +01:00
Sébastien Villemot af9bd8f109
Remove the unfinished decomposition in linear and nonlinear blocks
Also remove the det_cond_forecast interface, that was related to it.

Ref. dynare!1626
Closes: #39
2021-01-25 18:03:37 +01:00
Sébastien Villemot bf1da3c6fb
JSON output: fix logic in “variable_mapping” that could lead to invalid JSON formatting
Ref. dynare#1755
2020-12-09 16:47:55 +01:00
Sébastien Villemot cfb41d291c
Substitute out model-local variables early in the model transform pass
Incidentally, this makes it possible to use model-local variables with either
the “block” or “bytecode” option. (Ref: dynare#1243)
2020-11-10 18:07:57 +01:00
Sébastien Villemot 1e419a48e4
Remove unused function 2020-11-10 18:02:06 +01:00
Stéphane Adjemian (Charybdis) abf5a6553b
Removed useless subfield (only julia output).
TODO: Check that we can do the same in the matlab version…
2020-10-21 18:16:07 +02:00
Sébastien Villemot d2cbe2a19e
PAC model: fixes to M_.pac.MODEL.ar (information about autoregressive part)
– Fix order of items in this structure. Previously, items were ordered
  according to the declaration order of parameters. Now, items are order
  according to lag order (first lag appears first)
– Gracefully handle the case where there is no autoregressive part
  (Closes: #52)
2020-10-16 16:31:51 +02:00
Sébastien Villemot 740ea833f6
Block decomposition: bugfix for solve one boundary blocks with mfs>0
Ref. dynare#1726
2020-10-07 18:55:19 +02:00
Sébastien Villemot 4560639eb4
Block decomposition: fix evaluation of recursive variables in solved blocks
Ref. dynare#1726
2020-10-06 18:30:34 +02:00
Sébastien Villemot 5979885714
Block decomposition, chain rule derivation: code improvement 2020-10-02 18:31:55 +02:00
Sébastien Villemot feee0ffa12
PAC model: better error message when pac_expectation refers to a non-existent pac_model
Closes: #53
2020-09-10 14:24:20 +02:00