Commit Graph

76 Commits (master)

Author SHA1 Message Date
Johannes Pfeifer 46d7e155d9 send_endogenous_variables_to_workspace.m and friends: output column instead of row vectors 2024-01-05 11:47:35 +01:00
Johannes Pfeifer 48380a1370
Do not assign variables to base workspace by default
Related to https://git.dynare.org/Dynare/preprocessor/-/issues/95
2023-12-18 11:51:27 +01:00
Sébastien Villemot c3d91d5ce8
Fix marginal linearization in the context of perfect_foresight_with_expectation_errors_solver with homotopy
If a solution corresponding to 100% of the shock can’t be found in the first
informational period, marginal linearization will be performed to extrapolate a
solution.

However, in subsequent informational periods, this extrapolated solution cannot
be used for the initial conditions of endogenous variables, because the initial
conditions are not a true solution of the nonlinear model. For those subsequent
informational periods, the correct approach is to compute the two solutions
needed for marginal linearization using as initial conditions the values
obtained in the same two solutions for the previous informational
periods (stored as oo_.deterministic_simulation.{sim1,sim2}).
2023-11-28 16:26:49 +01:00
Sébastien Villemot 0e5f9defbc
Preprocessor: error out if an “initval” block appears after an “endval” block
Ref. preprocessor#104
2023-11-14 17:45:54 +01:00
Sébastien Villemot 896c48eba7
Testsuite: move some files for more consistency in tests file structure 2023-10-23 17:00:01 +02:00
Sébastien Villemot 8c3429bb0f
Perfect foresight with expectation errors: change the semantics of endval(learnt_in=…)
Similarly to the regular “endval” block, any variable mentioned in this
block will jump to its new value in the period where the information is learnt.
In particular, this means that any temporary shock that may have been
anticipated on that variable (as specified through a “shocks(learnt_in=...)”
block for a previous informational period) will be overwritten.
2023-10-20 16:05:56 -04:00
Sébastien Villemot df9c7d85b8
Error out if perfect_foresight_solver is called with shocks(learnt_in=…) or endval(learnt_in=…) blocks
This is to prevent the accidental use of the regular perfect foresight solver
when one actually wants the one with expectation errors.
2023-10-20 16:05:53 -04:00
Sébastien Villemot 9ef3f7d0ed
Testsuite: fix test comparison value in pfwee_learnt_in.mod
It would fail on some processors, due to tiny floating point discrepancies.
2023-10-18 21:18:52 -04:00
Sébastien Villemot 5145bd0708
New option “relative_to_initval” to “mshocks” block 2023-10-18 16:45:06 -04:00
Sébastien Villemot 39f9d4352a
The “mshocks” block now accepts the “learnt_in” option 2023-10-17 17:24:15 -04:00
Sébastien Villemot d5a3a8e16a
Various improvements to perfect foresight homotopy
– new option “endval_steady” to pf_setup command to recompute terminal
  steady state in the homotopy loop

– new options “homotopy_linearization_fallback” and
  “homotopy_marginal_linearization_fallback” to pf_solver and pfwee_solver
  commands, to get an approximate solution when homotopy fails to go to 100%

– new options “homotopy_initial_step_size”, “homotopy_min_step_size”,
  “homotopy_step_size_increase_success_count” and “homotopy_max_completion_share”
  to pf_solver and pfwee_solver commands to fine tune the homotopy behaviour

– removed option “homotopy_alt_starting_point” to pf_solver command, not really
  useful

– new options “steady_solve_algo”, “steady_tolf”, “steady_tolx”,
  “steady_maxit”, “steady_markowitz” to pf_solver and pfwee_solver commands, to
  control the computation of the terminal steady state (and remove the
  equivalent options which previously had different names in pfwee_solver command)
2023-06-21 15:58:23 +02:00
Sébastien Villemot c1b78e26ac
perfect_foresight_with_expectation_errors_{setup,solver}: streamline handling of guess values
– Remove the terminal_steady_state_as_guess_value option to pfwee_solver
– pfwee_setup now sets the same guess values as pf_setup (i.e. terminal steady
  state at all periods)
– With constant_simulation_length option, pfwee_solver uses terminal steady
  state as guess values for periods that are added to the simulation
