Commit Graph

789 Commits (8b6e42559de6aa560ce424684b1f987fb25f0f92)

Author SHA1 Message Date
Houtan Bastani fb8a26f877
dragonfly: support ProgramConfig config file option 2020-02-13 18:35:56 +01:00
Houtan Bastani f022f666b7
dragonfly: support ProgramPath config file option 2020-02-13 17:47:15 +01:00
Houtan Bastani ac4749edf9
add undocumented `gui` option to preprocessor 2020-02-12 12:32:40 +01:00
Houtan Bastani 14be6bad00
occbin: support occbin tags in equation tags, add occbin_likelihood and occbin_smoother as options to estimation 2020-02-11 14:24:06 +01:00
Houtan Bastani f9a7d8ded3
make loop variables const 2020-02-06 16:09:03 +01:00
Houtan Bastani de6ca5cdcc
Combine `DynareMain.cc` and `DynareMain2.cc` 2020-02-05 16:27:40 +01:00
Houtan Bastani 1dbbd87d3d
Remove options `noemptylinemacro` and `nolinemacro`; add option `linemacro`
This only concerns the situation when `savemacro` is also passed.

When `linemacro` is passed, the macro expanded .mod file is the same as before

When `linemacro` is not passed, the macro expanded .mod file is equivalent to what it was before when both `noemptylinemacro` and `nolinemacro` were passed.

closes #44
closes #45
2020-02-05 15:19:01 +01:00
Sébastien Villemot c4a9f93d40
Do not allow the estimation of a parameter that appears in “planner_discount”
Ref. dynare#1173
2020-02-04 17:49:53 +01:00
Houtan Bastani 12296b620f
macro processor: fix bug in file reported when error encountered after a file has been included
closes #42
2020-02-04 11:12:41 +01:00
Houtan Bastani 6284e991fc
macro processor: remove unnecessary type specifiers 2020-02-04 11:12:41 +01:00
Sébastien Villemot ee972d9638
Fix “planner_discount” option of “discretionary_policy”
Since fe0c781c06, the discount factor would
always be equal to one.