2023-06-15 15:37:48 +02:00
Sébastien Villemot c0294bb343
Testsuite: remove the simul/ folder, and move its files under {deterministic,stochastic}_simulations/
With the exception of ramst2.mod which was not run by the testsuite and has
thus been deleted.
2023-06-12 14:14:53 +02:00
Sébastien Villemot 37870e4a40
evaluate_steady_state: accept exogenous steady state as argument instead of whole oo_ structure
This is a move towards a more functional programming style.
2023-06-07 17:58:19 +02:00
Johannes Pfeifer 4837a4d444 testsuite: clean up main folder 2023-03-17 10:35:00 -04:00
Sébastien Villemot 65053667cf
New “homotopy_alt_starting_point” option to “perfect_foresight_solver” command 2023-02-07 14:49:00 -05:00
Sébastien Villemot c3524d33d0
Testsuite: replace “simul” by “perfect_foresight_setup” + “perfect_foresight_solver” 2023-02-06 15:42:34 -05:00
Sébastien Villemot 5aca770931
perfect_foresight_with_expectation_errors_{setup,solver}: fix bugs with several exogenous
Closes: #1883
2023-01-24 15:02:07 +01:00
Sébastien Villemot 1b47c8a5e5
Drop the “periods” statement 2023-01-16 16:52:40 +01:00
Johannes Pfeifer cbbbdf4b3d make_y_.m: fix interaction with steady_state_model
closes https://git.dynare.org/Dynare/dynare/-/issues/1866
2022-10-13 16:33:58 +02:00
Sébastien Villemot 06f665e231
Perfect foresight: LBJ now available under stack_solve_algo=1 (with/without block/bytecode)
Previously, LBJ was available:

– under stack_solve_algo=6 when neither block nor bytecode were present
– under stack_solve_algo=1 with either block or bytecode (but the documentation
  was not making it clear that it was LBJ)

This commit merges the two values for the option, and makes them
interchangeable. LBJ should now be invoked with stack_solve_algo=1 (but
stack_solve_algo=6 is kept for compatibility, and is a synonymous).
2022-06-15 15:06:33 +02:00
Sébastien Villemot 63a116fb28
New += and *= syntaxes in “endval(learnt_in=…)” blocks 2022-05-03 17:46:59 +02:00
Sébastien Villemot 252a592f1a
Allow “learnt_in=1” for “shocks” and “endval” 2022-04-29 15:55:57 +02:00
Sébastien Villemot a600336c92
New “add” and “multiply” keywords in “shocks(learnt_in=…)” block 2022-04-26 15:22:15 +02:00
Sébastien Villemot 8488674ce4
New shocks(learnt_in=…) and endval(learnt_in=…) blocks
For use with perfect_foresight_with_expectation_errors_setup.
2022-04-21 17:10:52 +02:00
Sébastien Villemot b70b864829
perfect_foresight_with_expectation_errors_setup: move terminal condition to last line of CSV file 2022-04-12 15:51:04 +02:00
Sébastien Villemot a8a9051b31
New option “constant_simulation_length” to “perfect_foresight_with_simulation_errors_solver” command 2022-04-12 15:45:50 +02:00
Sébastien Villemot 8d4f5fbd9b
Fix tests/deterministic_simulations/multiple_lead_lags/sim_endo_lead_lag.mod
A bug was introduced in 440a0e460b, erroneously
changing the name of the baseline for a comparison.

The bug was left unnoticed with recent versions of MATLAB and on Octave,
because the first array in the ensuing comparison had zero line, and because of
automatic broadcasting, the error message was not triggered.

However, the bug was exposed on MATLAB < R2016b.
2021-09-08 14:15:49 +02:00
Johannes Pfeifer 440a0e460b
Storage of results: use subfolder
Ref. #1758
2021-07-23 14:12:17 +02:00
Sébastien Villemot abd64c256e
New perfect_foresight_with_expectation_errors_{setup,solver} commands
These command solve the problem where agents think they know perfectly the
future (they behave as in perfect foresight), but make expectation errors.
Hence they can potentially be surprised in every period, and their expectations
about the future (incl. the final steady state) may change.

Currently the sequence of information sets needs to be passed through a CSV
file. Another interface may be added in the future.

The algorithm uses a sequence of (true) perfect foresight simulations (not
necessarily as many as there are periods, because if the information set does
not change between two periods, there is no need to do a new computation).

There are two possibilities for guess values:
— the default is to use the initial steady state for the simulation using the
  first-period information set; then use previously simulated values as guess
  values
— alternatively, with the terminal_steady_state_as_guess_value option, use the
  terminal steady state as guess value for all future periods (this is actually
  what the “true” perfect foresight solver does by default)
2021-07-09 18:16:46 +02:00
Stéphane Adjemian (Charybdis) 27ee801a67
Add specialized version of sim1 for static models.
Also add an integration test and fix homotopy error message.
2021-05-28 14:11:34 +02:00
Sébastien Villemot 62e42e08a8
Testsuite: more fixes related to stochastic block decomposition + mfs > 0
Ref. #1726
2021-05-05 10:15:52 +02:00
Sébastien Villemot ef58f1329a
Testsuite: factorize code between block decomposition tests based on LOLA model
By the way, move tests files under tests/block_bytecode/, which is a more
natural place.

Ref. #1726
2021-05-04 16:17:37 +02:00
Sébastien Villemot fcb52478e4
Preprocessor: replace exogenous with lead/lags by auxiliary variables in deterministic models
Several tests need to be adapted, because they were implicitly making the
assumption that there is no auxiliary variable.

Incidentally, this closes #1731. This commit therefore also removes the
workaround introduced in 0391dbbeb1.
2020-11-09 16:34:12 +01:00
Sébastien Villemot e7162a2a69
Block decomposition: new tests for mfs>0
Ref. #1726
2020-10-07 19:01:09 +02:00
Sébastien Villemot e5f45ef7b1
Testsuite: fix calls to fataltest.m 2020-05-13 14:58:09 +02:00
Sébastien Villemot 1ac7344e42
Rollback introduction of +get and +set folders
Under Octave, having namespaces called “get” and “set” overshadows the builtin
functions with the same names, which are needed for graphics manipulation.

Therefore we go back to the initial function naming scheme, but moving all
those functions under an “accessors” subdirectory.

Among other things, this is a revert of
e4134ab59b and
c5e86fcb59.

Ref. !1655, !1686
2019-12-19 17:20:38 +01:00
Marco Ratto e4134ab59b fixed calls to moved utilities 2019-12-17 22:26:38 +01:00
Michel Juillard cc0f2865a6 use tolf option inside simul() 2019-11-24 09:56:35 +01:00
Sébastien Villemot 42f172dec3
perfect_foresight_problem MEX: optimization for linear models
When the model is linear, there is no need to reevaluate the Jacobian for each
time period, since it is invariant.

Closes: #1662
2019-11-14 14:45:10 +01:00
Sébastien Villemot 42392df3bc
Put binary test datafiles in the git repository
This makes the testsuite robust to network failures.
2019-09-19 14:20:00 +02:00
Stéphane Adjemian (Charybdis) 64dc44740b Efficiency change. 2019-04-26 16:20:45 +02:00
Sébastien Villemot 1e5fab3881 Fix tests for stack_solve_algo=7
Completes commit db0cf1b8ea from PR #1616.
2018-06-08 10:29:53 +02:00
Johannes Pfeifer db0cf1b8ea Add unit tests for perfect foresight simulations with exogenous leads and lags
Closes #1616
2018-06-07 20:46:30 +02:00
Sébastien Villemot 79484607a7 Fix various issues with stack_solve_algo=7 and lags on exogenous > 1
Complete the fix started in 8913791ff0.

Change the test case to prevent regressions.
2018-06-07 16:14:02 +02:00
Stéphane Adjemian (Scylla) 7be8f10e0e Use cells of strings instead of char arrays. 2018-01-09 22:30:01 +01:00
Stéphane Adjemian (Charybdis) 6d6f850a49 Test the value of oo_.deterministic_simulation.status in tests/deterministic_simulations/* 2017-03-20 16:27:13 +01:00
Houtan Bastani 38f36091a9 test suite: increase timeout option for downloading files to 30 seconds 2017-03-08 12:30:58 +01:00
Johannes Pfeifer d5a6f132b5 unit tests: remove more unused exogenous variables 2017-01-10 19:58:44 +01:00
Johannes Pfeifer c5c465d675 Remove unused exogenous variables from unit tests 2017-01-08 19:00:04 +01:00