Ref. dynare#1699
2020-01-30 15:42:39 +01:00
Houtan Bastani 3fec11b183
code simplifications 2020-01-30 14:55:39 +01:00
Houtan Bastani 148aa9d924
macro processor: simplify handling of `@#define` 2020-01-29 14:52:01 +01:00
Stéphane Adjemian (Charybdis) 2479a2a78c
Fixed bug introduced in 985d742.
If a float smaller than one in absolute value is written without a
leading zero in the mod file, for instance as `.5`, we really need to
prefix the number with a zero. The simplest approach is to convert
the strings representing the numerical constants into floats.
2020-01-28 18:11:55 +01:00
Stéphane Adjemian (Charybdis) 985d742381
Removed prefixing of doubles between -1 and 1 with 0.
This resulted in values like `00.018` in the AST's NumConstNode which
cannot be read by some JSON readers (e.g. Mathworks' jsondecode).
2020-01-27 16:45:21 +01:00
Sébastien Villemot bef537d40a
Do not simplify constant equations which have a tag attached
In particular, in the case of an 'mcp' tag, this could lead to a convergence
failure.

Ref. dynare#1697
2020-01-27 16:09:05 +01:00
Sébastien Villemot 0f3f6a2332
Add comments and simplify code in function that parses the --+ options: … +-- line 2020-01-23 18:45:02 +01:00
Houtan Bastani c6a52fd778
macro processor: c++ modernization 2020-01-21 15:43:25 +01:00
Houtan Bastani fa2f6c9206
macro processor: use `map.count()` instead of `map.find()` 2020-01-21 15:41:25 +01:00
Houtan Bastani 3c546ddb20
macro processor: declare function const 2020-01-21 15:41:08 +01:00
Sébastien Villemot a8b7bd31c5
Fix bug introduced in use_dll mode in 23a08a3662
Ref. #40
2020-01-20 18:33:31 +01:00
Sébastien Villemot b0c819cb03
Compute 3rd order dynamic derivatives for “dynare_sensitivity(identification)”
Ref. #40
2020-01-20 17:26:31 +01:00
Sébastien Villemot 23a08a3662
Ensure that dynamic model files contains all the derivatives that have been computed
Previously, there could be a discrepancy if the order mandated by
“identification” was less that the one mandated by “stoch_simul”.

Ref. #40
2020-01-20 17:22:32 +01:00
Sébastien Villemot 1c44baea05
New option “filtered_theoretical_moments_grid”, that supersedes “hp_ngrid”
The old option is left for backward-compatibility purposes, but it has the same
effect as the new one.

Ref. dynare#1093
2020-01-20 16:21:25 +01:00
Houtan Bastani e9049aa81f
use prefix notation `R"()"` for quote in quotes 2020-01-16 16:24:21 +01:00
Houtan Bastani 6d1c2ca82b
macro processor: allow colon-separated arrays as command-line defines
colon-separated command line arguments such as
```
dynare <<.mod file>> -DA=1:5 -DAA=1:2:5
```
are now translated as:
```
@#define C = [2, 3, 4, 5, 6]
@#define CC = [2, 5]
```
2020-01-16 16:24:21 +01:00
Houtan Bastani f00d7c4b4c
macro processor: fix bug where command line arguments that began with an integer were being treated as integers even if they weren't (e.g. dates) 2020-01-16 13:09:42 +01:00
Johannes Pfeifer a70511e057 Add xls_sheet and xls_range options to calib_smoother 2020-01-13 11:36:31 +00:00
Houtan Bastani 15df06bf29
fix bug in writing equation tags in latex output; special characters (`& % $ # _ { } ~ ^ \`) were not escaped 2020-01-07 15:59:01 +01:00
Houtan Bastani 70c3d478ba
add newline after equation tag in latex output 2020-01-07 15:58:58 +01:00
Houtan Bastani acdfeb4ee6
simplify calls to `symbol_list.checkPass` 2020-01-07 15:58:30 +01:00
Houtan Bastani d2860c4f6b
place braces directly around latex name
issue dynare#263
2020-01-07 15:58:00 +01:00
Sébastien Villemot 4e2538a2a2
Ensure original tags and line numbers are preserved with ramsey_model
In particular, introduce a method for clearing all equations, so that tags and
line numbers are also cleared.

Ref. dynare#1685
2020-01-06 18:26:35 +01:00
Houtan Bastani 05f00aa33f
fix bug causing equation tags to be ignored when casting to StaticModel 2020-01-06 16:05:22 +01:00
Houtan Bastani 98a9c88880
Allow `dynasave` and `dynatype` to support exogenous variables in their var_list
issue dynare#1691
2020-01-06 10:52:18 +01:00
Houtan Bastani 54f73e0864
Symbol List check pass: allow caller to specify the valid types of variables in a Symbol List
dynare#1355
2019-12-23 21:16:00 +01:00
Houtan Bastani f2271eb806
Partial reversion of global indentation of macro processor header files introduced in e2d5a83592
The global indentation introduced in e2d5a83592 made the macro processor header files difficult to read. Revert spacing changes that made simple, inline, one-line functions take up 5 lines making headers tougher to read. Similary change for constructors, not to place each brace on an individual line.
2019-12-23 19:39:34 +01:00
Sébastien Villemot e2d5a83592
Global reindentation 2019-12-20 16:59:30 +01:00
Houtan Bastani 42106f85a8
det_cond_forecast: fix output aesthetics
- remove semicolon after `end`
- don't test for existence of `oo_`
- fix spacing to conform with MATLAB/Octave spacing

issue #39
2019-12-20 14:51:16 +01:00
Houtan Bastani 0cd59dbcf8
bug fix: clear symbol list and options list after call to `DetCondForecast` constructor
issue #39
2019-12-20 14:51:16 +01:00
Houtan Bastani 9d3be05a2d
remove superfluous comma 2019-12-20 14:51:16 +01:00
Houtan Bastani 76b461de4a
organize function with other members of the same class 2019-12-20 14:51:16 +01:00
Houtan Bastani 32c3910e18
allow symbol list to accept auxiliary variables
dynare#1355
2019-12-20 14:51:15 +01:00
Houtan Bastani 137dc31bb0
remove unnecessary headers 2019-12-20 12:49:23 +01:00
Sébastien Villemot 5f451ebc99
Cosmetic fixes to 8baec1e0ec
Ref. #1673
2019-12-20 11:48:50 +01:00
Sébastien Villemot 82c2682bb2
New “with_epilogue” option of “shock_decomposition”, “realtime_shock_decomposition” and “initial_condition_decomposition”
Ref. dynare!1688
2019-12-20 11:47:54 +01:00
Sébastien Villemot ebafd8f3b6
Epilogue: always initialize M_.epilogue_names and M_.epilogue_var_list_
Ref. dynare!1688
2019-12-20 11:47:54 +01:00
Stéphane Adjemian (Charybdis) 8baec1e0ec Allow k order estimation.
Automatically switch to k_order_solver if order>2. Use old mex file if
order==2 (since it seems unexpectedly significantly faster than
local_state_space_iteration_k, and because it can deal with pruning).
2019-12-20 11:15:16 +01:00
Sébastien Villemot d441ff059a
Fill the “M_.aux_vars(:).orig_expr” field for all auxiliary variables
This field contains a string representation of the expression that the
auxiliary variable replaces.

It is non-empty for all auxiliary variables, except for Lagrange multipliers.

Ref. dynare#773
2019-12-19 16:58:26 +01:00
Sébastien Villemot 8b23a2d575
Fix incorrect static model when “diff” operator is present
The “diff” operator was incorrectly replaced by its argument in the static
model, leading to an incorrect result for the steady state.

This is because the information contained in the “expr_node” field of the
auxiliary variables storage was not consistent across all types of auxiliary
variables: for a “diff()” operator, it would contain the argument of the
operator, instead of the full node. Hence it would not simplify to zero at the
steady state.

A similar inconsistency was also present for the “expectation()” operator,
though it was not leading to an incorrect static model.
2019-12-19 16:50:40 +01:00
Sébastien Villemot 044258b0a2
Make “datafile” option of “perfect_foresight_setup” (and “simul”) equivalent to “initval_file”
Ref. dynare#1663
2019-12-19 14:53:52 +01:00
Sébastien Villemot d1d244086d
Remove spurious spaces within parentheses in generated MATLAB code 2019-12-18 17:35:25 +01:00
Sébastien Villemot fe0c781c06
New “planner_discount_latex_name” option of “ramsey_policy”
Accepts a TeX name, as for variable declarations (i.e. enclosed within dollar
signs).

Ref. dynare#1686
2019-12-18 17:32:41 +01:00
Sébastien Villemot 1a08cdf01a
BinaryOpNode::findConstantEquations(): fix bug related to nested if/else
In the absence of braces, the last “else” clause is always associated with the
closest “if”, which is not what was intended here. The indentation was
misleading.
2019-12-18 16:32:59 +01:00
Houtan Bastani a4ef5a01d3
Epilogue: handle case where `dseries.firstobservedperiod` ends in an error
issue #36
2019-12-18 15:54:50 +01:00
Houtan Bastani 4f20b1146e
Epilogue static file: handle case where RHS is not a dseries
issue #36
2019-12-18 15:50:37 +01:00
Houtan Bastani e2d9e179a2
Include missing header 2019-12-18 15:43:49 +01:00
Houtan Bastani 86c79250cf
Make iterator const 2019-12-18 15:43:49 +01:00
Houtan Bastani 653b2477db
Update for bison 3.5 2019-12-18 15:43:48 +01:00
Houtan Bastani 87870eaae8
Epilogue: remove +1
issue #36
2019-12-18 15:43:48 +01:00
Houtan Bastani efb2752e4e
Ramsey: fix bug: symbol_list is not passed to RamseyPolicy statement when it was not passed options 2019-12-18 12:07:59 +01:00
Sébastien Villemot c2461981d2
Various provisions for improvements to shock decomposition commands
– New “squeeze_shock_decomposition” command
— New “max_nrows” option to “plot_shock_decomposition” and
  “initial_condition_decomposition”
— “plot_shock_decomposition” now returns oo_ as an output argument

Ref. dynare#1687, dynare!1655
2019-12-18 11:39:44 +01:00
Sébastien Villemot 031c0cff5f
Various code simplifications and modernizations 2019-12-16 19:42:59 +01:00
Sébastien Villemot 97fa005b33
Use 1-based indexing in M_.nonzero_hessian_eqs 2019-12-13 22:31:49 +01:00
Sébastien Villemot 141cff0761
New field M_.endo_trends
For each endogenous variable, gives the deflator and the growth factor (as well
as the “log” versions).

Ref. dynare#1648
2019-12-13 18:02:37 +01:00
Sébastien Villemot 2af26ee2c2
Ramsey: use information from transformed model for filling M_.nonzero_hessian_eqs
Since commit 9c9e8f816f, it’s the information
from the original model which was in this field, which is not what is expected.

By the way, do not output this field (and the related M_.hessian_eq_zero) when
the Hessian is not computed by the preprocessor (i.e. in practice for perfect
foresight), since they would otherwise contain incorrect information.

Ref. dynare#1681
2019-12-13 18:02:35 +01:00
Houtan Bastani 2646f01424
fix quotes from 7958f76fae 2019-12-13 16:03:37 +01:00
Houtan Bastani fddfb7fe2f
Issue deprecation warning for `simul`
closes dynare#1683
2019-12-13 16:01:47 +01:00
Houtan Bastani c1b8cdf811
epilogue: simplify _static file
issue #36
2019-12-12 16:32:12 +01:00
Sébastien Villemot b58bbb8e84
Ramsey: do not warn if instruments are not defined in steady_state_model block
Closes: dynare#1677
2019-12-12 16:19:15 +01:00
Sébastien Villemot 047b397899
Simplify x+y-y in x
Note that this actually corresponds to 4 different abstract syntax trees:
— (x+y)-y
— (y+x)-y
— (x-y)+y
— y+(x-y)
2019-12-12 16:19:15 +01:00
Sébastien Villemot d747b53a8b
Simplify x*y/y in x
Note that this actually corresponds to 4 different abstract syntax trees:
— (x*y)/y
— (y*x)/y
— (x/y)*y
— y*(x/y)
2019-12-12 16:19:15 +01:00
Sébastien Villemot 50275f3588
Simplify x-(-y) in x+y 2019-12-12 16:19:15 +01:00
Sébastien Villemot f24f28b2b2
Simplify x/(1/y) in x*y 2019-12-12 16:19:15 +01:00
Sébastien Villemot 1d3265acb7
C++17: further code simplifications (assignments in if) 2019-12-12 16:19:14 +01:00
Houtan Bastani 44adcbb488
epilogue: replace `dseries__` with `ds` making the file easier to read 2019-12-12 14:46:45 +01:00
Houtan Bastani dfcd381d20
epilogue: fix bug with external functions in `epilogue` block
issue #36
2019-12-12 14:45:49 +01:00
Houtan Bastani 7958f76fae
issue deprecation warning for `ramsey_policy`
dynare#1678
2019-12-12 11:36:43 +01:00
Houtan Bastani 8dfa79a0f5
new command `evaluate_planner_objective`
dynare#1678
2019-12-12 11:35:26 +01:00
Houtan Bastani 5430bb4bc6
simplify for statement 2019-12-11 16:21:18 +01:00
Houtan Bastani 4111bc8cfc
epilogue: create _dynamic and _static files
#36
2019-12-11 16:17:54 +01:00
Houtan Bastani 34a41b557d
epilogue: output endogs used in epilogue equations
#36
2019-12-11 15:51:26 +01:00
Houtan Bastani 41d38551e5
write names of epilogue variables 2019-12-11 15:51:26 +01:00
Houtan Bastani 3694fc40b3
detrend epilogue equations 2019-12-11 14:45:47 +01:00
Houtan Bastani 8dc70602c8
macro processor: move evaluation of all arguments for unary, binary, and trinary ops into their switch cases 2019-12-10 16:33:32 +01:00
Houtan Bastani 952e899f3a
fix bug in macro processor ensuring short-circuit functionality of `||` and `&&` statements
closes dynare#1676
2019-12-10 16:30:11 +01:00
Sébastien Villemot 5c081db76f
Add option “colormap” to “initial_condition_decomposition” command.
Ref dynare#1586
2019-12-09 15:43:39 +01:00
Sébastien Villemot 8962a9d589
Windows: apply the workaround for +<basename> removal to +objective subfolder
Because MATLAB under Windows maintains a lock on the “+<basename>” subdirectory,
we use a workaround consisting in first renaming the directory, then deleting
it.

But this is not enough when the “ramsey_policy” command is used, because the
latter creates a “+objective” subfolder inside “+<basename>”, on which MATLAB
also maintains a lock.

The fix consists in recursively using the same workaround as for the top-level
directory: renaming before deleting.
2019-12-06 15:19:23 +01:00
Houtan Bastani 3f3ef7ca00
fix bugs in initial_condition_decomposition statement
closes #37
2019-12-06 10:40:44 +01:00
Houtan Bastani 2814f05a67
Add flag to compilation of flex file
Without this flag flex errors out because it hits a hard-coded size limit
2019-12-04 16:57:20 +01:00
Houtan Bastani 02cb4cc973
add compiler statement
Allows the user to set the compiler, flags, and libs to be used with `use_dll`

Issue #35
2019-12-04 16:57:20 +01:00
Houtan Bastani bf56d6fb82
fix LaTeX output for sqrt, exp, sin, cos, tan 2019-12-04 11:26:30 +01:00
Houtan Bastani 2db2133796
fix bugs with cbrt
- it was not handled in the model block
- output was incorrect for MATLAB/Octave and LaTeX
2019-12-04 11:10:19 +01:00
Houtan Bastani abbdbb5862
Clarify part of code 2019-12-03 16:42:38 +01:00
Sébastien Villemot 23ff36a0dd
Systematically compute recursive ordering of auxiliary equations
Auxiliary equations appearing in set_auxiliary_variables.m and
dynamic_set_auxiliary_series.m need to appear in recursive ordering, since
those files are used for sequential evaluation.

Previously, the recursive ordering was guaranteed by a set of ad hoc rules and
workarounds, but that would not cover certain edge cases.

With this commit, the recursive ordering is systematically computed, using a
topological sort on the directed acyclic graph whose vertices are auxiliary
equations and whose edges are dependency relationships.

Closes: #22
2019-12-03 14:26:13 +01:00
Houtan Bastani 4a1fb239da
Add interface for init2shocks
Dynare/dynare#1650
2019-12-02 13:58:44 +01:00
Houtan Bastani de3de15249
add nograph option to plot_shock_decomposition
closes #30
2019-11-29 14:58:42 +01:00
Dóra Kocsis f11048f2dc Pass oo_ as function input for plot_icforecast. Dynare/dynare#1672 2019-11-29 12:17:02 +01:00
Sébastien Villemot d008113d69
Forbid exogenous and exogenous deterministic variables in STEADY_STATE operator
Closes: dynare#825
2019-11-27 17:27:04 +01:00
Sébastien Villemot 61ea8811de
Remove the undocumented and confusing “linear” option of stoch_simul
Closes: #33
2019-11-27 15:08:56 +01:00