Compare commits

...

1410 Commits

Author SHA1 Message Date
Stéphane Adjemian 4f2b9b3e62 Merge branch 'smc' into 'master'
SMC: gracefully exit with unsupported options

See merge request Dynare/dynare!2278
2024-02-20 07:45:58 +00:00
Johannes Pfeifer 5d47ac2aa9 SMC: gracefully exit with unsupported options 2024-02-19 14:26:28 +01:00
Sébastien Villemot 1ce40d4df5
🐛 Steady state computation with bytecode + Ramsey policy was broken 2024-02-16 15:04:01 +01:00
Sébastien Villemot 6820edd614
Merge branch 'docker-meson' of git.dynare.org:wmutschl/dynare
Ref. !2275
2024-02-16 10:47:14 +01:00
Sébastien Villemot 4a8c78f703
Merge branch 'cosmetic' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2276
2024-02-16 10:46:30 +01:00
Sébastien Villemot 3000e6d691
Manual: cosmetics 2024-02-16 10:46:02 +01:00
Johannes Pfeifer 73d54cea04 solve_block_decomposed_problem.m: add missing semicolon 2024-02-15 10:41:39 +01:00
Willi Mutschler 1b3c1c33ce
Update Dockerfile and instructions for new meson build systems
[skip ci]
This creates the Docker containers for 5.5 and 6.0
2024-02-14 16:34:37 +01:00
Sébastien Villemot dd03d51112 Merge branch 'gsa' into 'master'
gsa: update documentation

See merge request Dynare/dynare!2273
2024-02-13 19:31:52 +00:00
Johannes Pfeifer 4a2724959d gsa: update documentation 2024-02-13 18:30:30 +01:00
Stéphane Adjemian (Argos) 24fbc0d923
Create a sparse identifty matrix when it makes sense. 2024-02-12 17:48:47 +01:00
Sébastien Villemot fd76ce53af Merge branch 'selec_posterior_draws' into 'master'
selec_posterior_draws.m: fix bug introduced when removing oo_ as an input

See merge request Dynare/dynare!2274
2024-02-12 15:58:26 +00:00
Johannes Pfeifer 6975aaef43 selec_posterior_draws.m: fix bug introduced when removing oo_ as an input
Thanks to Francesco Turino
2024-02-09 19:42:36 +01:00
Sébastien Villemot ab7d741bf1
Preprocessor: drop legacy representation for the static model
Also drop M_.NNZDerivatives_objective.
2024-02-09 10:27:19 +01:00
Sébastien Villemot 6f2af6943f
k_order_welfare MEX: use the sparse representation of the static model 2024-02-09 10:24:02 +01:00
Sébastien Villemot 0d9857e737
k_order_welfare MEX: drop ObjectiveAC abstract class, it has a single subclass 2024-02-08 14:03:03 +01:00
Sébastien Villemot adc42bb4cb
Windows and macOS packages: bump to SLICOT 5.9 pre-release 2024-02-08 11:52:49 +01:00
Sébastien Villemot 641cf6a95c
Identification: use the sparse representation of the static model 2024-02-07 13:57:26 +01:00
Sébastien Villemot a623cb1d12
Partial information: use the sparse representation of the static model 2024-02-07 13:57:24 +01:00
Sébastien Villemot 28fc9e7c78
evaluate_planner_objective: use the sparse representation of the static model 2024-02-07 13:57:24 +01:00
Sébastien Villemot d5cffba8fc
perfect_foresight_solver: use the sparse representation of the static model 2024-02-07 13:57:24 +01:00
Sébastien Villemot 3ebf824f3f
simul_static_model: use the sparse representation of the static model 2024-02-07 13:57:22 +01:00
Sébastien Villemot ec48980e1e
Cosmetics
[skip ci]
2024-02-05 09:06:12 +01:00
Sébastien Villemot ebfd2aa0a1
NEWS.md: announcement for version 6.0
[skip ci]
2024-02-02 18:32:03 +01:00
Sébastien Villemot 433f00e224
Manual: update citation of reference manual working paper 2024-02-02 18:32:03 +01:00
Sébastien Villemot d61cb124ba
Manual: add missing options to occbin_solver 2024-02-02 18:32:03 +01:00
Sébastien Villemot 05d82796c2
Manual: better documentation of solve_algo=12,14 2024-02-02 18:32:03 +01:00
Sébastien Villemot cfa978b39e
Manual: typos and cosmetics 2024-02-02 18:32:03 +01:00
Sébastien Villemot 99883d4ca6
Manual: fix capitalization of Dynare Team on front page of PDF 2024-02-01 21:51:19 +01:00
Sébastien Villemot 3053f9b7df
Discretionary policy: use the sparse representation of the static derivatives 2024-01-31 18:15:43 +01:00
Sébastien Villemot c125d35347 Merge branch 'conditional_lik_doc' into 'master'
manual: fix description of conditional likelihood

See merge request Dynare/dynare!2272
2024-01-30 10:17:07 +00:00
Johannes Pfeifer a40b0c146d manual: clarify that search requires json 2024-01-30 09:24:03 +01:00
Johannes Pfeifer 8e91841a39 manual: fix description of conditional likelihood 2024-01-29 22:54:43 +01:00
Stéphane Adjemian (Argos) f5a5ebb910
Document dplot Matlab command. 2024-01-29 20:57:58 +01:00
Sébastien Villemot 6145bf9b31 Merge branch 'annual_shock_decomp' into 'master'
annualized_shock_decomposition.m: fix bug introduced in 735bd66d

Closes #1919

See merge request Dynare/dynare!2271
2024-01-29 17:10:32 +00:00
Stéphane Adjemian (Argos) 415a86d1d9
Add example for PAC equation (with estimation). 2024-01-29 15:23:03 +01:00
Stéphane Adjemian (Argos) 8eab48aa5e
Document composite targets in PAC equation. 2024-01-29 15:23:03 +01:00
Stéphane Adjemian (Argos) 9f9f4a99ba
Throw an error if composite PAC target ∧ trend_component aux. model. 2024-01-29 15:23:03 +01:00
Stéphane Adjemian (Argos) a48a03bc67
Bug fix (wrong condition).
Also add comments about the choice for the definition of the linear
combination of the VAR companion variables.

We should test the numbe of output arguments, not the number of input
arguments. This was bug was probably not affecting the outcomes since
the number of input arguments is always greater than 1.
2024-01-29 15:23:03 +01:00
Stéphane Adjemian (Argos) 942d8846e4
Cosmetic changes. 2024-01-29 15:23:03 +01:00
Johannes Pfeifer 2ed416532b annualized_shock_decomposition.m: fix bug introduced in 735bd66d
Use dedicated indicator instead of nargout to only request decomposition; closes #1919
2024-01-29 14:42:16 +01:00
Sébastien Villemot 60e3b6a19f
Windows and macOS packages: fix installation path of x13as
The binary location had not been updated following the move of the dseries
submodule (commit e962cb4dba).
2024-01-29 14:12:38 +01:00
Sébastien Villemot 505084f20b
README.md: fix testsuite documentation for running a whole directory of tests
[skip ci]
2024-01-29 13:59:41 +01:00
Sébastien Villemot b956a2253e
C++20 modernization: use abbreviated function template syntax 2024-01-26 16:43:00 +01:00
Sébastien Villemot 00bba09986
Preprocessor / Occbin: improve messages for consistency checks for bind/relax tag 2024-01-26 12:47:02 +01:00
Sébastien Villemot 6a0ee900a4
Preprocessor / dseries: fix handling of monthly dates for months 10-12
Closes: #1918
2024-01-25 17:51:07 +01:00
Sébastien Villemot 8954a682c7
Bytecode: error out when using det_cond_forecast with perfect_foresight shocks
They’re not implemented in bytecode.

Closes: #1884
2024-01-25 12:22:48 +01:00
Sébastien Villemot 13c9acba57
Preprocessor / Occbin: add various consistency checks for bind/relax tags 2024-01-24 18:05:16 +01:00
Sébastien Villemot aee581fd0b
libkorder: make symiterator::operator== const
This fixes an ambiguity due to C++20 rewriting rules.
2024-01-24 09:52:11 +01:00
Sébastien Villemot 855e44cb17
Windows and macOS packages: bump to SLICOT 5.8 2024-01-23 12:23:57 +01:00
Sébastien Villemot 881f5f2e62
Merge branch 'dynare-gsa_qz'
Ref. !2270
2024-01-22 16:47:32 +01:00
Johannes Pfeifer b1cb309a73
gsa: add proper check for correctness of qz_criterium with unit roots
Critical for stability mapping
2024-01-22 16:47:23 +01:00
Sébastien Villemot 330542a79f
Build system: workaround for Meson bug, needed for building MATLAB Online package 2024-01-22 16:00:39 +01:00
Sébastien Villemot b2f603091a
MATLAB Online package: update build script for meson
Also, use the local git checkout instead of downloading a source tarball from
the website.
2024-01-19 20:40:56 +01:00
Sébastien Villemot 88236b1cc0
Build system: under Linux, do not try to statically link libgomp even with -Dprefer_static=true
Under Debian 12, it fails with:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/libgomp.a(team.o): réadressage R_X86_64_TPOFF32 vers symbole caché « gomp_tls_data » ne peut pas être utilisé en créant un objet partagé
2024-01-19 16:22:25 +01:00
Sébastien Villemot c14d410699 Merge branch 'gsa_recursive' into 'master'
GSA_recursive: make sure nobs is correctly set before checking for recursive estimation

Closes #1611

See merge request Dynare/dynare!2269
2024-01-17 20:05:34 +00:00
Johannes Pfeifer 619de017d6 GSA_recursive: make sure nobs is correctly set before checking for recursive estimation
Closes #1611
2024-01-17 17:35:50 +01:00
Sébastien Villemot 85c637d3d1
Manual: do not add parentheses to synopsis of functions without arguments
Closes: #1707
2024-01-17 16:31:41 +01:00
Sébastien Villemot 6fe43545d8
Remove remnants of workaround for incorrect display of macro-directives without arguments
This workaround was implemented in cd195279e9.
The zero-width spaces were inadvertently removed in
248ad18846.

Ref. #1707
2024-01-17 16:31:40 +01:00
Sébastien Villemot 6b6b648255
Manual: minor fixes to function synopses 2024-01-17 16:31:37 +01:00
Sébastien Villemot aa76e06099
Merge branch 'param_table' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2268
2024-01-17 12:09:01 +01:00
Sébastien Villemot e68be9ec55
Merge branch 'latex_doc' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2267
2024-01-17 12:08:22 +01:00
Sébastien Villemot 2c6df2b668
Merge branch 'dsge_likelihood' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2266
2024-01-17 12:08:00 +01:00
Sébastien Villemot c6c179d8dd
Merge branch 'uifigures' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2263
2024-01-17 12:06:19 +01:00
Sébastien Villemot aceebe9769
Merge branch 'variance_warning' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2261
2024-01-17 12:05:22 +01:00
Johannes Pfeifer 28df34df06 Add display_parameter_values.m utility 2024-01-16 17:25:09 +01:00
Johannes Pfeifer d7242c056d dyntable.m: cosmetic fix 2024-01-16 17:24:44 +01:00
Johannes Pfeifer 6ba9cb06e7 manual: add missing package from e5951650 2024-01-16 16:13:14 +01:00
Johannes Pfeifer bcd57142c6 dsge_likelihood.m: clarify that output is minus the posterior 2024-01-16 16:03:29 +01:00
Sébastien Villemot 6868e2f27e Merge branch 'occbin_tools' into 'master'
OccBin tools: rework codes

See merge request Dynare/dynare!2251
2024-01-12 19:09:39 +00:00
Johannes Pfeifer 248d8ae84f occbin.DSGE_smoother.m: correct figure caption 2024-01-12 18:16:30 +01:00
Sébastien Villemot 6780b9a009
Merge branch 'collect_latex' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2265
2024-01-12 17:50:35 +01:00
Sébastien Villemot 6235de3a82
Merge branch 'model_info' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2264
2024-01-12 17:50:07 +01:00
Sébastien Villemot e1833c475d
Merge branch 'gsa' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2262
2024-01-12 17:48:54 +01:00
Johannes Pfeifer e5951650d9 collect_latex_files.m: add amssymb package
required for some symbols users regularly use
2024-01-12 11:22:46 +01:00
Johannes Pfeifer 1b181fca57 OccBin tools: rework codes 2024-01-10 14:42:21 +01:00
Johannes Pfeifer 45e8ab14dc 🐛 model_info.m: fix display of lagged states
preprocessor increments lags/leads always only by lead_lag
2024-01-09 17:12:04 +01:00
Johannes Pfeifer 6bb973a0fa map_identification.m: remove unsupported morris=0 case 2024-01-09 16:03:33 +01:00
Johannes Pfeifer 23225aca1b simulated_moment_uncertainty.m: remove evalin following removal of globals
transformed steady state is not passed back anymore
2024-01-09 16:03:10 +01:00
Sébastien Villemot 2d90ef9890
Merge branch 'dynare_m' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2256
2024-01-09 15:33:37 +01:00
Sébastien Villemot 5d169d658e
Manual: update Normann’s affiliation 2024-01-09 13:08:17 +01:00
Sébastien Villemot 4683b9aeb6
C++17 modernization: add [[nodiscard]] to operator==() 2024-01-09 13:08:17 +01:00
Sébastien Villemot cb7bd0778b
C++20 modernization: drop comparison operators made obsolete by rewriting rules
The implicit conversion from Vector to ConstVector, in addition to the
rewriting rules and ConstVector::operator<=>, ensure that those are no longer
needed.
2024-01-09 13:08:17 +01:00
Sébastien Villemot 2fd4a6fac4
C++20 modernization: use new spaceship operator to simplify comparisons 2024-01-09 13:08:15 +01:00
Sébastien Villemot 2bfa311636
C++20 modernization: remove trivial != operator definitions
Those are no longer needed thanks to expression rewriting.
2024-01-09 12:12:38 +01:00
Sébastien Villemot 3ab9be71c8
🐛 k-order MEX: equality operator on symiterator had wrong name 2024-01-09 12:12:25 +01:00
Johannes Pfeifer 0187ebe0a2 Tag Dynare figures and add utility for moving figures to uitabgroup 2024-01-08 14:54:15 +01:00
Johannes Pfeifer 6ff924550c compute_variance_decomposition.m: only print warning if absolute difference is meaningful
Prevents warnings if relative difference involves division by almost 0
2024-01-07 10:24:13 +01:00
Sébastien Villemot 346ee01107
Merge branch 'beta_fixes' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2260
2024-01-05 16:12:25 +01:00
Sébastien Villemot cc02690acf
Forbid alternative 1st order solvers with k_order_solver option 2024-01-05 16:08:09 +01:00
Sébastien Villemot ffb578276e
Improve naming and description of various stack_solve_algo values
Also minor improvements to solve_algo description.
2024-01-05 16:03:19 +01:00
Johannes Pfeifer 4a7851b069 windows installer: add json-file 2024-01-05 11:50:50 +01:00
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
Sébastien Villemot f9cd465fea
Build system: don’t try to create TAGS file when not in a git working directory 2024-01-03 18:08:51 +01:00
Sébastien Villemot 53d8278d8a
license.txt: fix various issues detected by lintian 2024-01-03 17:22:49 +01:00
Sébastien Villemot 049006a1bf
Build system: install preprocessor symlink under libdir 2024-01-03 16:14:29 +01:00
Sébastien Villemot e7cd6eb408
Build system: install .m files for MS-SBVAR 2024-01-03 15:58:28 +01:00
Sébastien Villemot 0679da4cba
Build system: update list of ignored files under matlab/ 2024-01-03 15:53:38 +01:00
Sébastien Villemot a99beac083
Windows package: add missing rule for creating tarballs directory
[skip ci]
2024-01-03 10:23:53 +01:00
Sébastien Villemot 44044904c1
Merge branch 'forecast_graph' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2259
2024-01-03 10:12:57 +01:00
Sébastien Villemot b89e79862a
Merge branch 'bvar' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2258
2024-01-03 10:11:33 +01:00
Sébastien Villemot 3249d74220
Merge branch 'first_obs' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2257
2024-01-03 10:10:47 +01:00
Sébastien Villemot 8a7440c6ac
Update copyright years 2024-01-03 10:02:21 +01:00
Johannes Pfeifer 90266c0bfc gsa: decrease waitbar refresh frequency 2023-12-28 14:52:08 +01:00
Johannes Pfeifer 02d1e8d3ed forecast_graphs.m: fix wrong naming
Also removes eval
2023-12-27 20:54:43 +01:00
Johannes Pfeifer a6ad26788e BVAR: remove dedicated graph functions
one was empty, the other was moved to an inline function
2023-12-27 20:43:28 +01:00
Johannes Pfeifer 8f07f37138 🐛 makedataset.m: correct error message with first_obs specified 2023-12-27 17:51:57 +01:00
Johannes Pfeifer e9d79796cf dynare.m: cosmetic changes 2023-12-27 17:12:27 +01:00
Johannes Pfeifer b7e9d69874 dynare.m: remove redundant legacy check for file ending 2023-12-27 17:12:15 +01:00
Sébastien Villemot 7bf0395a27 Merge branch 'cet-octave-one-more-time' into 'master'
Fixes for CET tests on Octave

See merge request Dynare/dynare!2254
2023-12-22 09:17:15 +00:00
Willi Mutschler ee2545f84d
Fixes for CET tests on Octave
- the mode file was previously saved as '-v7.3', now it is '-v6'
- mode_compute=1 and additional_optimizer=1 do not work under Octave
2023-12-22 09:48:56 +01:00
Sébastien Villemot dd1669082e Merge branch 'Octave' into 'master'
graph_comparison_irfs.m: compatibility fix for Octave

See merge request Dynare/dynare!2252
2023-12-22 08:42:23 +00:00
Johannes Pfeifer 9c28f5feaf graph_comparison_irfs.m: compatibility fix for Octave 2023-12-21 21:17:53 +01:00
Sébastien Villemot 31ce155852
Bump major version number 2023-12-21 16:06:46 +01:00
Sébastien Villemot c36b695cd9 Merge branch 'get_mean' into 'master'
get_mean.m: remove globals and fix internal logic

See merge request Dynare/dynare!2250
2023-12-21 14:37:22 +00:00
Sébastien Villemot 6cad684980
Merge branch 'dynare-plot_initval_decomp'
Ref. !2249
2023-12-21 14:04:06 +01:00
Marco Ratto a4e6531420
check existence of oo_.initval_decomposition and, if absent, compute it
Closes: #1913
2023-12-21 14:03:51 +01:00
Sébastien Villemot d09a206c7c
Merge branch 'dynare-bugfixes'
Ref. !2248
2023-12-21 14:02:51 +01:00
Marco Ratto fbf62255c6
fix undefined new filter option 2023-12-21 14:02:20 +01:00
Marco Ratto e918589e02
fix undefined index j using wildcard
Closes: #1915
2023-12-21 14:02:13 +01:00
Sébastien Villemot 368c93214e
Build system: make xvfb-run optional for running the Octave testsuite
xvfb-run is a Debian-specific program.

Closes: #1892
2023-12-21 13:46:34 +01:00
Johannes Pfeifer 8deeaa7252 Add version of get_mean without globals 2023-12-21 13:41:17 +01:00
Johannes Pfeifer e3e6f4c9b4 🐛 get_mean.m: fix internal logic 2023-12-21 13:40:23 +01:00
Sébastien Villemot 5216cec249
Build system: update comment about GSL_CBLAS_LIB with newly-opened issue against Meson 2023-12-21 11:57:18 +01:00
Sébastien Villemot cae5a00e80
Windows package: bump dependencies 2023-12-21 11:20:44 +01:00
Sébastien Villemot 42e2f77e4a
Emacs mode: add IRF matching keywords 2023-12-21 11:20:27 +01:00
Sébastien Villemot 7a5684bf4b Merge branch 'bayesian_irf_matching' into 'master'
IRF Matching

See merge request Dynare/dynare!2191
2023-12-21 09:21:35 +00:00
Willi Mutschler c4bf6d079f
Add documentation for irf matching 2023-12-21 02:40:27 +01:00
Willi Mutschler c46eef685d
irf_matching: add test for interface 2023-12-21 01:49:40 +01:00
Willi Mutschler 2f07fa2921
irf_matching: adaptations for new interface 2023-12-21 01:49:40 +01:00
Willi Mutschler f14bbc73b1
preprocessor: add new matched_irfs and matched_irfs_weights blocks 2023-12-21 01:49:40 +01:00
Willi Mutschler 329f0d2d54
method_of_moments: Remove unused output from IRF Matching for GMM/SMM 2023-12-21 01:48:28 +01:00
Willi Mutschler 68b92a1ab9
method_of_moments: fixes required by changes introduced with SMC
60c0ed0180 changed:
- the call to GetPosteriorMeanVariance
2023-12-21 01:48:28 +01:00
Willi Mutschler 8987576ff5
irf_matching: make test files finish faster 2023-12-21 01:48:28 +01:00
Willi Mutschler 9148b5b210
irf_matching: add message for explosive irfs to get_error_message 2023-12-21 01:48:28 +01:00
Willi Mutschler 0b839467e6
method_of_moments: consistently use uppercases for NaN, Inf, IRFs 2023-12-21 01:48:28 +01:00
Willi Mutschler 547bdcc99b
irf_matching: fixed CET (2016) test and some cosmetical changes 2023-12-21 01:48:28 +01:00
Willi Mutschler 0787589479
method_of_moments: use / instead of filesep for latex filenames 2023-12-21 01:48:28 +01:00
Willi Mutschler 37efafe475
method_of_moments: cosmetical changes to comments and messages 2023-12-21 01:48:28 +01:00
Willi Mutschler 7f60674dae
irf_matching: Add CET (2016, Econometrica) test 2023-12-21 01:48:28 +01:00
Willi Mutschler bd3ca58727
method_of_moments: remove spurious diag(diag(x)) 2023-12-21 01:48:28 +01:00
Willi Mutschler 65f8b56fb0
irf_matching: add checks for inverse and logdet of weighting matrix 2023-12-21 01:48:28 +01:00
Willi Mutschler 2521314c39
irf_matching: make comparison graph prettier 2023-12-21 01:48:28 +01:00
Willi Mutschler 378e38c8c2
method_of_moments: remove to do list and maintaining authors 2023-12-21 01:48:28 +01:00
Willi Mutschler c59daa6139
method_of_moments: use underscore instead of camel case for variables 2023-12-21 01:48:28 +01:00
Willi Mutschler 937ee0ef77
irf_matching: add steady-state as input to irf_matching_file 2023-12-21 01:48:28 +01:00
Willi Mutschler 8515a195ab
method_of_moments: add irf_matching to run script 2023-12-21 01:48:28 +01:00
Willi Mutschler 8a29933c6e
method_of_moments: adapt comparison and display scripts for irf_matching 2023-12-21 01:48:28 +01:00
Willi Mutschler f210ffa3ae
method_of_moments: add irf_matching to print_info_on_estimation_settings 2023-12-21 01:48:28 +01:00
Willi Mutschler 20ec0a6c97
method_of_moments: add irf_matching to objective_function 2023-12-21 01:48:28 +01:00
Willi Mutschler e9871d7d47
method_of_moments: cosmetical changes 2023-12-21 01:48:28 +01:00
Willi Mutschler 459842e4f6
irfmatching: add mode_compute_irf_matching function 2023-12-21 01:48:28 +01:00
Willi Mutschler 2d8bcd6918
irfmatching: add function to translate irf_matching blocks into useful structures
This needs to be adapted once we implement an interface in the preprocessor
2023-12-21 01:48:28 +01:00
Willi Mutschler c45c0efeba
irfmatching: add options and checks to options_mom_ 2023-12-21 01:48:28 +01:00
Willi Mutschler 613b3869e1
irfmatching: add function to check for existence of irf_matching_file 2023-12-21 01:48:28 +01:00
Willi Mutschler 95bfb84014
method_of_moments: cosmetical changes to headers, comments, semicolons 2023-12-21 01:48:28 +01:00
Willi Mutschler 37c7ca2d97
method_of_moments: don't use oo_ as input 2023-12-21 01:48:28 +01:00
Willi Mutschler dedbb3be57
method_of_moments: rename Bounds to BoundsInfo 2023-12-21 01:48:28 +01:00
Sébastien Villemot d7850a2bbe Merge branch 'bugfixes' into 'master'
Bugfixes for parallel and estimation

See merge request Dynare/dynare!2244
2023-12-20 19:24:39 +00:00
Willi Mutschler b435aa7f27
Cosmetical change for use_mh_covariance_matrix
With use_mh_covariance_matrix we do not load previous simulations, but only base the proposal density on a previous run; so skip the display.
2023-12-20 18:22:41 +01:00
Willi Mutschler f8a6020d2b
🐛 Fix bug in 4a6783
options_ is missing as an input argument for compute_posterior_covariance_matrix
2023-12-20 18:22:41 +01:00
Willi Mutschler 5f1ae3bb19
🐛 Fix bugs in parallel toolbox introduced in 47af0c
1. 'fGlobalVar' was misspelled
2. Removing the eval crashes the parallel option as global variables are not passed correctly. Because it originally was an assignment where the variable named options_ was assigned to fGlobalVar.options_, but after 47af0cdewe only assign the string 'options_' stored in GlobalNames{j}.
2023-12-20 18:22:41 +01:00
Sébastien Villemot bc69f6a102
Initial scripts for packaging Dynare for MATLAB Online
[skip ci]
2023-12-20 17:24:19 +01:00
Sébastien Villemot 8b9d1d1346
Merge branch 'NK_baseline' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2245
2023-12-20 14:04:32 +01:00
Sébastien Villemot 38d1c0538a
Merge branch 'posterior_moments' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2242
2023-12-20 14:03:18 +01:00
Johannes Pfeifer 774cb18aac posterior_moments.m: do not request density if output is not used
removes indicator and replaces it by nargout-check
2023-12-20 09:14:03 +01:00
Johannes Pfeifer b215eedb4b NK_baseline.mod: set up shocks block in a way that standard deviation parameters can be estimated 2023-12-20 08:39:21 +01:00
Sébastien Villemot fb18777e58
Merge branch 'mc_analysis' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2243
2023-12-19 18:34:37 +01:00
Sébastien Villemot 311808db0a
Merge branch 'header_fix' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2241
2023-12-19 18:32:46 +01:00
Sébastien Villemot 52b92ce64d
Merge branch 'parallel' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2240
2023-12-19 18:32:24 +01:00
Johannes Pfeifer ba52789020 _mc_analysis: move all files to estimation folder for consistency 2023-12-19 14:45:29 +01:00
Johannes Pfeifer c52c21ca24 posterior moments: explicitly load required variables 2023-12-19 14:45:29 +01:00
Sébastien Villemot e649fa5494
Merge branch 'ep' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2239
2023-12-19 09:55:23 +01:00
Sébastien Villemot 346d2acbdf
Merge branch 'outputs' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2238
2023-12-19 09:54:38 +01:00
Johannes Pfeifer 278e767ea1 closeSlave.m: remove duplicated condition and restore warning 2023-12-19 09:04:27 +01:00
Johannes Pfeifer 90ced5ca47 slaveParallel.m: minor cleanup 2023-12-19 09:03:30 +01:00
Sébastien Villemot c9db9809d0
Drop unused options_.minimal_workspace 2023-12-18 20:42:16 +01:00
Sébastien Villemot 70b9d9277a Merge branch 'occbin_bugfixes_marco' into 'master'
Improvements to OccBin filtering/smoothing

See merge request Dynare/dynare!2237
2023-12-18 18:55:12 +00:00
Johannes Pfeifer 78abd68c9f EP: gracefully handle error 2023-12-18 17:08:28 +01:00
Johannes Pfeifer 4512e85cb2 Restore outputs erroneously removed in 735bd66d 2023-12-18 17:07:01 +01:00
Johannes Pfeifer d7ae0d0039 OccBin: improve consistency - Make name of opts_simul subfield homogeneous for likelihood computation and smoother - fill the new field opts_regime with init_binding_indicator init_regime_history, to avoid possible conflics with simulations done in realtime filtering steps - smoother: use init_binding_indicator and init_regime_history options set in options_.occbin.smoother 2023-12-18 16:16:50 +01:00
Marco Ratto ac346ef83d occbin.kalman_update_engine.m: embed use_relaxation and extend to work with 2 constraints 2023-12-18 16:16:49 +01:00
Marco Ratto 9b165d7785 occbin.map_regime.m: trap case where indicator is empty 2023-12-18 16:16:48 +01:00
Johannes Pfeifer 7b94310fd4 occbin.solver.m: fix header 2023-12-18 16:16:47 +01:00
Marco Ratto 8348cf009a OccBin: enhance search of filtered regime, using new kalman_update_engine.m
brute_force_regime_guess (default) and loss_function_regime_guess (optional, more time consuming) may be used to search for better solution (i.e. a solution providing better data density). Governed by options_.occbin.likelihood.number_of_initial_periods_with_extra_regime_guess
where the latter is 0 by default and can be set by user
2023-12-18 16:16:46 +01:00
Marco Ratto 75f5a463df OccBin smoother: trap realtime smoother error and use linear smoother for first guess 2023-12-18 16:16:45 +01:00
Marco Ratto e8d82ad840 Occbin: make convergence criteria for periodic solution more precise;
Also allows periodic loops to be a solution (periodic_solution_strict=false), provided regime is found that does not violate constraint in expectation AND the number of periods in violation is smaller than max allowed (periodic_solution_threshold= INTEGER)
2023-12-18 16:16:44 +01:00
Johannes Pfeifer ab6ea60967 Occbin smoother: try using smoothed shocks from linear smoother as last resort to initialize guess sequence of regimes 2023-12-18 16:16:43 +01:00
Marco Ratto 90fbb9559e 🐛 Occbin smoother: ensure all shocks are plotted with heteroskedastic_filter 2023-12-18 16:16:42 +01:00
Marco Ratto 3f1a37614f OccBin: store simul.piecewise and simul.linear in oo_.occbin.smoother, for easier post-processing of results 2023-12-18 16:16:40 +01:00
Marco Ratto ee5faf0783 🐛 Occbin smoother: set periods to the smpl size
Prevents crash if periods was too small
2023-12-18 16:16:39 +01:00
Marco Ratto cf7be44257 occbin.solver: initialize output ss to avoid crashes when call to resol fails 2023-12-18 16:16:38 +01:00
Sébastien Villemot c363355dbf
Merge branch 'obs_check' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2236
2023-12-18 15:55:20 +01:00
Sébastien Villemot d50330aad3
Merge branch 'cosmetics' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2235
2023-12-18 15:55:06 +01:00
Sébastien Villemot 380e78be53
user_has_matlab_license: fix spurious messages when toolbox is not present
This is effectively a partial revert of
735bd66d4d.
2023-12-18 15:47:45 +01:00
Sébastien Villemot 84a7b4b2cf
Merge branch 'dynare-PF_globals'
Ref. !2229
2023-12-18 11:51:46 +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
Johannes Pfeifer 3faaffacc6
perfect foresight: remove globals 2023-12-18 11:51:21 +01:00
Sébastien Villemot e9ffb16ec6 Merge branch 'model_comp_tol' into 'master'
fs2000_model_comparison.mod: increase test tolerance due to problems on some runners

See merge request Dynare/dynare!2234
2023-12-18 10:11:43 +00:00
Stéphane Adjemian (Ryûk) 4982ce06b4
Remove unnecessary square brackets. 2023-12-18 10:49:49 +01:00
Johannes Pfeifer 37e4d68264 load_m_file_data_legacy.m: fix check for correct number of observations 2023-12-18 10:30:35 +01:00
Johannes Pfeifer 4d6d4953e7 GetPosteriorParametersStatistics.m and check_bounds_and_definiteness_estimation.m: cosmetic changes 2023-12-18 09:50:18 +01:00
Stéphane Adjemian (Ryûk) c399f54581
Remove call to eval. 2023-12-18 08:57:12 +01:00
Stéphane Adjemian (Ryûk) 735bd66d4d
Remove unused output arguments. 2023-12-18 07:48:27 +01:00
Stéphane Adjemian (Ryûk) 7468a903b7
Remove initialize_dataset routine.
This routine was no longer used in other parts of the code.
2023-12-17 19:00:37 +01:00
Stéphane Adjemian (Ryûk) c841f1474c
isinf(X)~= ⇔ isinf(X). 2023-12-17 08:30:56 +01:00
Stéphane Adjemian (Ryûk) b6619b342b
Remove unused variable. 2023-12-16 23:30:43 +01:00
Stéphane Adjemian (Ryûk) fef466ef34
Remove unused variable. 2023-12-16 23:13:15 +01:00
Stéphane Adjemian (Ryûk) 52be9d08c1
Cosmetic change (do not change index value in a for-loop). 2023-12-16 23:08:29 +01:00
Stéphane Adjemian (Ryûk) 5d8861ff29
Cosmetic change. 2023-12-16 23:03:02 +01:00
Stéphane Adjemian (Ryûk) 743de7da5c
Remove increment on for-loop index. 2023-12-16 23:03:02 +01:00
Stéphane Adjemian (Ryûk) e962cb4dba
Move the dseries submodule from the modules folder.
Makes no sense anymore to keep it there since it was the only git submdule.
2023-12-16 23:02:57 +01:00
Stéphane Adjemian (Ryûk) cf4c6cdf14
Update dseries submodule (rewrite two patches). 2023-12-16 22:26:43 +01:00
Stéphane Adjemian (Guts) 7915b91fdb
Error takes sprintf like arguments directly. 2023-12-16 22:24:26 +01:00
Johannes Pfeifer 72a8d53df8 fs2000_model_comparison.mod: increase test tolerance due to problems on some runners 2023-12-15 21:44:10 +01:00
Stéphane Adjemian (Guts) 23af7f64b6
Avoid using disp(sprintf()) constructs. 2023-12-15 18:56:08 +01:00
Stéphane Adjemian (Guts) 0249ea2116
Fix bug introduced in #47af0cde1. 2023-12-15 18:07:12 +01:00
Stéphane Adjemian (Guts) 44119077db
Separate outputs with commas. 2023-12-15 16:55:24 +01:00
Stéphane Adjemian (Guts) 47af0cde16
Remove calls to eval. 2023-12-15 16:34:27 +01:00
Sébastien Villemot eb043406e6
Merge branch 'path' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2233
2023-12-15 16:32:08 +01:00
Sébastien Villemot ae082cffbe
Make function names consistent with filenames
Detected and automatically fixed by MATLAB Code Analyzer app.
2023-12-15 16:30:32 +01:00
Sébastien Villemot febd39713e
dseries: more fixes performed with MATLAB Code Analyzer app 2023-12-15 16:28:38 +01:00
Sébastien Villemot 20b2c79ffb
Remove unneeded uses of feval
Detected and automatically fixed by MATLAB Code Analyzer app.
2023-12-15 16:28:38 +01:00
Sébastien Villemot 458926b17b
Remove useless semicolons
Detected and automatically fixed by MATLAB Code Analyzer app.
2023-12-15 16:28:36 +01:00
Sébastien Villemot 162ca815bc
Replace calls to isdir by isfolder
isfolder is the modern replacement to isdir, and is available in MATLAB ⩾
R2017b and in Octave ⩾ 7.

Detected and automatically fixed by MATLAB Code Analyzer app.
2023-12-15 15:40:25 +01:00
Sébastien Villemot ff7cc9267e
Remove useless commas
Detected and automatically fixed by MATLAB Code Analyzer app.
2023-12-15 15:37:35 +01:00
Sébastien Villemot 56e97e29aa
dseries: various fixes performed with MATLAB Code Analyzer app 2023-12-15 15:31:52 +01:00
Sébastien Villemot adddcf6197
minus_logged_prior_density.m: fix syntax error with output arguments
It’s not possible to use tildes for declaration of output arguments (otherwise
these arguments will be uninitialized if requested).

Detected by MATLAB Code Analyzer app.
2023-12-15 15:31:52 +01:00
Sébastien Villemot 79959aa587
Remove duplicate branches in if/then/else statements
Detected by MATLAB Code Analyzer app.
2023-12-15 15:31:52 +01:00
Sébastien Villemot a0bafbcb95
Remove duplicate case value
Detected by MATLAB Code Analyzer app.
2023-12-15 15:31:52 +01:00
Sébastien Villemot 2005f292e5
Fix syntax error
Detected by MATLAB Code Analyzer app.
2023-12-15 15:31:52 +01:00
Stéphane Adjemian (Guts) 4a6783c690
Fix #1914.
Also the first input argument of was wrong (we do not pass bayestopt_
anymore but only the list of estimated parameter names, field `name`).
2023-12-15 14:13:56 +01:00
Johannes Pfeifer 3e7291b573 dynare_config.m: remove paths eliminated due to namespaces 2023-12-15 13:12:39 +01:00
Sébastien Villemot 9225e6b6df
Merge branch 'occbin_utilities' of git.dynare.org:rattoma/dynare
Ref. !2232
2023-12-15 11:25:58 +01:00
Sébastien Villemot d8f1e49221
Merge branch 'newrat' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2231
2023-12-15 11:25:47 +01:00
Sébastien Villemot 1239842909
Merge branch 'occbin_smoother' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2230
2023-12-15 11:25:35 +01:00
Marco Ratto 281f01f29e bug fixes and examples in testsuite 2023-12-14 22:26:40 +01:00
Johannes Pfeifer 8710ce0898 newrat: trigger new option in testsuite 2023-12-14 22:25:37 +01:00
Johannes Pfeifer 74ac072549 newrat: document new options 2023-12-14 22:16:57 +01:00
Marco Ratto 8ddd35ddd8 newrat: properly initialize penalty 2023-12-14 22:09:42 +01:00
Marco Ratto 3ee963c908 newrat: distinguish between TolFun (optimizer termination criterion) and TolGstep/TolGstepRel, used for tuning gradient step
Allows using e.g. TolFun=1.e-5 with coarser values for TolGstep; helpful whenmaximizing non smooth surfaces (e.g. PKF or very large models), where numerical noise may count. By default TolGstep=TolFun as in usual historical behavior.
2023-12-14 22:08:34 +01:00
Johannes Pfeifer d25d95b3b5 newrat.m: add robust option that uses quadratic approximation to better adapt line search to noisy likelihood shapes
Triggered when line search hits and error code
2023-12-14 21:57:49 +01:00
Marco Ratto 2898407764 newrat: enforce last parameter vector to be inside bounds 2023-12-14 21:48:58 +01:00
Marco Ratto 3931451250 mr_hessian.m: refined algorithm that calibrates gradient step according to target variation in objective function 2023-12-14 21:45:55 +01:00
Marco Ratto e1e79d3177 mr_gstep.m: increase buffer for check of hitting upper/lower bound of parameters 2023-12-14 21:43:53 +01:00
Sébastien Villemot d94e5bd7b9 Merge branch 'occbin_utilities' into 'master'
new Occbin utilities

See merge request Dynare/dynare!2225
2023-12-14 19:48:56 +00:00
Sébastien Villemot 66bc9fd9c2
Rename “dynare_sensitivity” command to “sensitivity”
The old name is still accepted, but will trigger a deprecation warning.
2023-12-14 18:38:23 +01:00
Sébastien Villemot 19dcd4a0f2
Merge branch 'dynare-globals_and_namespace'
Ref. !2219
2023-12-14 18:29:28 +01:00
Johannes Pfeifer f05a2de89e
get_perturbation_params_derivs.m: replace try-catch by proper check of file existence
Let's other errors though with explicit message
2023-12-14 18:29:04 +01:00
Johannes Pfeifer c3268c0279
Move various functions from main matlab folder to subfolders 2023-12-14 18:29:04 +01:00
Johannes Pfeifer 2e73856f5a
GSA and identification: move files to namespace 2023-12-14 18:29:01 +01:00
Sébastien Villemot 565667c6b7
Merge branch 'dynare-cond_forecast'
Ref. !2228
2023-12-14 17:47:05 +01:00
Johannes Pfeifer 75cd1042c8
conditional_forecast: remove globals and move to namespace 2023-12-14 17:46:27 +01:00
Sébastien Villemot fd0d93ba13
Merge branch 'steady_evalin' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2227
2023-12-14 17:31:36 +01:00
Sébastien Villemot 668f6de5df
Bytecode MEX: adapt for refactorings in the preprocessor 2023-12-14 17:31:26 +01:00
Johannes Pfeifer 0c07460f3b DSGE_smoother.m: clean up file and enable LaTeX output 2023-12-14 16:03:53 +01:00
Johannes Pfeifer dbcc0aeb9f GetPosteriorMeanVariance.m: fix header
[skip CI]
2023-12-14 16:01:51 +01:00
Stéphane Adjemian (Guts) 1983dc13a3
Make examples/fs2000.mod closer to the original code.
- Use (old default) mode_compute=4 which is closer to the algorithm
   used by Frank Schorfheide and ensures that the hessian matrix is well
   behaved (contrary to the new default, because of the asymptote at 0
   in the beta prior for autoregressive parameter ρ).

 - Change parameterization for mst. A normal prior on mst is not
   equivalent to a normal prior on log(mst) (which is done the
   parameterization in the JAE paper).

Closes #2177.
2023-12-14 14:05:37 +01:00
Johannes Pfeifer 162813225d
fs2000.mod: provide actual replication
Closes https://git.dynare.org/Dynare/dynare/-/issues/1905
2023-12-14 14:05:37 +01:00
Johannes Pfeifer 1b2e1d2856 evaluate_steady_state_file.m: remove useless assignin and evalin statement 2023-12-14 11:40:38 +01:00
Sébastien Villemot 81cd0f1cb5 Merge branch 'plus_folders' into 'master'
Start cleaning up main Matlab folder by moving various functions to subfolders and removing unused ones

See merge request Dynare/dynare!2216
2023-12-14 10:29:07 +00:00
Sébastien Villemot 441ef7e102 Merge branch 'fixes_6.x' into 'master'
collection of small individual bug fixes

See merge request Dynare/dynare!2223
2023-12-14 09:12:42 +00:00
Johannes Pfeifer 2df08f88c7 Move estimation files to separate folder 2023-12-13 22:57:06 +01:00
Marco Ratto f102a992aa fixed for the case when mcmc is incomplete WITHIN a block file (useful for expensive models and expensive methods like slice or TaRB) 2023-12-13 21:01:21 +01:00
Marco Ratto 53b57da8ba fix computation of initial prc0 under mh_recover (to avoid 0% being always displayed when recovery starts) 2023-12-13 21:01:15 +01:00
Marco Ratto aad5c36081 bug fix: with option mh_initialize_from_previous_mcmc, we need also to check if some prior changed, which may lead last draw in previous mcmc falling outside new prior bounds. 2023-12-13 21:01:09 +01:00
Marco Ratto de152a3de3 bug fix: indexing must also contain smpl+1 (needed for 1 step ahead forecast in last period when filtering). 2023-12-13 21:01:02 +01:00
Marco Ratto 8f73564634 bug fix with non-zero lb bound of invgamma distribution 2023-12-13 21:00:56 +01:00
Marco Ratto 0c4b59b19e utility to squeeze occbin shock decompositions 2023-12-13 20:56:24 +01:00
Marco Ratto 9b71845b87 utility to plot occbin regimes history 2023-12-13 20:54:20 +01:00
Marco Ratto 91a2cd2496 add utilities for forecast, irf, plot_irf, and their relevant options 2023-12-13 20:53:53 +01:00
Sébastien Villemot 858b534c22 Merge branch 'sim1' into 'master'
sim1.m: add debugging information to diagnose singular Jacobians

See merge request Dynare/dynare!2222
2023-12-13 18:33:06 +00:00
Johannes Pfeifer e17bf15042 sim1.m: add debugging information to diagnose singular Jacobians 2023-12-13 17:40:39 +01:00
Sébastien Villemot ea28fcb4b4
Merge branch 'model_diag' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2221
2023-12-13 17:37:33 +01:00
Sébastien Villemot a7f5fd571d
Merge branch 'steady_check' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2220
2023-12-13 17:37:09 +01:00
Sébastien Villemot 05cb10f8f7
Enable performance-* checks in clang-tidy 2023-12-13 17:33:55 +01:00
Sébastien Villemot 594facdb03
MEX files: homogeneize include guards
Also ensure that guards are not reserved identifiers (i.e. starting with an
underscore).
2023-12-13 17:33:55 +01:00
Sébastien Villemot 7ba1fc1c63
Preprocessor: various refactorings recommended by clang-tidy 2023-12-13 17:33:55 +01:00
Sébastien Villemot 63d5569cf4
libkorder MEX: remove useless parameter copies and std::move calls in constructors
Automatically detected by clang-tidy using performance-unnecessary-value-param
and performance-move-const-arg checks.
2023-12-13 17:33:55 +01:00
Sébastien Villemot 00434c595d
libkorder MEX: mark Vector move constructor as noexcept
Automatically detected by clang-tidy with performance-noexcept-move-constructor
check.
2023-12-13 17:33:55 +01:00
Stéphane Adjemian (Ryûk) 60c0ed0180
Add Sequential Monte Carlo sampler. 2023-12-13 15:30:38 +01:00
Johannes Pfeifer 42fc1ec40a model_diagnostics.m: fix typos
[skip CI]
2023-12-12 19:38:57 +01:00
Johannes Pfeifer 1b4fb46c75 Consistently use nocheck flag for steady state
Fixes a bug in model_diagnostics.m
2023-12-12 18:30:30 +01:00
Stéphane Adjemian (Ryûk) 2fbbe66c0a
Add member to dprior class.
Name of the parameter.
2023-12-12 18:18:38 +01:00
Stéphane Adjemian (Ryûk) 61498e644a
One file per method. 2023-12-12 18:18:38 +01:00
Stéphane Adjemian (Ryûk) 3606b10f05
Add methods for computing moments.
- prior mean
 - prior mode
 - prior median
 - prior variance
2023-12-12 18:18:38 +01:00
Stéphane Adjemian (Ryûk) 5077969aad
Add members to @dprior class. 2023-12-12 18:18:38 +01:00
Stéphane Adjemian (Ryûk) 3d50844ae4
Make last input argument optional. 2023-12-12 18:18:38 +01:00
Stéphane Adjemian (Ryûk) 3c3353b7ed
Add methods to dprior (density and densities).
Will be used as a replacement for priordens.
2023-12-12 18:18:38 +01:00
Stéphane Adjemian (Ryûk) 03a68ddb89
Cosmetic changes. 2023-12-12 18:18:38 +01:00
Sébastien Villemot b1aa88e8da
Add clang-tidy configuration file
[skip ci]
2023-12-12 17:32:43 +01:00
Sébastien Villemot d3aac5e2d7
Fix typo
[skip ci]
2023-12-12 17:28:52 +01:00
Sébastien Villemot 62b31aa279
Merge branch 'cosmetics' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2218
2023-12-12 17:15:38 +01:00
Sébastien Villemot 9d6a25e368
dseries: update to CI configuration 2023-12-12 17:10:42 +01:00
Sébastien Villemot 43b24facb9
Configuration file: new default location; new default value for GlobalInitFile
Under Linux and macOS, the default location for the configuration file is now
dynare/dynare.ini under the configuration directories as defined by the XDG
specification. Under Windows, the default configuration file is now
%APPDATA%\dynare\dynare.ini.

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.
2023-12-12 17:09:55 +01:00
Sébastien Villemot cc15281b1f
Emacs mode: add missing keywords
– “bvar_irf” added to statements
– “target”, “auxname_target_nonstationary”, “component”, “growth”, “auxname”,
  “kind” added to statements-like
– “filter_initial_state” added to blocks
2023-12-12 10:54:03 +01:00
Sébastien Villemot c99230825f
Windows package: bump dependencies 2023-12-12 10:54:03 +01:00
Sébastien Villemot b7805cc667 Merge branch 'remove_files' into 'master'
Remove various unused files

See merge request Dynare/dynare!2217
2023-12-11 20:38:06 +00:00
Johannes Pfeifer ec76bda254 Remove obsolete Sylvester options
dr_block has been removed
2023-12-11 18:04:43 +01:00
Johannes Pfeifer 021b9dbb25 identication.checks.m: remove wrong condition 2023-12-11 18:04:43 +01:00
Johannes Pfeifer daecd1f720 DsgeSmoother.m: remove unnecessary space 2023-12-11 18:04:42 +01:00
Johannes Pfeifer 5a3d545db2 var_sample_moments.m: cosmetic changes 2023-12-11 18:04:42 +01:00
Johannes Pfeifer ed80c4ff3f load_last_mh_history_file.m: cosmetic changes 2023-12-11 18:04:42 +01:00
Johannes Pfeifer 678bd7aca9 dyn_forecast.m: cosmetic header fix 2023-12-11 18:04:42 +01:00
Johannes Pfeifer 97f6a4219b smirnov_test.m: update call to histc under Matlab 2023-12-11 18:04:41 +01:00
Johannes Pfeifer 31c91080e1 Remove shiftS.m, which is a duplicate of the one in dseries 2023-12-11 18:01:34 +01:00
Johannes Pfeifer 62e8b275a0 Remove further unused function from matlab folder 2023-12-11 18:01:33 +01:00
Johannes Pfeifer 435b103cf5 Remove unused functions, mostly related to old analytical derivatives 2023-12-11 18:01:33 +01:00
Sébastien Villemot d844043877
Merge branch 'plot_shock_decomposition' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2215
2023-12-08 15:49:19 +01:00
Sébastien Villemot a31c76403d
Windows and macOS packages: move meson native/cross files to OS-specific directory 2023-12-08 14:34:14 +01:00
Sébastien Villemot 4ef9245a95
MEX files: remove calls to virtual method during construction
Such calls may bypass virtual dispatch.

Automatically detected by clang-tidy with
clang-analyzer-optin.cplusplus.VirtualCall check.
2023-12-07 18:34:38 +01:00
Sébastien Villemot 91c677ca7f
MEX files: drop C++ preprocessor directives now obsolete
Dynare++ is no longer distributed as a standalone binary.
2023-12-07 17:57:01 +01:00
Sébastien Villemot 56289c72d0
Drop obsolete Dynare++ example
[skip ci]
2023-12-07 16:04:33 +01:00
Sébastien Villemot 1f5f668313
Move docker folder below the scripts folder
[skip ci]
2023-12-07 16:02:33 +01:00
Johannes Pfeifer 54c4e9df09 plot_shock_decomposition.m: filter out case where data to plot is empty and writing the Excel file will crash 2023-12-07 13:50:18 +01:00
Stéphane Adjemian (Guts) 8d8176fc30
Remove unused (saved on disk) vector of indices. 2023-12-07 12:29:28 +01:00
Sébastien Villemot 40ef192e37
Merge branch 'dynare-ident_globals'
Ref. !2213
2023-12-07 12:19:04 +01:00
Johannes Pfeifer 1e5a04c2c5
filt_mc_.m: clarify R2 concept 2023-12-07 12:18:00 +01:00
Johannes Pfeifer f3a1ba56e3
GSA: removed non-working UI context menu and associated functions
Decision taken in Town Square
2023-12-07 12:18:00 +01:00
Johannes Pfeifer af53c65172
dynare_sensitivity.m: update header 2023-12-07 12:18:00 +01:00
Johannes Pfeifer c3b9c499ba
GSA: more fixes to LaTeX output 2023-12-07 12:18:00 +01:00
Johannes Pfeifer 7f027d8f5e
dyn_table.m: reduce white space in output 2023-12-07 12:18:00 +01:00
Johannes Pfeifer 9efb784763
GSA: remove some unused functions and move other to inline ones 2023-12-07 12:18:00 +01:00
Johannes Pfeifer 19b2619d06
Remove unused gsa/gsa_speed.m 2023-12-07 12:17:59 +01:00
Johannes Pfeifer 5d07ff9f8b
GSA: decrease waitbar refresh frequency 2023-12-07 12:11:38 +01:00
Johannes Pfeifer fca782f8e4
Correct LaTeX output by disentangling purpose of input arguments 2023-12-07 12:11:38 +01:00
Johannes Pfeifer 43fc6263af
dyn_latex_table.m: make code robust to including dollar signs in labels and headers 2023-12-07 12:11:38 +01:00
Johannes Pfeifer 37ab539a10
testsuite: provide meaningful output in case of LaTeX errors 2023-12-07 12:11:38 +01:00
Johannes Pfeifer 6adf1c2639
Various cosmetic changes to functions 2023-12-07 12:11:38 +01:00
Johannes Pfeifer 709ef9230f
get_the_name.m: do not pass full options structure as input 2023-12-07 12:11:38 +01:00
Johannes Pfeifer 0ba91259d8
GSA: cosmetic fixes to log_trans_.m and gsa_skewness.m 2023-12-07 12:11:38 +01:00
Johannes Pfeifer dce0967deb
GSA: replace deprecated hist() syntax under MATLAB 2023-12-07 12:11:38 +01:00
Johannes Pfeifer 392721097c
Identification: various cosmetic fixes 2023-12-07 12:11:38 +01:00
Johannes Pfeifer e68793030c
ls2003.mod: factorize tests 2023-12-07 12:11:38 +01:00
Johannes Pfeifer bf6d88a472
Remove globals from identification and GSA
Incidentally cleans up files and fixes LaTeX output
2023-12-07 12:11:36 +01:00
Sébastien Villemot 6a58316a3e
MEX files: disable clang-tidy false positive for call to std::strcpy 2023-12-06 22:24:57 +01:00
Sébastien Villemot 91f2dcdfe1
MEX files: use “auto” when initializing with a template cast to avoid duplicating the type name
Automatically detected by clang-tidy with modernize-use-auto check.
2023-12-06 22:24:56 +01:00
Sébastien Villemot de476ad5ac
MEX files: use a braced initializer list instead of repeating the return type
Automatically detected by clang-tidy with modernize-return-braced-init-list
check.
2023-12-06 22:24:55 +01:00
Sébastien Villemot 123f909b67
MEX files: use pass-by-value + std::move when possible in constructors
Automatically detected by clang-tidy with modernize-pass-by-value check.
2023-12-06 22:24:55 +01:00
Sébastien Villemot fd9a89ab38
MEX files: use default member initialization when possible
Automatically detected by clang-tidy with modernize-use-default-member-init
check.
2023-12-06 22:24:55 +01:00
Sébastien Villemot 15b6e6e6b3
MEX files: no longer use “virtual” keyword when overriding a method
Automatically detected by clang-tidy with modernize-use-override check.
2023-12-06 22:24:55 +01:00
Sébastien Villemot 9d98811cfc
MEX files: use transparent functor for std::multiplies
Automatically detected by clang-tidy using modernize-use-transparent-functors
check.
2023-12-06 22:24:55 +01:00
Sébastien Villemot 8953007440
MEX files: remove unused variables or values
Automatically detected by clang-tidy using
clang-diagnostic-unused-but-set-variable, clang-analyzer-deadcode.DeadStores
and clang-diagnostic-unused-const-variable checks.
2023-12-06 22:24:55 +01:00
Sébastien Villemot d82eecfd39
C++11 modernization: use std::array and std::vector instead of C arrays
Automatically detected by clang-tidy using modernize-avoid-c-arrays check.
2023-12-06 22:24:52 +01:00
Sébastien Villemot 3df4856259
Merge branch 'raftery_lewis_bug' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2214
2023-12-05 18:53:10 +01:00
Sébastien Villemot 11c1f6175e
Add [[nodiscard]] attribute to various functions
Automatically detected using clang-tidy with modernize-use-nodiscard check.
2023-12-05 15:44:23 +01:00
Sébastien Villemot 7864370bfb
perfect_foresight_problem MEX: fix inclusion of dynmex.h
That header is needed from DynamicModelCaller.hh.

Issue detected by clang-tidy.
2023-12-04 18:21:18 +01:00
Sébastien Villemot 911437378c
Remove unused and unmaintained unit test for k-order 2023-12-04 18:21:18 +01:00
Sébastien Villemot 6f38dcd1d5
bytecode MEX: fix logical test
The test “solve_algo >= 6 || solve_algo <= 8” was always true.

Issue detected by clang-tidy using the
clang-diagnostic-tautological-overlap-compare check.
2023-12-04 18:21:13 +01:00
Sébastien Villemot bc6840ff6f
MEX libkorder: make destructor of SparseTensor class virtual
That class is a base class, so it must have a virtual destructor to avoid
memory leaks.

Issue detected by clang-tidy with
clang-diagnostic-delete-non-abstract-non-virtual-dtor check.
2023-12-04 18:20:43 +01:00
Sébastien Villemot aeec4494b0
MEX libkorder: fix use of moved-from object
Detected by clang-tidy using clang-analyzer-cplusplus.Move check.
2023-12-04 18:20:43 +01:00
Sébastien Villemot 857e5b00f5
C++ modernization: pass by value and use std::move when relevant
Automatically detected and fixed using clang-tidy with modernize-pass-by-value
check.
2023-12-04 18:20:43 +01:00
Sébastien Villemot bd7703d160
C++ modernization: use a braced initializer list instead when relevant
Automatically detected and fixed using clang-tidy with
modernize-return-braced-init-list check.
2023-12-04 18:20:43 +01:00
Sébastien Villemot a5445c52be
C++ modernization: more uses of auto keyword
Automatically detected and fixed using clang-tidy with modernize-use-auto
check.
2023-12-04 18:20:43 +01:00
Sébastien Villemot 403f20a7f3
C++ modernization: add [[nodiscard]] attribute to various functions
Automatically detected and fixed using clang-tidy with modernize-use-nodiscard
check.
2023-12-04 18:20:42 +01:00
Johannes Pfeifer 53f12e81fa Raftery/Lewis: fix case with only one parameter
Dimension for max needs to be specified
2023-12-04 16:25:00 +01:00
Sébastien Villemot bea87aafad
Manual: minor formatting improvements
[skip ci]
2023-12-04 16:22:24 +01:00
Johannes Pfeifer 526e6841b1 Sampling_Function_2.m: clean up and fix wrong logical conditions 2023-12-04 12:07:58 +01:00
Johannes Pfeifer c21199a3e9 prior_draw.m: remove wrong note 2023-12-04 12:07:57 +01:00
Johannes Pfeifer 36a4ad0fbc Fix Remove globals and clean up map_ident_.m and friends 2023-12-04 12:07:56 +01:00
Johannes Pfeifer f218127220 GSA: remove globals from various routines 2023-12-04 12:07:46 +01:00
Stéphane Adjemian (Ryûk) edaf938582
Add --log option to dcontrib command. 2023-11-30 21:55:35 +01:00
Stéphane Adjemian (Ryûk) dadcd9a2bf
Dynare does not ship jsonlab anymore.
See 1d5a442fe5.
2023-11-30 16:52:02 +01:00
Sébastien Villemot c6a7801ba8
clang-format configuration: set “PackConstructorInitializers: NextLine” 2023-11-30 14:37:05 +01:00
Sébastien Villemot 7edf01a2a9
Manual: cosmetic change
[skip ci]
2023-11-29 21:13:51 +01:00
Sébastien Villemot cb56dcc569
README.md: under Octave, the statistics package is not optional
[skip ci]
2023-11-29 21:13:48 +01:00
Sébastien Villemot f0420fa219
CI: add job that checks formatting with clang-format 2023-11-29 19:02:41 +01:00
Sébastien Villemot ed332e3ba1
MEX files: reformat C++ source code using clang-format 15 2023-11-29 19:00:51 +01:00
Sébastien Villemot ca16f7f848
clang-format configuration: never collapse short functions on a single line 2023-11-29 18:19:31 +01:00
Sébastien Villemot 847f940f78
clang-format configuration: remove reference to a specific clang-format version 2023-11-29 13:12:54 +01:00
Johannes Pfeifer d5f7fbe96a redform_screen.m: remove globals 2023-11-28 21:11:03 +01:00
Johannes Pfeifer d29228bb5f dynare_sensitivity: clean up file 2023-11-28 21:11:03 +01:00
Johannes Pfeifer 152991864d GSA: cleanup and removal of globals in filt_mc_.m 2023-11-28 21:11:03 +01:00
Johannes Pfeifer f8a0a99683 dynare_sensitivity.m: add dollar signs for TeX output 2023-11-28 21:11:02 +01:00
Johannes Pfeifer 5060f246ea GSA: Remove globals and clean up map_ident_.m and friends 2023-11-28 21:11:02 +01:00
Johannes Pfeifer 4199f57788 GSA scatter plots: clean up files and enable TeX-output 2023-11-28 21:11:02 +01:00
Johannes Pfeifer 94c1343671 identification_analysis.m: remove global inputs 2023-11-28 21:11:02 +01:00
Johannes Pfeifer a80ead7d94 map_ident_.m: clean up and remove globals 2023-11-28 21:11:02 +01:00
Johannes Pfeifer da438d5099 Clean up Morris_Measure_Groups.m 2023-11-28 21:11:01 +01:00
Johannes Pfeifer ffaf6c8559 ident_bruteforce.m: remove globals 2023-11-28 21:11:01 +01:00
Sébastien Villemot 54e72a4d35
Emacs default settings for editing C and C++: indent at 100 columns
For consistency with the clang-format settings.

[skip ci]
2023-11-28 18:10:38 +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 c6c6f4f549
perfect_foresight_solver + homotopy + (marginal) linearization: store intermediate simulations
First simulation before doing extrapolation is stored in several fields of
oo_.deterministic_simulation.sim1.

For marginal linearization, the second simulation used to compute the marginal
contribution is stored in oo_.deterministic_simulation.sim2.
2023-11-28 12:29:34 +01:00
Sébastien Villemot b0197da05f
Manual: fix code block formatting
[skip ci]
2023-11-28 12:28:43 +01:00
Sébastien Villemot ccff7d3560 Merge branch 'tex_identification' into 'master'
Fix LaTeX Output in identification command for advanced option

See merge request Dynare/dynare!2209
2023-11-27 15:13:19 +00:00
Johannes Pfeifer e718402357 mode_check.m: fix LaTeX output on Windows by using slash 2023-11-27 14:19:13 +01:00
Johannes Pfeifer 59c9f70a7d identification: fix latex output 2023-11-27 14:18:58 +01:00
Sébastien Villemot 6ccc7fd69e
Testsuite: switch back to mode_compute=4 in lyapunov/fs2000_lyap.mod
This prevents an infinite (or at least very long) loop under Octave on karaba.
2023-11-24 11:49:28 +01:00
Sébastien Villemot b220be6d3e
Merge branch 'mcmc_diag' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2212
2023-11-24 10:38:49 +01:00
Sébastien Villemot f21fda7dfa
Build system: enable the interleaved API in MEX files for Octave ⩾ 8.4.0
Unfortunately it is not possible to enable it for all supported Octave
versions (which would have allowed us to remove the old codepath), because of
this bug: https://savannah.gnu.org/bugs/?64687
2023-11-24 10:36:47 +01:00
Sébastien Villemot c0e39d40a7
Testsuite: increase tolerance for estimation/fs2000_model_comparison.mod
Needed for MATLAB R2018b, at least on AVX512-capable CPUs.
2023-11-23 22:07:49 +01:00
Johannes Pfeifer d0e99daf9a mcmc_diagnostics.m: compute Geweke and Raftery/Lewis also with more than one chain 2023-11-23 16:59:02 +01:00
Sébastien Villemot f62d76cbcf
Merge branch 'shock_decomp' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2211
2023-11-23 14:51:26 +01:00
Sébastien Villemot 56410be973
CI: enable FF_ENABLE_BASH_EXIT_CODE_CHECK to avoid unintuitive behaviour with && operator 2023-11-23 14:51:06 +01:00
Johannes Pfeifer 07d859d018 graph_decomp.m: make sure figure fits on screen and close button is accessible 2023-11-23 01:27:10 +01:00
Sébastien Villemot b513214570
perfect_foresight_homotopy: minor simplification 2023-11-22 20:34:03 +01:00
Sébastien Villemot 9545dcc8d9
perfect_foresight_solver.m: improve local functions documentation 2023-11-22 20:34:02 +01:00
Sébastien Villemot 08c9eca8ee
perfect foresight homotopy + marginal linearization: fix percentages in information messages 2023-11-22 20:34:02 +01:00
Sébastien Villemot 701afd2c7c
Consolidate the routines for loading JSON files, now that jsondecode is always available 2023-11-22 17:46:16 +01:00
Sébastien Villemot 1d5a442fe5
Bump minimal required version of Octave to 7.1.0
Incidentally, this means that the JSONlab submodule is no longer needed, so it
is removed in the present commit.

Closes: #1907
2023-11-22 17:46:13 +01:00
Sébastien Villemot d55b6c68f9
Octave compatibility fix: sum(…, 'omitnan') does not exist under Octave
Replace it by nansum from the statistics package.
2023-11-22 17:06:52 +01:00
Sébastien Villemot 72ac69eb97
Octave compatibility: mean(…, 'omitnan') implemented in Octave 8 2023-11-22 16:55:25 +01:00
Sébastien Villemot ec7a4ba84f
Testsuite: compatibility fix for MATLAB R2018b
MATLAB R2018b does not have a true batch mode, and will not exit if there is no
final quit statement in a script. Hence ensure there is one when testing a .m
file.

By the way, remove a batch argument for Windows that is obviously incorrect.
2023-11-22 16:53:25 +01:00
Sébastien Villemot 3bfe2c5500
Testsuite: compatibility fix for MATLAB R2018b
On that version, spaces in variables names within a call to “table” are not
supported.
2023-11-22 16:49:59 +01:00
Sébastien Villemot 7f58e819c6
Bump minimal required version of MATLAB to R2018b
Ref. #1907
2023-11-22 16:00:04 +01:00
Sébastien Villemot 0efe0c9844
Build system: under Windows and macOS, use the export file shipped with MATLAB instead of our own 2023-11-22 14:50:50 +01:00
Sébastien Villemot dd5049cd4c
Merge branch 'doc' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2210
2023-11-21 12:48:20 +01:00
Sébastien Villemot 627bbb0a91
Add clang-format config file for formatting C++ code
As a consequence, drop old uncrustify config file.
2023-11-21 12:47:21 +01:00
Johannes Pfeifer eb8444889a Manual: add reference for cycle reduction 2023-11-21 03:32:43 +01:00
Johannes Pfeifer 37f747bb3b CheckPath.m and plot_priors.m: use slash even on Windows to not cause LaTeX-problems 2023-11-21 02:29:04 +01:00
Sébastien Villemot e15fba807f
Build system: drop TODO items that are not actually needed 2023-11-17 19:27:35 +01:00
Sébastien Villemot d8ebdf916c
Build system: add target for creating TAGS file for Emacs
Indexes all C++, Fortran and C files (including submodules).
2023-11-17 19:27:33 +01:00
Sébastien Villemot 56ed5bff43
Testsuite: remove useless debug mode from several .m tests
The output is always useful (and even needed in case of test failure).
2023-11-17 12:13:36 +01:00
Sébastien Villemot 742a3101b1
Reporting is no longer a submodule 2023-11-17 12:08:56 +01:00
Sébastien Villemot 50a53a22ee
Merge rewritten history of reporting submodule 2023-11-17 11:44:48 +01:00
Sébastien Villemot 8a54d10389 Merge branch 'doc' into 'master'
manual: port changes from Dynare/preprocessor@e85d085ae8

See merge request Dynare/dynare!2208
2023-11-16 08:11:20 +00:00
Johannes Pfeifer b053b96f6a compute_Pinf_Pstar.m: cosmetic changes 2023-11-15 21:39:51 +01:00
Johannes Pfeifer 0e08dd287b manual: fix some quotes 2023-11-15 21:39:38 +01:00
Sébastien Villemot 551060ae27
tests/moments/fs2000_post_moments.mod: increase tolerance under Octave 2023-11-15 15:16:06 +01:00
Johannes Pfeifer e27ab153d7 manual: port changes from Dynare/preprocessor@e85d085ae8 2023-11-15 14:07:44 +01:00
Sébastien Villemot 4b4cfba2dc
model_replace, model_remove: allow selecting an equation with several (conjunct) tags
NB: does not (yet) works with Occbin regime-specific equations.

Ref. #1890
2023-11-15 12:08:21 +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 b535763e56 Merge branch 'occbin_exo' into 'master'
model_diagnostics.m: add check for non-zero exogenous with OccBin

See merge request Dynare/dynare!2206
2023-11-14 13:04:26 +00:00
Johannes Pfeifer 50ed6b2387 dynare_solve.m: remove display of blocks
Information is rarely helpful but clutters output of model_diagnostics
2023-11-14 08:35:02 +01:00
Sébastien Villemot e1d4c81531 Merge branch 'kalman_mex' into 'master'
Kalman filter mex: remove compilation warnings

See merge request Dynare/dynare!2207
2023-11-13 17:52:30 +00:00
Johannes Pfeifer b1519b8c3c model_diagnostics.m: add check for non-zero exogenous with OccBin 2023-11-13 18:04:40 +01:00
Normann Rion a900f74cf3 Kalman filter mex: remove compilation warnings
Compilation wargnings were pointing at: (i) some supposedly uninitialized variables (-Wmaybe-uninitialized); (ii) a pointer assignment (=) to a non-pointer target (-Wsurprising).
2023-11-13 09:33:00 +00:00
Sébastien Villemot eb591b1299
Build system: make the mathjax_path option of Sphinx configurable from meson
This replaces the old hack which was using a local Linux-specific symlink. Now,
the Dynare default is the same as in Sphinx, i.e. rely on a CDN for delivering
MathJax.

Adapt our CI accordingly to continue using MathJax from the Debian package
there (to avoid privacy issues related to the use of a CDN).
2023-11-10 14:54:38 +01:00
Sébastien Villemot 6599800f88
Manual: update copyright year in sphinx configuration 2023-11-10 13:44:55 +01:00
Stéphane Adjemian (Argos) 666aa46dfb
Add undocumented option for kalman_filter_mex. 2023-11-09 19:00:37 +01:00
Stéphane Adjemian (Argos) b863c309bd
Improve tests and timings for the Kalman mex.
- Ensure that we always use the same DGP (e.g. same transition matrix).
 - Call the mex more than once with different samples.
 - Ensure that the size of the state space model is the same in tests 1, 2 and 3.
 - Fix the seed (same samples across 1, 2 and 3 except for the additive noise in 2 and 3 on the observed variables).
2023-11-09 19:00:37 +01:00
Stéphane Adjemian (Argos) 9c61422a75
Improve debug mode. 2023-11-09 19:00:37 +01:00
Normann Rion 3a461c996c
Kalman filter mex: routine and tests 2023-11-09 19:00:37 +01:00
Sébastien Villemot 0c83453a0c
Windows package: bump to Octave 8.4.0 2023-11-09 11:54:48 +01:00
Sébastien Villemot 0e201b2928
Manual: claim compatibility with Octave 8.4.0 2023-11-09 11:54:13 +01:00
Sébastien Villemot 77a7d5c3de
For bytecode+block, use the LBJ implementation in .m
The latter is now much faster than the implementation in the bytecode
MEX (which this commit thus removes).
2023-11-08 17:21:44 +01:00
Sébastien Villemot be648d350b
Much faster .m implementation of LBJ with block option 2023-11-08 17:21:42 +01:00
Sébastien Villemot 0839ff78ae
🐛 sim1_lbj.m: use options_.dynatol.x and not options_.dynatol.f for terminal condition
The maximum error is computed over the change in endogenous (i.e. ΔY).
2023-11-08 17:15:18 +01:00
Sébastien Villemot 4bee919c31
sim1_lbj.m: misc cosmetic changes 2023-11-08 17:15:02 +01:00
Sébastien Villemot 158b7462bf
solve_two_boundaries.m: strip down the number of input arguments 2023-11-08 17:10:29 +01:00
Sébastien Villemot b36507d005
solve_two_boundaries.m: do not modify lambda when stack_solve_algo=4
That algorithm (optimal path length) does not use it.
2023-11-08 17:09:34 +01:00
Sébastien Villemot 8556043c9a
solve_two_boundaries.m: remove an unused variable 2023-11-08 17:09:20 +01:00
Sébastien Villemot 7dc90654ab
Bytecode: adapt for enum removal in preprocessor 2023-11-07 15:37:55 +01:00
Sébastien Villemot 93ab67acab
🐛 Bytecode MEX: fix bug with evaluation of recursive variables with block+mfs>0
In “evaluate” mode, with mfs>0, if the value of variable would depend on a
previously re-evaluated recursive variable, then the value used for that recursive
variable would be incorrect (it would be the value before re-evaluation of the
recursive variable, as passed by the caller).
2023-11-07 15:37:51 +01:00
Sébastien Villemot 7e512af074
Bytecode MEX: refactor handling of temporary terms
In particular:
– properly return temporary terms as output argument in evaluate+dynamic mode
  (with periods in rows and the temporary terms in column)
– drop the unused “global_temporary_terms” keyword input argument
2023-11-07 15:37:32 +01:00
Stéphane Adjemian (Argos) 368a7e2478
Fix bug introduced in d95154f. 2023-11-07 13:06:58 +01:00
Sébastien Villemot 79a655261b
macOS package: adapt for new filesystem location of MATLAB R2016b for x86-64 2023-11-06 15:45:06 +01:00
Sébastien Villemot fd0e175fe4
Windows package: bump dependencies
Incidentally, drop workarounds for pkg-config files of HDF5 and MatIO, since
the problems have been fixed upstream.
2023-11-06 15:41:21 +01:00
Sébastien Villemot f6adb1d9ad
Bytecode: safer handling of block= option 2023-11-02 16:51:02 +01:00
Sébastien Villemot 25000ca693 Merge branch 'PKF' into 'master'
PKF: add period to debugging information

See merge request Dynare/dynare!2204
2023-11-02 09:12:12 +00:00
Stéphane Adjemian (Argos) 33f2456acf
Add new option (--method).
Possible values are cumulate (default value) or diff.
2023-10-30 12:09:39 +01:00
Johannes Pfeifer 5103d55cb4 PKF: add period to debugging information 2023-10-29 11:30:23 +01:00
Stéphane Adjemian (Argos) 12cca117bc
Change the definition of the default baseline. 2023-10-26 18:30:43 +02:00
Stéphane Adjemian (Argos) b0a84bd6f8
Bug fixes.
- Simulation of the model was not working since to (1) wrong commented
 line (dynare comments in a verbatim block), and (2) dates are not interpreted
 in a verbatim block.

 - A variable was missing (the auxiliary for the PAC expectation term) causing
 problems for the initialisation of the simulations in dcontribs (presence of a
 NaN in the guess for the first period).
2023-10-26 18:25:35 +02:00
Stéphane Adjemian (Argos) 76a2203b50
Make debug mode easier to use. 2023-10-26 14:59:12 +02:00
Stéphane Adjemian (Argos) cdd842cc19
Do not overwrite macro variable simulate. 2023-10-26 14:57:37 +02:00
Sébastien Villemot b1b76f7783 Merge branch 'naming_consistency' into 'master'
Implement even more naming consistency

See merge request Dynare/dynare!2203
2023-10-25 20:30:11 +00:00
Sébastien Villemot 4701dfd158 Merge branch 'prior_function' into 'master'
execute_prior_posterior_function.m: correct warning message

See merge request Dynare/dynare!2201
2023-10-25 15:44:21 +00:00
Johannes Pfeifer 0561200f1c Implement even more naming consistency
Mostly removes M for M_
2023-10-25 17:29:55 +02:00
Sébastien Villemot aca148e8ef
Minor simplification 2023-10-25 15:57:57 +02:00
Sébastien Villemot ff2b8512b9
Reporting: make naming of globals consistent 2023-10-25 15:57:56 +02:00
Sébastien Villemot 0295e5ede8 Merge branch 'variable_naming' into 'master'
Move many functions towards consistent naming

See merge request Dynare/dynare!2202
2023-10-25 13:56:17 +00:00
Sébastien Villemot 218a1f2d58 Merge branch 'naming' into 'master'
Make naming of globals consistent

See merge request Dynare/reporting!8
2023-10-25 09:43:14 +00:00
Johannes Pfeifer b3ce518433 Further naming consistency improvements 2023-10-25 11:22:50 +02:00
Johannes Pfeifer c19469f01a Make naming of globals consistent 2023-10-25 10:16:51 +02:00
Johannes Pfeifer 879d92fbf8 Move many functions towards consistent naming
Related to #1776
2023-10-24 22:21:15 +02:00
Sébastien Villemot 04ea0d0659
Fix comment 2023-10-24 17:36:53 +02:00
Sébastien Villemot caaa70ab7e
Perfect foresight + block decomposition: minor simplifications 2023-10-24 17:36:51 +02:00
Sébastien Villemot 17b016d983
Perfect foresight: with stack_solve_algo={1,6}+bytecode (without block), use the same solver as without bytecode
The solver in the bytecode MEX is slower.
2023-10-24 15:26:55 +02:00
Johannes Pfeifer a5383fdf65 execute_prior_posterior_function.m: correct warning message 2023-10-24 12:53:00 +02:00
Sébastien Villemot af20512476
Remove now superfluous license file pattern
[skip ci]
2023-10-24 11:41:04 +02:00
Sébastien Villemot 88ce107466
Rename ys0_ into oo_.initial_steady_state and ex0_ into oo_.initial_exo_steady_state
Also document these variables.
2023-10-24 09:38:51 +02:00
Sébastien Villemot 1334ae045a
Manual: document oo_.exo_steady_state 2023-10-24 09:38:50 +02:00
Sébastien Villemot f40e7cfc68
Manual: fix typo 2023-10-24 09:38:50 +02:00
Sébastien Villemot e3b346094b
macOS package: build dependencies with -O3 and without -g 2023-10-24 09:38:50 +02: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 c475109648
NEWS.md: announcement for Dynare 5.5
[skip ci]
2023-10-23 16:16:49 +02:00
Sébastien Villemot ff5ca80bbc Merge branch 'preprocessor_output' into 'master'
By default display preprocessor output line by line instead of only at the end

See merge request Dynare/dynare!2200
2023-10-23 12:05:53 +00:00
Stéphane Adjemian (Argos) d95154ffa9
Do not automagically cherrypick vars from pac_target_nonstationary. 2023-10-21 10:20:28 +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 7449d26e51
Perfect foresight with homotopy + marginal linearization: improve info messages 2023-10-20 14:57:22 -04:00
Sébastien Villemot 6027d31da2
Bytecode: rename some methods in Interpreter for clarity 2023-10-20 14:31:46 -04:00
Sébastien Villemot b17ff164fc
Bytecode: rename argument in Interpreter::compute_block_time()
To avoid ambiguity with class member with same name.
2023-10-20 11:49:04 -04:00
Sébastien Villemot 753848ab4b
Bytecode: simplify Interpreter::Simple_Init() 2023-10-20 11:47:13 -04:00
Sébastien Villemot 12a0781bc4
Bytecode: simplify Interpreter::simple_bksub() 2023-10-20 11:43:48 -04:00
Sébastien Villemot 8573c6d06a
Bytecode: simplify Interpreter::bksub() and Interpreter::complete() 2023-10-20 11:42:04 -04:00
Sébastien Villemot 8305afc6b3
Bytecode: simplify Interpreter::compare() 2023-10-20 11:36:35 -04:00
Sébastien Villemot ed45b2092f
Bytecode: simplify a couple of other Interpreter methods 2023-10-20 11:31:23 -04:00
Sébastien Villemot 9964de1c5f
Bytecode: simplify Interpreter::Solve_Matlab_BiCGStab() 2023-10-20 11:23:15 -04:00
Sébastien Villemot 1492073669
Bytecode: simplify Interpreter::Solve_Matlab_GMRES() 2023-10-20 11:18:40 -04:00
Sébastien Villemot 9b9c87e09f
Bytecode: further simplify Interpreter::Read_SparseMatrix() 2023-10-20 10:57:53 -04:00
Sébastien Villemot 4d13d73c58
Bytecode: simplify Interpreter::Solve_LU_UMFPack() (two boundaries version) 2023-10-20 10:47:53 -04:00
Sébastien Villemot 401fbd25a6
Bytecode: simplify Interpreter::Solve_LU_UMFPack() (one boundary version) 2023-10-20 10:41:25 -04:00
Sébastien Villemot 853b195432
Bytecode: remove unused methods in Interpreter 2023-10-20 10:34:17 -04:00
Sébastien Villemot 2617f5a4be
Bytecode: simplify Interpreter::Solve_Matlab_Relaxation() 2023-10-20 10:31:51 -04:00
Sébastien Villemot c132817780
Bytecode: simplify Interpreter::Solve_ByteCode_Sparse_GaussianElimination() 2023-10-20 10:25:06 -04:00
Sébastien Villemot 6c3325cc5e
Bytecode: simplify Interpreter::Solve_ByteCode_Symbolic_Sparse_GaussianElimination() 2023-10-20 10:20:45 -04:00
Sébastien Villemot d5618a61d9
Bytecode: simplify Interpreter::golden() 2023-10-20 10:17:08 -04:00
Sébastien Villemot f47507395d
Bytecode: simplify Interpreter::mnbrak() 2023-10-20 10:16:53 -04:00
Johannes Pfeifer 643face6ed bug: do not remove +subfolder with fast option
Otherwise, expected files are not present
2023-10-20 15:42:44 +02:00
Johannes Pfeifer fb8ff758f9 By default display preprocessor output line by line instead of only at the end
Allows judging how long individual steps take for big models
2023-10-20 15:42:05 +02:00
Sébastien Villemot 9eaf1510f6
Bytecode: make some parameters of Interpreter::Init_Matlab_Sparse() as const 2023-10-20 09:41:01 -04:00
Sébastien Villemot 093a547684
Bytecode: simplify Interpreter::compute_complete() 2023-10-20 09:38:03 -04:00
Sébastien Villemot 0bfcc6d2f5
Bytecode: simplify Interpreter::Init_UMFPACK_Sparse_Simple() 2023-10-19 17:34:06 -04:00
Sébastien Villemot 860285b8b8
Bytecode: simplify Interpreter::Init_Matlab_Sparse_Simple() 2023-10-19 17:34:05 -04:00
Sébastien Villemot 233d0815a6
Bytecode: simplify Interpreter::Init_UMFPACK_Sparse() 2023-10-19 17:33:24 -04:00
Sébastien Villemot dc6a84196a
Bytecode: simplify Interpreter::Init_Matlab_Sparse() 2023-10-19 17:01:51 -04:00
Sébastien Villemot 88a0f67585
Bytecode: simplify Interpreter::Init_GE() 2023-10-19 16:58:14 -04:00
Sébastien Villemot 24fc3854e2
Bytecode: simplify Interpreter::Singular_display() 2023-10-19 16:55:51 -04:00
Sébastien Villemot 115a0a8e5d
Bytecode: simplify Interpreter::Read_SparseMatrix() 2023-10-19 16:52:48 -04:00
Sébastien Villemot e5bf3f79b3
Bytecode: simplify Interpreter::fixe_u() 2023-10-19 16:48:00 -04:00
Sébastien Villemot 197347c870
Bytecode: merge two methods 2023-10-19 16:43:40 -04:00
Sébastien Villemot e104318e6b
Bytecode: simplify Interpreter::Simulate_Newton_Two_Boundaries() 2023-10-19 16:38:51 -04:00
Sébastien Villemot 68cee02eb5
Bytecode: simplify Interpreter::check_for_controlled_exo_validity() 2023-10-19 16:33:54 -04:00
Sébastien Villemot fdb3cd0623
Bytecode: simplify Interpreter::compute_complete() 2023-10-19 16:31:50 -04:00
Sébastien Villemot 8e74322325
Bytecode: rename a method for clarity 2023-10-19 15:58:33 -04:00
Sébastien Villemot af1985d569
Bytecode: mark function as static 2023-10-19 15:56:55 -04:00
Sébastien Villemot fd16bbe493
Bytecode: simplify Interpreter::initializeTemporaryTerms() 2023-10-19 15:56:39 -04:00
Sébastien Villemot 6809819961
Bytecode: simplify Interpreter::compute_complete_2b() 2023-10-19 15:47:10 -04:00
Sébastien Villemot bbcbcd1eed
Bytecode: improve interface of methods for looking through Jacobian sparse matrix 2023-10-19 14:50:07 -04:00
Sébastien Villemot b747eff473
Bytecode: remove unused method 2023-10-19 14:19:01 -04:00
Sébastien Villemot a9c581e2bc
No longer forbid bytecode with order=2 or k_order_solver
The two are now compatible, even though the bytecode representation will not be
used. Print a warning to make this explicit.
2023-10-19 14:10:43 -04:00
Sébastien Villemot 846ed7e829
Bytecode: merge class dynSparseMatrix into Interpreter
These two classes were so entangled that their separation was meaningless.
2023-10-19 13:56:10 -04:00
Sébastien Villemot 654b4e57a2
Bytecode: remove several unused class members of SparseMatrix 2023-10-19 10:59:23 -04:00
Sébastien Villemot 06ac452459
Cosmetics: remove empty list of parameters for lambda functions 2023-10-19 09:56:55 -04:00
Sébastien Villemot ed4824f956
Merge branch 'zero-moments-tolerance' of git.dynare.org:wmutschl/dynare
Ref. !2199
2023-10-19 08:35:48 -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
Willi Mutschler da4bc40e66
Make undocumented zero_moments_tolerance option local to disp_moments
See discussion in https://git.dynare.org/Dynare/preprocessor/-/merge_requests/85
2023-10-18 23:27:45 +02:00
Sébastien Villemot 5145bd0708
New option “relative_to_initval” to “mshocks” block 2023-10-18 16:45:06 -04:00
Sébastien Villemot d78dea3086
Use __builtin_unreachable() to silent some GCC warnings
This is cleaner than using exit() for that purpose.
2023-10-18 14:28:54 -04:00
Sébastien Villemot daa6b5569d
mshocks: better match to the semantics given in the manual
Ensure that the block is always interpreted multiplicatively relative to the
steady state, and not relative to the pre-existing shock value (if there was
already a shock declared for the same exogenous and period(s)).
2023-10-18 14:28:54 -04:00
Sébastien Villemot 357076feb4 Merge branch 'macos-installer-website' into 'master'
CI: deploy unstable versions of macOS arm64

See merge request Dynare/dynare!2198
2023-10-18 15:45:16 +00:00
Willi Mutschler e03d6f3c1f
CI: deploy unstable versions of macOS arm64 2023-10-18 02:34:31 +02: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 66ccb3b3d3
Manual: fix typo in description of “multiply” keyword in “shocks(learnt_in=…)” block
Also add a missing word.
2023-10-17 17:19:20 -04:00
Sébastien Villemot 113cfb9c47
Merge branch 'macos-installer' of git.dynare.org:wmutschl/dynare
Ref. !2197
2023-10-17 09:26:47 -04:00
Sébastien Villemot 9a0462a8a6
Bytecode: remove a couple of useless casts 2023-10-16 18:06:42 -04:00
Sébastien Villemot 06a7acf19b
Bytecode: enforce consistent typing of size variables 2023-10-16 18:00:11 -04:00
Sébastien Villemot 651fed87be
Bytecode: remove warnings about narrowing (-Wnarrowing) 2023-10-16 17:58:36 -04:00
Sébastien Villemot b0fa610357
Bytecode: remove warnings about uninitialized variables (-Wmaybe-uninitialized)
By the way, in the dynamic case, ensure that solve_algo variable corresponds to
options_.solve_algo; it would previously correspond to
options_.stack_solve_algo, while there is already a separate stack_solve_algo
variable for that purpose.
2023-10-16 17:43:20 -04:00
Willi Mutschler fb63a8eadb
macOS installer: fix typo in welcome page 2023-10-16 22:12:09 +02:00
Sébastien Villemot eae9902cb8
Bytecode: restrict scope of some variables 2023-10-16 15:39:13 -04:00
Sébastien Villemot 3e5591d41f
New “static_mfs” option to the “model” block (and the “model_options” command) 2023-10-16 11:57:02 -04:00
Sébastien Villemot 4875554a39
Perfect foresight homotopy: make marginal linearization more robust
For marginal linearization, an extra simulation is needed. This extra
simulation is first computed using the first simulation as guess value. If that
does not work, the present commits adds an additional attempt for computing
that extra simulation, using a full homotopy loop from the beginning.

As a consequence, the present commits puts the homotopy loop in a dedicated
function.
2023-10-13 15:31:44 -04:00
Sébastien Villemot 2ae485705e
Perfect foresight homotopy: turn a nested function into a local one
The behaviour of local functions is easier to understand, since they do not
have access to the workspace of the caller.
2023-10-13 14:40:45 -04:00
Sébastien Villemot 4f74ceb937
Testsuite: fix issue with Octave in a Wayland desktop session
If under a Wayland desktop session, some graphics would be displayed on the
screen, despite Octave being run in the virtual X11 frame buffer (xvfb).
Moreover, some unexplained random crashes would occur.

This commit ensures that Wayland is never used when running the testsuite.

By the way, add a command to explain why xvfb-run is needed and the
--no-window-system option cannot be run (see commit
96346b77e5).
2023-10-13 14:39:55 -04:00
Sébastien Villemot cc7c024389
Perfect foresight homotopy: display the full output of every iteration
As a consequence, print the full iterations summary table after each iteration.
2023-10-13 09:19:10 -04:00
Sébastien Villemot 9ebd8a8372
Make perfect foresight hotomopy loop more readable
Only modify oo_ when the homotopy procedure is finished, now that oo_ is no
longer an input to perfect_foresight_solver_core.

By the way, fix the treatment of the exogenous steady state (it is now set
in a consistent way with the endogenous steady state, if the shock is not
simulated up to 100%).

Also fix the initial guess when doing a second attempt at recomputing the
terminal steady state and failing (in the absence of a permanent shock). It was
supposed to use the initial steady state as an initial guess for that second
attempt (through oo_.steady_state), but since that latter variable was modified
in the loop, it would actually correspond to the same initial guess as in the
first attempt.
2023-10-13 09:16:37 -04:00
Sébastien Villemot e26f3f5d06
Build system: remove trailing space in parsed Octave version 2023-10-12 16:00:09 -04:00
Sébastien Villemot a6eb943aae
Remove oo_ as an input argument to perfect_foresight_solver_core 2023-10-12 15:44:53 -04:00
Sébastien Villemot cd17a2dd6d
CI: reenable running of test_matlab job by default
It had been inadvertently disabled in commit
16be379493.
2023-10-12 15:02:55 -04:00
Sébastien Villemot 20e1540892 Merge branch 'macos-installer' into 'master'
Improvements to macOS installer

Closes #1893, #1790, and #1894

See merge request Dynare/dynare!2149
2023-10-12 18:37:00 +00:00
Sébastien Villemot e4a4d2d8e6
Bytecode MEX: get M_ and options_ through input arguments rather than as global variables 2023-10-11 18:50:32 -04:00
Sébastien Villemot b59dc2cf1a
det_cond_forecast: fix bug with bytecode+block
The plan must immediately follow the “extended_path” string in the input
arguments of bytecode. Bug introduced in f84753025d.
2023-10-11 18:50:32 -04:00
Sébastien Villemot 88146bcc6f
solve_block_decomposed_problem: drop oo_ as an input argument 2023-10-11 18:50:32 -04:00
Sébastien Villemot a241aa2bd7
Drop (almost empty) initvalf.m wrapper 2023-10-11 18:50:32 -04:00
Sébastien Villemot f94e7ae9a6
Perfect foresight homotopy: display duration of every iteration 2023-10-11 18:50:32 -04:00
Sébastien Villemot b4e2a0be48
Manual: fix typo in name of perfect_foresight_with_expectation_errors_solver 2023-10-11 18:50:31 -04:00
Stéphane Adjemian (Ryûk) 2c923c613b
Closes #1835. 2023-10-11 21:40:59 +02:00
Willi Mutschler 16be379493
CI: add job to create arm64 macOS pkg 2023-10-11 17:47:10 +02:00
Willi Mutschler 987c6f2e00
macOS installer: improve reference manual 2023-10-11 17:34:43 +02:00
Willi Mutschler a3b05f6d74
macOS installer: improve welcome and conclusion of installer
[skip ci]
2023-10-11 17:34:43 +02:00
Willi Mutschler 6d2958625d
macOS installer: force non-admin installs
[skip ci]
2023-10-11 17:34:43 +02:00
Willi Mutschler 3d057a6605
macOS installer: fix typo 2023-10-11 17:34:43 +02:00
Willi Mutschler 5213adc0ad
macOS installer: clarify Xcode CLT license in conclusion page 2023-10-11 17:34:43 +02:00
Willi Mutschler cb0ece6d82
manual: fix typo
[skip ci]
2023-10-11 17:34:43 +02:00
Willi Mutschler d5649a53fa
macOS built script: make shellcheck happy
Added double quotes to variables
2023-10-11 17:34:43 +02:00
Willi Mutschler bb3aa0a206
macOS installer: cosmetical changes 2023-10-11 17:34:43 +02:00
Willi Mutschler cc9102248c
macOS installer: improve sed command to get GCC version 2023-10-11 17:34:43 +02:00
Willi Mutschler 6e98e9849f
macOS installer: add instructions if /Applications/Dynare is owned by root 2023-10-11 17:34:43 +02:00
Willi Mutschler cdd632ed07
macOS installer doc: fix capitalization of GCC and path to Clang 2023-10-11 17:34:43 +02:00
Willi Mutschler 01c1df6c93
README: improve macos compilation instructions 2023-10-11 17:34:43 +02:00
Willi Mutschler 81b2fe4c88
manual: change macOS version 2023-10-11 17:34:43 +02:00
Willi Mutschler 158abbd0fd
macOS installer: create both arm64 and x86_64 packages 2023-10-11 17:34:43 +02:00
Willi Mutschler 83910ddae3
macOS installer: don't require admin + ability to change install path
id="org.dynare.VERSION_NO_SPACE" fixes #1790, i.e old Dynare versions will not get uninstalled.
2023-10-11 17:34:43 +02:00
Willi Mutschler d480bbdcac
manual: workaround if MATLAB does not see Xcode license agreement
because MATLAB checks the directory of Xcode and not of the Command Line Tools
2023-10-11 17:34:43 +02:00
Willi Mutschler de5b37fca7
macOS installer: remove gcc option and local homebrew install
Fixes #1893
Closes #1894
Explain how to get Xcode CLT and gcc via homebrew in installer at the end using a conclusion.html file.
Clarify this also in the manual.
2023-10-11 17:34:43 +02:00
Sébastien Villemot 9d95dadb13
macOS package: another workaround for XCode 15 2023-10-11 11:09:07 -04:00
Sébastien Villemot c1a46fed91
CI: another workaround for macOS with XCode 15 2023-10-11 11:01:16 -04:00
Stéphane Adjemian (Argos) 06926e0153
Bug fix (missing semicolon). 2023-10-11 15:47:57 +02:00
Sébastien Villemot cfb8a1d15a
Merge branch 'linker-issue-macos' of git.dynare.org:wmutschl/dynare
Ref. !2194
2023-10-11 09:35:05 -04:00
Sébastien Villemot cf9ea686ef
Merge branch 'dynare-newrat'
Ref. !2193
2023-10-11 09:33:33 -04:00
Johannes Pfeifer a00eb5e1de
stoch_simul.m: add nomodelsummary option 2023-10-11 09:31:40 -04:00
Johannes Pfeifer cbf57b1af6
set_state_space.m: remove unused options_ input argument 2023-10-11 09:30:45 -04:00
Johannes Pfeifer 328f6f3229
check.m and model_diagnostics.m: use consistent global naming 2023-10-11 09:26:05 -04:00
Johannes Pfeifer 36a2a41e35
Add function signatures for command line functions 2023-10-11 09:26:05 -04:00
Johannes Pfeifer 6f8fc22d57
bug: internals.m: account for new location of results files in 5.x 2023-10-11 09:26:05 -04:00
Johannes Pfeifer 0e468103d9
manual: correct syntax of prior CLI
Comma separated lists do not work
2023-10-11 09:26:05 -04:00
Johannes Pfeifer 7f5d8b81c2
bug: minus_logged_prior_density.m: fix expected dimension of unused output arguments
Hessian needs to be empty for newrat
2023-10-11 09:26:04 -04:00
Johannes Pfeifer f0b10ca9df
Octave: workaround for intersect with stable flag providing wrong third output (Octave bug #60347)
Uses function removed in 47477e152a
2023-10-11 09:26:04 -04:00
Johannes Pfeifer d5f8d3fffe
check_model.m: add check for negative variances to prevent cryptic message about correlations 2023-10-11 09:26:04 -04:00
Johannes Pfeifer 94207ab851
🐛 check_for_calibrated_covariances.m: correct logic of check
Did not properly distinguish between unset correlation and starting value of 0
2023-10-11 09:26:04 -04:00
Johannes Pfeifer a67cd58d1f
fs2000_corr_ME.mod: switch to simulated, longer data set 2023-10-11 09:26:04 -04:00
Johannes Pfeifer 5a3ae27b13
set_all_parameters.m: only operate on covariance matrices if necessary 2023-10-11 09:26:04 -04:00
Johannes Pfeifer 2eb9475e0e
🐛 make sure output arguments are set before return 2023-10-11 09:26:03 -04:00
Willi Mutschler 0a3f4220df
macOS: use ld_classic as workaround for linker issue with XCode 15
XCode 15 (on Ventura and Sonoma) has a linker issue, see https://github.com/mesonbuild/meson/issues/12282, workaround is to use ld_classic
2023-10-11 00:29:55 +02:00
Sébastien Villemot 8cc646fbf6
Bytecode MEX: remove syntax where no MATLAB array is passed
Those arrays were then read via oo_ and options_.

As a consequence, this commit drops the dependency of bytecode MEX upon the oo_
global variable.
2023-10-10 17:44:14 -04:00
Sébastien Villemot 03433112a4
Testsuite: add tests for print_bytecode_{static,dynamic}_model commands 2023-10-10 17:42:12 -04:00
Sébastien Villemot dcdbd85b10
Bytecode: fix indentation in output of print_bytecode_{static,dynamic}_model commands 2023-10-10 17:41:38 -04:00
Sébastien Villemot 9525dbe3a8
Bytecode: do not restrict print_bytecode_{static,dynamic}_model to certain values of {stack_,}solve_algo 2023-10-10 17:32:33 -04:00
Sébastien Villemot c329b4ff11
Bytecode: fix bug in print_bytecode_{static,dynamic}_model commands
The FENDEQU tag was not properly handled when printing.
2023-10-10 17:31:48 -04:00
Sébastien Villemot d584317a6a
Bytecode: remove unused methods 2023-10-10 16:54:09 -04:00
Sébastien Villemot 5e7b7ec7b0
Bytecode MEX: remove support for unused “plan” and “pfplan” arguments 2023-10-10 14:49:15 -04:00
Sébastien Villemot e5b7ddbb33
Manual: fix typos in conditional forecasting section 2023-10-10 14:49:11 -04:00
Sébastien Villemot 2e3fbfc040
New option “from_initval_to_endval” to “homotopy_setup” block 2023-10-10 13:19:12 -04:00
Sébastien Villemot 6b44e08daa
steady: add check over the value of homotopy_mode option 2023-10-06 16:41:54 -04:00
Sébastien Villemot 7f6f66c1c9
steady: add a warning if homotopy_setup block is present but homotopy_mode=0 2023-10-06 16:17:09 -04:00
Sébastien Villemot 82ea15e5e7
Manual: steady / document homotopy_mode = 0 2023-10-06 16:15:01 -04:00
Sébastien Villemot 727f925f01
steady: set a more sensible default value for homotopy_steps (10)
Also document it.
2023-10-06 16:11:53 -04:00
Sébastien Villemot d4b6e61497
steady: check that the homotopy_setup block is present when homotopy_mode is specified 2023-10-06 16:07:41 -04:00
Sébastien Villemot c3680b9f85
steady: fix typo in comments 2023-10-06 16:02:02 -04:00
Sébastien Villemot 4dea001d8d
steady: variable renamings in relation to homotopy
– use consistent naming for M_, oo_, options_
– use more explicit names for a few other variables
2023-10-06 15:42:34 -04:00
Sébastien Villemot 068070d336
steady: various refactoring related to homotopy
- homotopy_mode = 2: in case of failure, print last successful point as in the
  other two modes
- homotopy_mode = 1: if there is a failure at the first iteration (starting
  values), do not incorrectly report that there was a successful point
- homotopy_mode = 3: if there is a failure at the first iteration (starting
  values), honour the option homotopy_force_continue
– homotopy2: remove globals
2023-10-06 15:42:31 -04:00
Sébastien Villemot 375f65c213
Merge branch 'dynare-octave_fig'
Ref. !2192
2023-10-05 10:28:59 -04:00
Johannes Pfeifer 32d5bc05a1
Octave: support ofig graph format 2023-10-05 10:28:28 -04:00
Sébastien Villemot d77561e241
Update comment following the switch to Meson
[skip ci]
2023-10-03 15:02:07 +02:00
Sébastien Villemot e4afa5eee0 Merge branch 'more_globals' into 'master'
Eliminate some more globals

See merge request Dynare/dynare!2187
2023-10-03 12:48:34 +00:00
Sébastien Villemot da9789038d Merge branch 'silent_test' into 'master'
testsuite: use silent_optimizer option to not clutter meson log-file

See merge request Dynare/dynare!2190
2023-10-02 14:27:45 +00:00
Johannes Pfeifer 7ff7561280 Use consistent variable naming and add/fix headers 2023-10-02 11:12:31 +02:00
Johannes Pfeifer 3a115d4fcc Remove full oo_ input from likelihood functions 2023-10-02 09:48:34 +02:00
Johannes Pfeifer 268a668f32 occbin.dynare_resolve.m: remove oo_ structure as full input 2023-10-02 09:29:15 +02:00
Johannes Pfeifer ab61f79c9e dsge_likelihood.m: use consistent naming of global objects 2023-10-02 09:24:32 +02:00
Johannes Pfeifer f34653b0f7 mom.objective_function.m: remove unused input 2023-10-02 09:22:36 +02:00
Johannes Pfeifer fa29689b13 mom.get_data_moments.m: do not pass full oo_ structure 2023-10-02 09:19:29 +02:00
Johannes Pfeifer acb9518dec get_perturbation_params_derivs and friends: do not pass full oo_ structure 2023-10-02 09:18:58 +02:00
Johannes Pfeifer 7da5ff4fad gsa: reduce sample size of tests 2023-10-01 18:04:35 +02:00
Johannes Pfeifer c5ab1c7f11 Decrease waitbar refresh rates to not clutter the console output 2023-10-01 18:04:34 +02:00
Johannes Pfeifer 776c247b9b testsuite: use silent_optimizer option to not clutter meson log-file 2023-10-01 18:04:16 +02:00
Johannes Pfeifer e65662151f Eliminate set_dynare_seed.m calls with globals 2023-09-28 17:00:21 +02:00
Sébastien Villemot f2abdb6ec8
Merge branch 'doc' of git.dynare.org:wmutschl/dynare
Ref. !2188
2023-09-28 15:38:17 +02:00
Sébastien Villemot 285c1ef244
Preprocessor: gracefully handle division by zero when attempting equation normalization 2023-09-28 15:36:00 +02:00
Sébastien Villemot 0e5bba7567
Testsuite: fix workaround for TeX option with MATLAB R2014a
MATLAB R2014a run with -nodisplay crashes with the TeX option. A workaround was
introduced in commit f946baf6c5. The present
commit updates this workaround following the move to the Meson build system.

By the way, use consistent variable naming in tests/run_mod_file.m.
2023-09-28 15:17:00 +02:00
Sébastien Villemot 2600a878da
Testsuite: tolerance increase
estimation/fs2000_model_comparison.mod fails with MATLAB R2023b on the “pluto”
runner (which has AVX2).
2023-09-28 11:46:21 +02:00
Stéphane Adjemian (Argos) 85e9ec7fdc
Fix cherrypicked models without parameters or exogenous variables. 2023-09-28 09:39:18 +02:00
Stéphane Adjemian (Ryûk) de626fb4e8
Add remark.
[skip ci]
2023-09-28 09:01:37 +02:00
Sébastien Villemot b4a34f8ebc
Preprocessor: no longer write bytecode for discretionary optimal policy models
These models don’t have as many variables as equations, and this case is not
supported by bytecode.
2023-09-27 14:51:57 +02:00
Sébastien Villemot ceff825ed4
Fix typo 2023-09-27 13:24:51 +02:00
Sébastien Villemot befe645728
Simplify function for getting the path to MEX files
This function could optionally modify the path, but that possibility was never
used.
2023-09-27 13:24:51 +02:00
Sébastien Villemot 432fd2d1b1
aggregate: Octave compatibility fix
The textscan() function under Octave does not accept delimiters specified as a
cell array.
2023-09-27 12:27:47 +02:00
Sébastien Villemot 2993c79a85
Preprocessor update
– fix illegal memory access when doing Ramsey
– use same default variable cleaning rule under Octave as under MATLAB ⩾ 8.6
2023-09-27 12:27:28 +02:00
Sébastien Villemot 50319b7620
Build system: fix compilation of MS-SBVAR MEX under Linux+Octave
Add the -Bsymbolic linker flag. This ensures that the main() symbols defined in
both MS-SBVAR MEX won’t step on each other.
2023-09-27 11:41:14 +02:00
Willi Mutschler e6aff20142
doc: clarify NumberOfThreadsPerJob and SingleCompThread
[skip ci]
2023-09-27 10:40:27 +02:00
Sébastien Villemot b65f641b72 Merge branch 'doc' into 'master'
Documentation: parallel SingleCompThread option

See merge request Dynare/dynare!2186
2023-09-27 06:59:15 +00:00
Willi Mutschler 2c2d93f36b
doc: clarify SingleCompThread option
[skip ci]
2023-09-27 08:22:28 +02:00
Sébastien Villemot 64f47723bf
Testsuite: fix batch arguments for old MATLAB under Linux 2023-09-26 16:55:05 +02:00
Sébastien Villemot 01833b8a76
Testsuite: factorization between MATLAB and Octave 2023-09-26 15:59:38 +02:00
Sébastien Villemot 82a2aeaae4
Block trust region MEX: gracefully handle the singular Jacobian case
When the Jacobian of the problem is singular, compute a solution to the least
squares problem instead of crashing.

Closes #1889
2023-09-26 15:30:33 +02:00
Sébastien Villemot c4a5c36c52
Merge branch 'dynare-dynare_estimation_1'
Ref. !2182
2023-09-25 17:18:07 +02:00
Johannes Pfeifer 9b86dd4c33
bug: simul_backward_model_init.m: fix error message 2023-09-25 17:17:37 +02:00
Johannes Pfeifer 13bf261088
prior_posterior_statistics_core.m: remove unused variables 2023-09-25 17:17:37 +02:00
Johannes Pfeifer 710a5fba52
slice: cosmetic changes 2023-09-25 17:17:37 +02:00
Johannes Pfeifer 6d8927775b
Remove unused steadystate_partial option and related inline function restricted_steadystate.m 2023-09-25 17:17:37 +02:00
Johannes Pfeifer bf7ac27fd7
prior_posterior_statistics_core.m: consolidate both forecast functions into one inline function 2023-09-25 17:17:37 +02:00
Johannes Pfeifer dc9560e610
selec_posterior_draws.m: remove global variables 2023-09-25 17:17:37 +02:00
Johannes Pfeifer b4104584a2
gmhmaxlik_core.m: remove unused global variables 2023-09-25 17:17:37 +02:00
Johannes Pfeifer 71b63c6e8e
Remove unused lik_algo-option 2023-09-25 17:17:37 +02:00
Johannes Pfeifer 8da98057b9
Have computation of decision rules and smoother only input and output required arguments instead of full oo_ and M_ 2023-09-25 17:17:34 +02:00
Sébastien Villemot 7557dfb70d
Meson: add install rules 2023-09-25 16:38:29 +02:00
Johannes Pfeifer 4fa5df0c24 simult.m: remove oo_ as input and output 2023-09-25 12:08:47 +02:00
Johannes Pfeifer 22c0f2279f non_linear_dsge_likelihood.m: rename variables 2023-09-25 12:08:45 +02:00
Johannes Pfeifer 01f29784d7 bug: initialize undefined variable in OccBin smoother 2023-09-25 12:08:44 +02:00
Johannes Pfeifer b5880e0e56 bug: minus_logged_prior_density.m: fix reading out of error codes 2023-09-25 12:08:43 +02:00
Johannes Pfeifer 5231fc04c1 Remove global variables from prior_posterior_statistics.m and PosteriorIRF.m 2023-09-25 12:08:41 +02:00
Johannes Pfeifer 782a2e8d69 dynare_estimation_1.m: move display and storing of classical smoother to separate function 2023-09-25 12:08:40 +02:00
Stéphane Adjemian (Ryûk) 6417520c09
Allow cherrypicking and aggregation with PAC/MCE. 2023-09-23 17:43:19 +02:00
Stéphane Adjemian (Ryûk) 8d7a5e69d7
Return Computing and preprocessing time. 2023-09-22 22:29:42 +02:00
Sébastien Villemot bdb385d17c
README.md: recommend pkgconf instead of pkg-config in MSYS2 2023-09-22 14:41:50 +02:00
Sébastien Villemot 9a1f150e38
Merge branch 'default_mode_compute' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2160
2023-09-22 14:35:45 +02:00
Sébastien Villemot b8412aba10
Meson: enable -Wold-style-cast warning when warning_level⩾2 2023-09-22 14:33:14 +02:00
Sébastien Villemot b117e2a540
Preprocessor: warnings removed 2023-09-22 14:32:48 +02:00
Sébastien Villemot bf9434f95f
Remove warnings about cast between incompatible function types (-Wcast-function-type) under Windows 2023-09-22 14:22:47 +02:00
Sébastien Villemot 9f3f1b00c6
MS-SBVAR MEX: remove all compilation warnings at warning_level=2 2023-09-22 13:56:51 +02:00
Sébastien Villemot 1e290daa44
Meson: add a few notes 2023-09-22 13:56:45 +02:00
Sébastien Villemot f4bcecc0d2
Add note about static_assert being a keyword in C23 2023-09-22 13:36:01 +02:00
Sébastien Villemot 4f1e5e1bc2
MS-SBVAR MEX: fixes related to C linkage (extern "C")
Also fix or remove various #ifdefs, and remove unused “int constant_seed”.
2023-09-22 13:31:44 +02:00
Sébastien Villemot 4a68cfcbd6
MS-SBVAR MEX: remove warning related to function not returning (-Wreturn-type) 2023-09-22 13:22:35 +02:00
Sébastien Villemot c424366440
CI: bump to MATLAB R2023b 2023-09-22 10:52:57 +02:00
Sébastien Villemot 5ae5102f89 CI: bump to MATLAB R2023b 2023-09-22 10:52:17 +02:00
Sébastien Villemot 7eb1959f66
Provisions for MATLAB R2023b 2023-09-22 10:49:27 +02:00
Sébastien Villemot 491c8785a9
README.md: add pkg-config dependency under MSYS2
[skip ci]
2023-09-20 18:41:49 +02:00
Sébastien Villemot d36b82e47c
README.md: fix name of meson package under MSYS2 2023-09-20 18:23:58 +02:00
Sébastien Villemot a54b29a384
Remove warnings about uninitialized stuff (-Wuninitialized)
I have no idea why moving these statements around removes the warnings (at
least under GCC 13). Probably an issue internal to GCC.
2023-09-20 17:38:58 +02:00
Sébastien Villemot 605ed45811
Meson: add extra Fortran warnings only if warning_level ⩾ 2 2023-09-20 17:16:24 +02:00
Sébastien Villemot 70866c7b70
Remove warnings about comparison of integer expressions of different signedness (-Wsign-compare) 2023-09-20 16:48:29 +02:00
Sébastien Villemot f23dd8c981
Remove warnings about impure functions that might not be evaluated (-Wfunction-elimination)
Mark various MATLAB/MEX primitives as pure.
2023-09-20 16:46:10 +02:00
Sébastien Villemot e0bc9f29a1
Remove warnings about unused parameters (-Wunused-parameter) 2023-09-20 16:30:02 +02:00
Sébastien Villemot 6dd55726e6
Drop autoconf/automake build system 2023-09-20 15:33:44 +02:00
Sébastien Villemot 83e1b307d2
Update build instructions for Meson 2023-09-20 15:13:55 +02:00
Sébastien Villemot 7984e08f99
Meson build system: do not fail if latexmk or sphinx-build cannot be detected 2023-09-20 14:58:28 +02:00
Sébastien Villemot 3845f965ba
CONTRIBUTING.md: no longer mention removed submodules 2023-09-20 14:12:11 +02:00
Sébastien Villemot 834b04bcb4
Testsuite: compatibility fix with MATLAB < R2017a
Double quotes were introduced in R2017a.
2023-09-20 14:00:55 +02:00
Sébastien Villemot e549bbba7a
Meson build system: testsuite now fully implemented
By the way, switch the CI to use the Meson testsuite, because some test files
have been modified and no longer work with the old build system.
2023-09-20 13:55:55 +02:00
Johannes Pfeifer 1f723ebd7e fs2000: remove asymptote in prior for rho, which caused corner solutions 2023-09-20 12:55:30 +02:00
Johannes Pfeifer 552e6575cc Use newrat as default mode-finder
Tends to perform better than csminwel
2023-09-20 12:55:29 +02:00
Sébastien Villemot 01ae836a99
Meson build system / Octave: fix use_dll option with perfect_foresight_problem and k-order MEX
The MEX extension was not properly passed at compile time.

This is the same issue as 6af9b5f268 for MATLAB.
2023-09-20 11:58:23 +02:00
Sébastien Villemot ba0fef9879
Meson build system: meson ⩾ 0.64.0 is required 2023-09-20 11:16:04 +02:00
Sébastien Villemot d731cb18e9
Windows and macOS packages: add missing dynare_version.m file 2023-09-20 10:53:10 +02:00
Sébastien Villemot 6f5e346bf6
Merge branch 'preparations_irf_matching' of git.dynare.org:wmutschl/dynare
Ref. !2181
2023-09-20 10:17:14 +02:00
Sébastien Villemot 7f2483ed38
Merge branch 'additional_optimizer_steps_doc' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2184
2023-09-20 10:16:08 +02:00
Sébastien Villemot 14a71a6d98
Merge branch 'additional_optimizer_steps' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2178
2023-09-20 10:15:38 +02:00
Sébastien Villemot 44f307ce45
Merge branch 'dynare-complex_resid'
Ref. !2155
2023-09-20 10:09:07 +02:00
Johannes Pfeifer 87ce652088
Account for complex value during resid and steady 2023-09-20 10:08:53 +02:00
Johannes Pfeifer f6a8473144 estimation: support additional_optimizer_steps
Closes https://git.dynare.org/Dynare/dynare/-/issues/1573
2023-09-19 18:14:24 +02:00
Sébastien Villemot c2897c8f14
Source package: use the Meson build system 2023-09-19 17:41:40 +02:00
Sébastien Villemot a252daee51
Windows package: use the Meson build system
By the way, simplify the dependency build system by removing unused SLICOT
builds.
2023-09-19 17:14:43 +02:00
Johannes Pfeifer 8032aa6e7e Manual: correct entry on additional_optimizer_steps supporting strings 2023-09-19 14:34:49 +02:00
Sébastien Villemot bb55e9ec2f Merge branch 'Octave' into 'master'
Clean up code related to fixed Octave bugs

See merge request Dynare/dynare!2180
2023-09-19 11:39:30 +00:00
Willi Mutschler 330b10ec85
cosmetical changes to headers and comments 2023-09-19 13:26:33 +02:00
Willi Mutschler 649f668dd1
cosmetical: don't use hh for figure/plot/table handles
We use it to denote the hessian and even store it in many mat files.
2023-09-19 13:26:33 +02:00
Willi Mutschler 66e7233018
Fix encoding of parallel.tex 2023-09-19 13:26:33 +02:00
Willi Mutschler c8be1a3274
Refactor mode_check codes 2023-09-19 13:26:33 +02:00
Willi Mutschler a41fbdefbc
estimation: more flexible handling of displayed string in command window
Also removed estim_params_ as unused input argutment to CutSample
2023-09-19 13:26:33 +02:00
Willi Mutschler 9a4e022eb7
remove global from GetAllPosteriorDraws 2023-09-19 13:26:33 +02:00
Willi Mutschler 268d511e29
estimation: better organize files into folders (latex,graphs,output) 2023-09-19 13:26:33 +02:00
Willi Mutschler 80ce86baf8
Manual: clarify location of Geweke convergence diagnostic matrices 2023-09-19 13:26:33 +02:00
Willi Mutschler 8f650a9cca
Put raftery lewis convergence under oo_.convergence 2023-09-19 13:26:33 +02:00
Johannes Pfeifer 7df3ff5059 dynare_solve.m: fix logic of initial guess randomization which forgot case of imaginary numbers 2023-09-19 12:52:55 +02:00
Johannes Pfeifer b0358b9939 dynare_solve.m: add option to disable randomization of starting value 2023-09-19 12:52:54 +02:00
Johannes Pfeifer 62c3a14026 get_error_message.m: fix typo in error message 2023-09-19 12:52:53 +02:00
Johannes Pfeifer dafe3fbdb2 evaluate_steady_state.m: do not require second solver call if debug is requested
All output has already been computed before
2023-09-19 12:52:52 +02:00
Johannes Pfeifer 757b6e10ec display_static_residuals: make output more legible in presence of tags 2023-09-19 12:52:51 +02:00
Johannes Pfeifer 624eabe2e8 dynare_solve.m: improve warning message 2023-09-19 12:52:50 +02:00
Johannes Pfeifer 68ff5c4110 evaluate_steady_state.m: Filter out small complex residuals 2023-09-19 12:52:49 +02:00
Sébastien Villemot e335fed27b
macOS package: use the Meson build system
By the way, simplify the dependency build system by removing 32-bit
SLICOT (was only used for the Octave package), and the symlinks for MatIO and
GSL (no longer needed with Meson).
2023-09-18 16:57:32 +02:00
Sébastien Villemot d573ff1507
CI: build documentation using Meson 2023-09-18 15:16:26 +02:00
Sébastien Villemot 049609cbbb
Meson build system: do not build documentation by default
[skip ci]
2023-09-18 13:42:29 +02:00
Sébastien Villemot db677f1bab
Meson build system: add documentation 2023-09-18 10:41:17 +02:00
Sébastien Villemot 7072776a60
Build system / Manual: use variables for specifying the version number
Rather than using a generated file. This will ease the transition to Meson.
2023-09-18 10:41:14 +02:00
Sébastien Villemot 63333fe041
Remove unused bibliography files for Collard’s guide
Also add a dependency of dr.pdf on dr.bib.
2023-09-16 14:25:41 +02:00
Sébastien Villemot d57ff73763
Meson build system: add suite name(s) to the tests
By the way, rename a few targets and variables so that they use the “k_order”
prefix instead of “korder”, for consistency with other targets.
2023-09-16 14:25:41 +02:00
Sébastien Villemot 3e0999a0fb
Meson build system: use Fortran 2018 standard by default 2023-09-16 14:25:41 +02:00
Sébastien Villemot 8c5d6f5eae
libkordersim: ensure strict Fortran standard compliance
The “order” variable was used before being typed. This is apparently accepted
by the GNU Fortran dialect.
2023-09-16 14:25:41 +02:00
Sébastien Villemot 9e7e069aa8
Fortran: use standard-compliant ieee_is_nan() instead of GNU extension isnan() 2023-09-16 14:25:40 +02:00
Sébastien Villemot 8a79899189
Meson build system: implement most of the testsuite
The tests that are individually listed in {M,O}_TRS_FILES of tests/Makefile.am
are still missing.
2023-09-16 14:25:38 +02:00
Sébastien Villemot 755138fb84
Meson build system: fix ms-sbvar MEX, they would not contain a mexFunction()
[skip ci]
2023-09-14 18:55:29 +02:00
Johannes Pfeifer ff83c4aea7 evaluate_steady_state_file.m: Octave bug 52568 was fixed in Octave 6 2023-09-14 16:55:13 +02:00
Sébastien Villemot db331c53d4
Merge branch 'display_static_residuals' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2176
2023-09-14 12:06:34 +02:00
Sébastien Villemot bea2d7905b
Merge branch 'dynare-bvar'
Ref. !2175
2023-09-14 12:05:59 +02:00
Johannes Pfeifer 14634946dc
🐛 bvar_irf: SquareRoot-option erroneously used Cholesky decomposition 2023-09-14 12:05:21 +02:00
Johannes Pfeifer 2b313b0308
BVAR: move to subfolder 2023-09-14 12:05:18 +02:00
Sébastien Villemot 126a1b74ea
Meson build system: fix compilation of k_order_perturbation MEX
[skip ci]
2023-09-13 18:30:25 +02:00
Johannes Pfeifer 838bb2f4b5 display_static_residuals.m: fix bug introduced in 4598dba40c 2023-09-13 15:26:05 +02:00
Sébastien Villemot e86b372464
Display more explicit error message when k_order_perturbation MEX fails 2023-09-13 15:06:51 +02:00
Sébastien Villemot a375cb5575
license.txt: update copyright years for Chris Sims’ files 2023-09-13 11:34:13 +02:00
Sébastien Villemot 43af789eda
Merge branch 'csminwel' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2172
2023-09-13 11:31:56 +02:00
Sébastien Villemot eb16bb4373
Merge branch 'dynare-osr_analytic'
Ref. !2171
2023-09-13 11:19:20 +02:00
Johannes Pfeifer 885fda0e20
OSR: allow using analytic gradient 2023-09-13 11:19:13 +02:00
Sébastien Villemot 46a34aaa6c
Merge branch 'doc_fix' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2170
2023-09-13 11:15:45 +02:00
Sébastien Villemot 53089ad6e5
Merge branch 'mom_bug' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2173
2023-09-13 11:14:56 +02:00
Johannes Pfeifer 2473b57782 Correct Johannes's old Cologne email 2023-09-12 21:07:57 +02:00
Johannes Pfeifer ac0ecde1d9 mom: fix incorrect options-reference 2023-09-12 19:24:32 +02:00
Sébastien Villemot 6af9b5f268
Meson build system: fix use_dll option with perfect_foresight_problem and k-order MEX
The MEX extension was not properly passed at compile time.

[skip ci]
2023-09-12 18:29:33 +02:00
Sébastien Villemot e67ca64d4b
Meson build system: add missing dependency of perfect_foresight_problem MEX 2023-09-12 17:38:34 +02:00
Johannes Pfeifer b8a1b63572 newrat.m: clean up files 2023-09-12 13:32:16 +02:00
Johannes Pfeifer 3895da48a1 🐛 Enable analytic_derivation for csminwel
Requires column vector output
2023-09-12 13:26:25 +02:00
Johannes Pfeifer 497c6bd1b1 csminwel1.m and csminwel1.m: cosmetic changes 2023-09-12 12:54:36 +02:00
Sébastien Villemot a57f81b3aa
Testsuite: move load_octave_packages.m to utils/ subdirectory 2023-09-12 12:39:26 +02:00
Johannes Pfeifer 8cc5ecf6ec Manual: fix reference 2023-09-11 17:16:11 +02:00
Sébastien Villemot 6037b9f096
Merge branch 'dynare-osr_globals'
Ref. !2166
2023-09-11 16:46:29 +02:00
Johannes Pfeifer 2b240210d0
OSR: Remove globals and wrapper layer, move to +subfolder 2023-09-11 16:46:08 +02:00
Sébastien Villemot a0ea6005e8
Merge branch 'dynare-globals'
Ref. !2167
2023-09-11 16:43:36 +02:00
Johannes Pfeifer 4598dba40c
display_static_residuals.m: remove globals 2023-09-11 16:43:26 +02:00
Sébastien Villemot f26a469208
Merge branch 'further_cosmetics' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2168
2023-09-11 16:26:44 +02:00
Sébastien Villemot 890c6b2e1d
Merge branch 'trace_plot' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2169
2023-09-11 16:25:31 +02:00
Sébastien Villemot 8d29d7b8d3
license.txt: adapt for move of allVL1.m
Implemented in commit 825763b18f.
2023-09-11 15:36:11 +02:00
Sébastien Villemot 4a0b87fdaf
Merge branch 'cosmetics' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2165
2023-09-11 15:34:52 +02:00
Sébastien Villemot dee66e8351
Merge branch 'cleanup' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2164
2023-09-11 15:33:09 +02:00
Johannes Pfeifer 91dd4d9a83 dyn_first_order_solver.m: remove reference to kstate 2023-09-09 09:23:07 +02:00
Johannes Pfeifer 7eaa974484 Remove unused disp_model_summary.m 2023-09-09 09:22:41 +02:00
Johannes Pfeifer baf8243fac generate_trace_plots.m: allow for plotting traces of multiple chains
Closes #1904
2023-09-08 22:04:25 +02:00
Johannes Pfeifer 825763b18f Move pruned_state_space functions to subfolder 2023-09-08 15:45:41 +02:00
Sébastien Villemot d601ca4a2e Merge branch 'var_decomp' into 'master'
Add variance decomposition for pruned state space

Closes #1836

See merge request Dynare/dynare!2163
2023-09-08 12:55:19 +00:00
Johannes Pfeifer af274aec3f Remove unused dsample.m and mcompare.m 2023-09-08 14:43:02 +02:00
Johannes Pfeifer 3a851dd8f3 disp_dr.m: remove globals 2023-09-08 14:42:38 +02:00
Johannes Pfeifer c72763501e Delete unused dcompare.m 2023-09-08 14:22:09 +02:00
Johannes Pfeifer 290f19c705 resol + stoch_simul.m: header fixes
Also makes global naming consistent
2023-09-08 11:59:37 +02:00
Johannes Pfeifer 74399f0728 🐛 fix check for Metropolis folder 2023-09-08 10:31:09 +02:00
Johannes Pfeifer 5ac11449ce slice: move saved files to subfolder 2023-09-08 10:27:35 +02:00
Johannes Pfeifer bd905360e0 Slice: provide convergence diagnostics even for low number of draws 2023-09-08 10:26:21 +02:00
Johannes Pfeifer 842bf3d687 csminwel1.m: clean up file 2023-09-08 10:02:14 +02:00
Sébastien Villemot cb0f0e6701
Merge branch 'dynare-irf_matching'
Ref. !2159
2023-09-08 09:45:51 +02:00
Willi Mutschler 2e742462b3
Rename McMCDiagnostics and McMCDiagnostics_core 2023-09-08 09:44:43 +02:00
Johannes Pfeifer cd05bfb8a2 Remove unused ghx2transition.m 2023-09-08 08:09:20 +02:00
Johannes Pfeifer c43308a07b forcst.m: remove redundant call to make_ex_ 2023-09-08 08:08:35 +02:00
Johannes Pfeifer 2fa6c437f7 solve_model_for_online_filter.m: remove redundant call to Lyapunov solver 2023-09-08 08:05:48 +02:00
Johannes Pfeifer 420cbc8202 kalman_transition_matrix.m: remove redundant input argument 2023-09-08 08:03:18 +02:00
Johannes Pfeifer 4e58e22bdd Variance decomposition with pruning: add unit test 2023-09-08 07:02:43 +02:00
Johannes Pfeifer c063d53646 th_autocovariances.m: fix matrix dimension 2023-09-07 18:09:28 +02:00
Johannes Pfeifer f2f1c48baf compute_moments_varendo.m: cosmetic fixes 2023-09-07 17:52:31 +02:00
Johannes Pfeifer 3dd1ffb8fe pruned_state_space_system.m: gracefully exit in case of unit roots 2023-09-07 17:52:18 +02:00
Johannes Pfeifer 41ac891f80 Factorize variance decomposition code 2023-09-07 17:13:09 +02:00
Willi Mutschler a0b443b9f8
Cosmetical changes to headers and message strings 2023-09-07 09:36:27 +02:00
Willi Mutschler 777ec76536
method_of_moments: cosmetical changes to cleanup 2023-09-07 09:36:27 +02:00
Willi Mutschler 55dc4a00d5
method_of_moments: refactor displaying of moments 2023-09-07 09:36:27 +02:00
Willi Mutschler e025d56a59
method_of_moments: refactor J-Test 2023-09-07 09:36:27 +02:00
Willi Mutschler 07b62fe554
method_of_moments: refactor iterated GMM/SMM estimation 2023-09-07 09:36:27 +02:00
Willi Mutschler 9dc4878f9f
method_of_moments: refactor printing of info to a utility function 2023-09-07 09:36:27 +02:00
Willi Mutschler e52c007d8b
method_of_moments: cosmetical changes to checks for objective function at initial parameters 2023-09-07 09:36:27 +02:00
Willi Mutschler fb326638f9
method_of_moments: remove redundant noconstant option check 2023-09-07 09:36:27 +02:00
Willi Mutschler e170b64713
method_of_moments: refactor steady-state check utility functions
Reuse same functions from full-information estimation command
2023-09-07 09:36:27 +02:00
Willi Mutschler b737d46d61
method_of_moments: cosmetical changes to smm shock series 2023-09-07 09:36:27 +02:00
Willi Mutschler 9914d764c2
method_of_moments: refactor data moments computation
Also rename function to not confuse this with the variable stored in oo_.mom.datamoments.
2023-09-07 09:36:27 +02:00
Willi Mutschler c0cae0ebaa
method_of_moments: cosmetical changes to mom.objective function 2023-09-07 09:36:27 +02:00
Willi Mutschler 0cd65df72a
method_of_moments: add warnings for problematic prior stderr/corr and value
Also moved oo_.prior to oo_.mom.prior
2023-09-07 09:36:27 +02:00
Willi Mutschler 017b4f05f6
method_of_moments: cosmetical changes on estimated params initializations 2023-09-07 09:36:27 +02:00
Willi Mutschler 1ef026dc9d
method_of_moments: factorize correct bounds for stderr and corr 2023-09-07 09:36:27 +02:00
Willi Mutschler 180b92cb1e
method_of_moments: refactor penalized estimation with laplace prior 2023-09-07 09:36:27 +02:00
Willi Mutschler c3327e000c
method_of_moments: refactor matched moments block transformations 2023-09-07 09:36:27 +02:00
Willi Mutschler 0487dd4a77
method_of_moments: refactor and function for default options & initializations
Also changed:
- options_mom_.vector_output to options_mom_.mom.vector_output
- optimizer_vec to options_mom_.optimizer_vec
- oo_.dr.obs_var to oo_.mom.obs_var
2023-09-07 09:36:27 +02:00
Willi Mutschler f25188cf2f
method_of_moments: improved header 2023-09-07 09:36:27 +02:00
Willi Mutschler 3c0f3c1c24
Factorize estimation: check steady-state (static, changes parameters) 2023-09-07 09:36:27 +02:00
Willi Mutschler 23f6019cdf
Factorize estimation: check prior stderr and corr parameters 2023-09-07 09:36:27 +02:00
Willi Mutschler 6941bd5516
Factorize estimation: wrapper for tune_mh_jscale 2023-09-07 09:36:27 +02:00
Willi Mutschler c356db4531
Factorize estimation: set_mcmc_jumping_covariance 2023-09-07 09:36:27 +02:00
Willi Mutschler aa99eff81d
Factorize estimation: set_mcmc_prior_bounds 2023-09-07 09:36:27 +02:00
Willi Mutschler 7f22414843
Factorize estimation: checks for VAROBS 2023-09-07 09:36:27 +02:00
Willi Mutschler 688d847489
Factorize estimation: check_mode_file 2023-09-07 09:36:27 +02:00
Willi Mutschler c21f75887d
Factorize estimation: check_hessian_at_the_mode 2023-09-07 09:36:27 +02:00
Willi Mutschler dd2c816df0
compute_mh_covariance_matrix: remove globals 2023-09-07 09:36:27 +02:00
Willi Mutschler d8105a3237
Cosmetical changes 2023-09-07 09:36:27 +02:00
Willi Mutschler 960c075420
Replace "Estimation::mcmc::" by a variable
This enables re-using estimation functions for other Bayesian estimation routines such as Bayesian method_of_moments and printing it nicer to the console.
2023-09-07 09:36:27 +02:00
Sébastien Villemot 6551b88fc8
Merge branch 'truncated_normal' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2161
2023-09-07 08:56:13 +02:00
Sébastien Villemot 9e2b387d0a
Merge branch 'prior_sampling' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2162
2023-09-07 08:55:18 +02:00
Johannes Pfeifer 8f79e848f0 Remove remnants of GPU code 2023-09-07 08:00:05 +02:00
Johannes Pfeifer 9afd75ca9b th_autocovariances.m: rework routing to clarify approach
Changes reflect model representation with 1 lag only
2023-09-06 22:14:19 +02:00
Johannes Pfeifer 7283838a0f dynare_config.m: sort added paths 2023-09-06 22:11:35 +02:00
Johannes Pfeifer 02b4242c75 Remove MATLAB:dividebyzero identifier
Was removed from Matlab
2023-09-06 15:09:39 +02:00
Johannes Pfeifer 5f68504919 prior sampling: suppress loop output 2023-09-06 14:14:31 +02:00
Johannes Pfeifer d60a19ce49 Finish implementation of truncated normal distribution
Closes https://git.dynare.org/Dynare/dynare/-/issues/1593
2023-09-06 12:46:41 +02:00
Sébastien Villemot 16f921ed62
Add Meson build system
Mostly working. The testsuite remains to be done.

In particular, windows/deps/mkoctfile64 is modified to print its version number
on stdout instead of stderr. This is what the standard mkoctfile does, and it
allows easier capture of the output from Meson.
2023-09-04 18:04:00 +02:00
Sébastien Villemot b0503ce994
macOS package: fix x13as clean rule
[skip ci]
2023-09-01 16:28:29 +02:00
Sébastien Villemot 6747f2130e
Perfect foresight: fix illegal memory read with bytecode + endval_steady
The exogenous steady state vector was passed as a row-vector to
evaluate_steady_state, thus leading to an incorrectly-sized matrix passed to
bytecode when checking the steady state on the dynamic model (when different
from the static model).
2023-09-01 14:52:57 +02:00
Sébastien Villemot bd9943a695
Bytecode: fix memory leak in Evaluate class
The newly-created FBEGINBLOCK_ and FCALL_ instances were freed using a
base-class pointer. But the latter does not have a virtual destructor.

Those class instances are now stored by value in containers, so that the
destructor of the derived class is used.
2023-09-01 14:52:57 +02:00
Sébastien Villemot 9e5bd75611
Manual: update Sumudu’s affiliation
[skip ci]
2023-09-01 14:52:57 +02:00
Sébastien Villemot 7e92438601 Merge branch 'x13' into 'master'
Allow x13 to deal with missing values

See merge request Dynare/dynare!2158
2023-08-31 08:43:49 +00:00
Johannes Pfeifer c70f2f1e4b Allow x13 to deal with missing values 2023-08-31 09:07:51 +02:00
Sébastien Villemot 0d21927381
Merge branch 'mod_comp' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2157
2023-08-30 11:47:22 +02:00
Sébastien Villemot 01011cb849
Merge branch 'shock_decomp' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2156
2023-08-30 11:46:47 +02:00
Sébastien Villemot 38f36258ed
Merge branch 'endogenous_prior' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2153
2023-08-30 11:45:54 +02:00
Sébastien Villemot 8888711266
Testsuite: remove workaround for glibc bug #19329
The bug is fixed in glibc 2.34, which is included in Debian “bookworm” 12 and
Ubuntu 22.04 LTS.
2023-08-30 11:38:01 +02:00
Sébastien Villemot bda2b1a1e9
Windows and macOS packages, README.md: bump to x13as 1.1-b60 2023-08-30 11:31:22 +02:00
Sébastien Villemot 1bbfcf426e
Windows package: bump to Octave 8.3.0 2023-08-30 11:28:20 +02:00
Sébastien Villemot 14bd989134
Manual: claim compatibility with Octave 8.3.0 2023-08-30 11:27:09 +02:00
Johannes Pfeifer e70b2fdfcf makedataset.m: account for short filenames 2023-08-29 16:15:34 +02:00
Johannes Pfeifer 183e6fbb3b model_comparison.m: account for short filenames 2023-08-29 16:14:50 +02:00
Johannes Pfeifer 9e53bd9967 shock_decomposition.m: do not overwrite other output
Closes https://git.dynare.org/Dynare/dynare/-/issues/1897
2023-08-29 14:40:10 +02:00
Stéphane Adjemian 4024ad7e99 Merge branch 'det_cond_forecast' into 'master'
det_cond_forecast.m: cosmetic changes to error messages

See merge request Dynare/dynare!2154
2023-08-29 10:42:30 +00:00
Johannes Pfeifer 0729ee72af det_cond_forecast.m: cosmetic changes to error messages 2023-08-24 12:38:50 +02:00
Johannes Pfeifer a85a00bfcf endogenous prior: fix logic of missing observations check
Message should only be displayed if there are missing observations
2023-08-23 09:32:24 +02:00
Sébastien Villemot b4f260aa01
folded_to_unfolded_dr MEX: remove unused variable 2023-07-27 17:29:32 +02:00
Sébastien Villemot b1db895dee
block_trust_region MEX: remove unused parameter 2023-07-27 17:29:31 +02:00
Sébastien Villemot 0442fe785e
libkordersim: only BLAS is used, not LAPACK 2023-07-27 09:44:34 +02:00
Sébastien Villemot 33719e69f2
Build system: libkorder no longer depends on MatIO 2023-07-26 16:30:51 +02:00
Sébastien Villemot 9ff1d8556c
libkorder: remove mention of Dynare++ in the journal
By the way, use PACKAGE_VERSION macro (instead of VERSION), for consistency
with the preprocessor.
2023-07-26 16:30:51 +02:00
Sébastien Villemot 801b774bcd
Manual: stochastic simulation with pruning now available at arbitrary order
Ref. #1643

[skip ci]
2023-07-24 09:16:28 +02:00
Stéphane Adjemian (Argos) 91825d4b5b
Fix cherrypick routine with max and min functions in model block. 2023-07-21 15:36:52 +02:00
Sébastien Villemot d9ff8dfeee Merge branch 'pruning' into 'master'
Adds pruning in k_order_simul

See merge request Dynare/dynare!2147
2023-07-21 08:17:09 +00:00
Normann Rion 710589eb5b Adds pruning in k_order_simul
See issue #1643 about beyond-third-order pruning
2023-07-20 06:58:35 +01:00
Stéphane Adjemian (Ryûk) c02e550582
Update dseries submodule.
Pass more than one variable name to remove and remove_ methods.
2023-07-19 18:23:08 +02:00
Sébastien Villemot 5b8b63924d
Remove unneeded braces 2023-07-19 18:03:18 +02:00
Sébastien Villemot 661e5c7e9f
C++17 modernization: initialization in “if”-statement 2023-07-19 18:03:03 +02:00
Sébastien Villemot d52aceeb16 Merge branch 'nblocks_load' into 'master'
load_*_mh_history_file: remove assignin statements

See merge request Dynare/dynare!2151
2023-07-18 15:55:37 +00:00
Johannes Pfeifer d2fecdc5d3 load_*_mh_history_file: remove assignin statements 2023-07-18 10:01:47 -04:00
Sébastien Villemot 4f4dc0e4f4 Merge branch 'nblocks_load' into 'master'
load_last_mh_history_file: make sure number of blocks and parameters matches loaded files

See merge request Dynare/dynare!2150
2023-07-18 12:59:35 +00:00
Sébastien Villemot 89376b188e
CI: new runner for signing Windows installers 2023-07-17 16:16:26 +02:00
Johannes Pfeifer 8532d6abd7 Cosmetic changes to various estimation routines 2023-07-13 14:40:01 -04:00
Johannes Pfeifer e6c43c2a29 load_last_mh_history_file: make sure number of blocks and parameters matches loaded files 2023-07-13 14:39:50 -04:00
Stéphane Adjemian (Ryûk) b5a74b96e5
Merge particles submodule into master. 2023-07-12 14:01:25 +02:00
Sébastien Villemot 7457c6d3db Merge branch 'docker' into 'master'
Add docker containers

See merge request Dynare/dynare!2148
2023-07-12 09:51:54 +00:00
Stéphane Adjemian (Ryûk) 21dcc911bc
Move files and delete unused folders and files. 2023-07-12 09:29:41 +02:00
Willi Mutschler b23c394972
Add docker containers 2023-07-09 11:09:36 +02:00
Willi Mutschler d4a8d0fc50
README: remove duplicate block in macOS instructions 2023-07-09 11:08:25 +02:00
Sébastien Villemot 3bdbfef301 Merge branch 'local_state_space_iteration_3' of git.dynare.org:normann/particles
Ref. particles!17
2023-07-04 11:21:46 +02:00
Normann Rion d2c324eeee Amends the various filters to fit the fixed version of local_state_space_iteration_3
See MR !2144 for more details
2023-07-01 16:43:48 +02:00
Sébastien Villemot e14c59384d CI: adapt for new location of MATLAB binaries 2023-05-30 15:53:17 +02:00
Stéphane Adjemian (Ryûk) 084e64cdac Use new prior draw interface. 2023-04-26 10:06:30 +02:00
Sébastien Villemot 5642e994fc CI: bump to MATLAB R2023a 2023-03-17 16:29:00 +01:00
Sébastien Villemot 704f3596cb CI: use system-wide Octave binary 2023-03-16 17:17:19 +01:00
Sébastien Villemot 3a5e38f49c CI: bump to Octave 7.3.0 2022-11-07 14:10:57 +01:00
Sébastien Villemot 58e98a78c6 Merge branch 'local_state_space_iteration_3' into 'master'
Amends particle filters to use the local_state_space_iteration_3 mex

See merge request Dynare/particles!16
2022-09-19 16:41:50 +00:00
Normann Rion 7721ea041c Amends particle filters to use the local_state_space_iteration_3 mex 2022-09-19 15:43:10 +02:00
Normann Rion 7fac60f5f6 Fix auxiliary_particle_filter.m: strange iteration range `for i=1:size(nodes)`
All hunks depending on this loop amended
2022-09-19 15:16:29 +02:00
Normann Rion ea01f8f22a Fix online_particle_filter.m: wrong condition for pruning in terms of order selection 2022-09-19 06:53:13 +01:00
Sébastien Villemot 9540313b93 CI: bump to MATLAB R2022b 2022-09-15 15:43:31 +02:00
Sébastien Villemot 550e48884a CI: bump to Octave 7.2.0 2022-09-06 11:17:59 +02:00
Sébastien Villemot 542e30d417 CI: bump to Octave 7.1.0 2022-04-15 14:29:20 +02:00
Sébastien Villemot eb6becfa82 Octave 7 compatibility fix: suppress spurious warnings
In this version of Octave, “warning on” really enables all warnings (while this
was not the case in Octave 6, suprisingly; I think this used to be different
with even older Octave releases).

We must therefore avoid to reenable all warnings after having disabled a
problematic one.
2022-04-15 14:17:34 +02:00
Sébastien Villemot 8a0dba1f88 Use Unicode copyright symbol (in UTF-8 encoding) in all source files
It is now supported by the MATLAB editor (as of R2022a).
2022-04-13 14:47:52 +02:00
Sébastien Villemot 90484edb0e Use Unicode copyright symbol (in UTF-8 encoding) in all source files
It is now supported by the MATLAB editor (as of R2022a).

[skip ci]
2022-04-13 13:24:51 +02:00
Sébastien Villemot 62ff3f3194 CI: bump to MATLAB R2022a 2022-03-24 17:21:26 +01:00
Frédéric Karamé 773cbd2f38 Routines moved out of the submodule. 2022-03-09 17:21:02 +01:00
Sébastien Villemot 84562f3568 Update calling sequence of local_state_space_iteration_k for new Fortran version 2022-02-04 11:49:38 +01:00
Sébastien Villemot 6cf56ec86c Merge branch 'online_filter' into 'master'
online_auxiliary_filter.m: fix infinite loop

See merge request Dynare/particles!15
2022-01-13 17:10:36 +00:00
Johannes Pfeifer 43dc073192 online_auxiliary_filter.m: fix infinite loop 2022-01-12 10:54:16 +01:00
Sébastien Villemot 95ce62b2f7 CI: bump to Octave 6.4.0 2021-11-09 18:10:21 +01:00
Sébastien Villemot 8ee74d84b0 Make method report_series/getRange.m public
It is called from top-level getMaxRange.m.

Closes: #18
2021-09-28 18:19:04 +02:00
Sébastien Villemot 13538155cc CI: bump to MATLAB R2021b 2021-09-24 15:34:10 +02:00
Sébastien Villemot ef84d0270d Fix detection of pdflatex following the deprecation of “which” in Debian Bookworm 2021-09-09 11:25:50 +02:00
Sébastien Villemot dc3aff7e1e CI: bump to Octave 6.3.0 2021-07-21 17:28:19 +02:00
Sébastien Villemot acd04951e3 Merge branch 'cosmetics' into 'master'
Alternative samplers: header fixes and indentation

See merge request Dynare/particles!13
2021-07-21 14:37:23 +00:00
Johannes Pfeifer c03862e71b Alternative samplers: header fixes and indentation 2021-07-21 12:33:54 +02:00
Sébastien Villemot 91736d3d8b Merge branch 'options_removal' into 'master'
Remove redundant options output

See merge request Dynare/particles!12
2021-06-22 16:15:49 +00:00
Johannes Pfeifer e544f1d860 Remove redundant options output 2021-06-22 14:31:29 +02:00
Stéphane Adjemian (Ryuk) 3da7ded1da Remove unused variables. 2021-06-15 21:44:08 +02:00
Stéphane Adjemian (Ryuk) 35ff1c0261 Cosmetic change (removed useless square brackets). 2021-06-15 21:43:14 +02:00
Stéphane Adjemian (Ryuk) fb8301d87e Fix call to fprint. 2021-06-15 21:43:00 +02:00
Stéphane Adjemian (Ryuk) a4ef4676d1 Fix online filter output.
The plot showing the evolution, along the sample, of thye particles
was crashing because of a missing function.
2021-06-15 21:40:03 +02:00
Sébastien Villemot 8a4b75bc5c Use secure URL for link to GNU licenses 2021-06-09 17:21:49 +02:00
Sébastien Villemot e3138abef8 Use secure URL for link to GNU licenses 2021-06-09 17:15:17 +02:00
Sébastien Villemot 19d7e2ce86 CI: bump to MATLAB R2021a 2021-03-17 17:42:20 +01:00
Sébastien Villemot 9b3d061f98 CI: bump Octave version to 6.2.0 2021-03-08 14:58:26 +01:00
Stéphane Adjemian 8d0c555627 Merge branch 'online_filter' into 'master'
Bug fixes for online filter

See merge request Dynare/particles!11
2021-02-26 08:55:28 +00:00
Johannes Pfeifer e953ba562c solve_model_for_online_filter.m: correct dimension of H matrix 2021-01-26 09:15:43 +01:00
Johannes Pfeifer e49cdefac3 Port state variance initialization fix from dab5d38068 2021-01-26 09:14:34 +01:00
Johannes Pfeifer 0c6151df7a solve_model_for_online_filter.m: fix reduced form dimensions for oder=2 matrices at order=1 2021-01-26 09:12:00 +01:00
Stéphane Adjemian (Charybdis) d1ff573c67 Do not rely on internal representation of @dates (use methods instead). 2021-01-15 20:35:47 +01:00
Sébastien Villemot d1ea4e75e5 CI: use variables for chosing MATLAB and Octave versions 2020-12-17 16:32:52 +01:00
Sébastien Villemot 173d5d9270 Merge branch 'apf' into 'master'
auxiliary_particle_filter.m: set undefined variable

Closes dynare#1718

See merge request Dynare/particles!10
2020-11-13 11:54:19 +00:00
Johannes Pfeifer 5714ebf298 auxiliary_particle_filter.m: set undefined variable
Closes https://git.dynare.org/Dynare/dynare/-/issues/1718
2020-11-13 11:35:44 +01:00
Sébastien Villemot 68ae83c25c Rename @graph class to @report_graph, to avoid name clash with MATLAB’s @graph
Closes: #17
2020-10-20 14:38:18 +02:00
Sébastien Villemot b7996a0610 Merge branch 'Latex' into 'master'
Consistently use LaTeX labels in figures instead of relying on psfrag

See merge request Dynare/particles!9
2020-06-18 14:20:39 +00:00
Johannes Pfeifer 389bdc23f2 Fix eps-TeX-loaders 2020-06-18 13:14:00 +02:00
Johannes Pfeifer 6f3a0298e3 Consistently use LaTeX labels in figures instead of relying on psfrag 2020-06-17 20:32:40 +02:00
Sébastien Villemot 909025639c Bump old MATLAB version to R2014a 2020-04-07 11:52:48 +02:00
Stéphane Adjemian (Charybdis) 5a9ddc405e Allow k order approximation in online filter (mode_compute=11).
Ref. dynare#1673
2020-02-15 16:50:32 +01:00
Stéphane Adjemian (Charybdis) e6f75e4b18 Allow k order approximation in conditional particle filter (cpf).
Ref. dynare#1673
2020-01-27 10:41:07 +01:00
Stéphane Adjemian (Charybdis) 7d8c922b78 Allow k order approximation in Gaussian Mixture Filter (gmf).
Ref. dynare#1673
2019-12-23 17:57:50 +01:00
Stéphane Adjemian (Charybdis) ae23c01d1c Allow k order approximation in Gaussian Filter (gf).
Ref. dynare#1673
2019-12-21 12:06:41 +01:00
Stéphane Adjemian (Charybdis) 8cd20070d2 Allow k order approximation in nonlinear Kalman Filter (nlkf).
Ref. dynare#1673
2019-12-21 10:44:23 +01:00
Stéphane Adjemian (Charybdis) 6e27946a04 Allow k order approximation in Auxiliary Particle Filter.
Ref. dynare#1673
2019-12-21 10:39:36 +01:00
Stéphane Adjemian (Charybdis) b8180f3328 Allow k order approximation in SIP filter. 2019-12-20 11:21:13 +01:00
Houtan Bastani 9988ba358d handle `showDate` option of report class when creating title page 2019-11-29 11:59:05 +01:00
Houtan Bastani 48c58cd6c0 add missing argument from 081ca98851077266a15128eacbf5c0210c8889a0 2019-11-29 11:53:16 +01:00
Houtan Bastani 080f90119c fix comment for `maketoc` 2019-11-29 11:42:28 +01:00
Houtan Bastani cd483463b5 Create TOC
closes #12
2019-11-29 11:12:30 +01:00
Houtan Bastani 0c1569db72 report title was not being written 2019-11-28 16:25:22 +01:00
Houtan Bastani 1c7b3b09f5 allow for the removal of headers and footers from a given page. closes #15 2019-11-06 13:02:29 -05:00
Houtan Bastani 87f815d701 allow user to set page number. closes #14 2019-11-06 11:49:30 -05:00
Houtan Bastani 6fe23556f6 split up report output. closes #13
Create new files for the preamble, the body of the report, and each individual page of the report.
2019-11-06 11:12:43 -05:00
Houtan Bastani bc55bdb2a6 make horizontal line length == \linewidth 2019-10-25 17:25:01 +02:00
Houtan Bastani ce1c8c5bc2 add test for addData 2019-10-24 11:59:49 +02:00
Houtan Bastani b70a5269ee make column_names work correctly for addData 2019-10-24 11:59:48 +02:00
Houtan Bastani a717cc2ad4 only allow addData to be used once per table 2019-10-24 11:59:48 +02:00
Houtan Bastani 7e47f128d9 fix typo in comment 2019-10-24 11:20:41 +02:00
Houtan Bastani 933c1eeb72 remove meta class access specifiers as they are not supported in MATLAB < R2012a
Revert when minimum supported Matlab version >= R2012a
2019-10-23 17:24:51 +02:00
Houtan Bastani 388f92b607 replace `filesep` with `/`
On Windows, `filesep` evaluates to `\` and, in a `*printf` statement, this can have unintended consequences (e.g. `\t` evaluates to the tab character

Since '/' works on all systems, replace all occurrences of `filesep` with `/` in the codebase
2019-10-23 15:05:03 +02:00
Houtan Bastani 09b59aa321 capitalize MATLAB 2019-10-02 13:47:59 +02:00
Sébastien Villemot 6a2a1c9266 Testsuite: compatibility fix for older MATLAB
addpath does not deal well with relative path on older MATLABs.
2019-09-19 14:42:06 +02:00
Sébastien Villemot bbe24ad987 Add job to test against old MATLAB (R2009b)
Also shorten test names, because “testsuite_old_matlab” is too long and gets
truncated on the web interface.
2019-09-19 14:37:32 +02:00
Houtan Bastani 5d882351d0 suppress output from mkdir in octave, check for ‘dir’ instead of ‘file’ 2019-09-03 13:10:41 +02:00
Houtan Bastani edf1472f1b update tests to account for report created in different directory 2019-09-03 13:02:09 +02:00
Houtan Bastani 41a2072862 further changes linked to 130105a6c22096c3154b13825a971e4172a42f35 2019-09-03 12:49:45 +02:00
Houtan Bastani ccd4a416f7 use inplace dseries functions 2019-09-03 11:56:14 +02:00
Houtan Bastani 87ddce0dc3 change compilation message 2019-09-02 18:30:26 +02:00
Houtan Bastani 835be14b33 remove superfluous asserts 2019-09-02 17:52:09 +02:00
Houtan Bastani 30689dd1c8 remove unnecessary semicolons 2019-09-02 17:45:12 +02:00
Houtan Bastani d64ecf22b6 add `directory` option to report class 2019-09-02 17:37:23 +02:00
Houtan Bastani 1b8c2d4c48 make tables more easily included in external latex report 2019-09-02 15:42:05 +02:00
Houtan Bastani 3183d806e3 remove unused method 2019-08-30 11:17:44 +02:00
Houtan Bastani 35e97799c4 fix test: graphics were overflowing to the next page 2019-08-29 18:23:56 +02:00
Houtan Bastani 48d73ecb0c Change comment written to .tex file 2019-08-29 18:23:42 +02:00
Houtan Bastani 8909f01b13 update .gitignore 2019-08-29 17:45:02 +02:00
Houtan Bastani 543e973042 convert to classdef. closes #10 closes #9 2019-08-29 17:42:20 +02:00
Houtan Bastani b397002973 fix bug in report constructor 2019-08-28 14:36:04 +02:00
Houtan Bastani 245a11d547 simplify writing of vspace 2019-08-28 14:30:23 +02:00
Sébastien Villemot cbed396604 Fix typo 2019-08-27 11:34:50 +02:00
Sébastien Villemot 6f48a2857a The dates module is now part of dseries 2019-08-27 11:30:29 +02:00
Houtan Bastani df9d6c35de include timestamp in output files 2019-08-09 15:12:20 -04:00
Houtan Bastani 04eabc587f account for vlines option in data table 2019-08-09 14:00:26 -04:00
Houtan Bastani a2d9d20a9d update readme 2019-08-09 13:58:44 -04:00
Houtan Bastani 7c68e6709b update test to accord with dseries/dates changes 2019-08-09 13:22:59 -04:00
Houtan Bastani 0e935918c6 simplify code 2019-08-09 11:40:30 -04:00
Stéphane Adjemian (Charybdis) bc1c173988 Updated online filter routines.
- Rewrote doc headers
 - Changed function signatures
 - Removed persistent variables
 - Compute the mode of the particle weights
 - Return the covariance matrix of the particles in the last period
 - Various cosmetic changes
2019-07-11 12:45:26 +02:00
Frédéric Karamé 2aed30d686 New SMC sampler (Herbst and Schorfheide). 2019-02-11 10:59:51 +01:00
Houtan Bastani cac8231f48 add comments about rounding 2019-01-28 15:39:59 +01:00
Houtan Bastani 4cea90a156 add basic functionality for tables with non time series data 2019-01-25 18:01:21 +01:00
Sébastien Villemot fcfde3bc0b Use Gitlab CI 2018-11-21 18:22:38 +01:00
Sébastien Villemot fd977f79f7 Modernization: use tilde (~) syntax for ignored output arguments 2018-11-13 17:49:43 +01:00
Sébastien Villemot 0ece9d3062 Update URLs for the move to GitLab 2018-09-10 12:20:46 +02:00
Sébastien Villemot f9e85d3c80 Update URLs for the move to GitLab 2018-09-10 12:18:49 +02:00
Frédéric Karamé 713e3ffcfb include modifications for parallelisation. 2018-06-28 09:22:34 +02:00
Frédéric Karamé a299c04d7e include parallelisation, correction of the likelihood calculation for the Amisano and Tristani option and the possibility of monte carlo draws for the proposal. 2018-06-28 09:21:50 +02:00
Frédéric Karamé 6e89a1ff9e Replace the likelihood of the mean by the mean of the likelihoods. 2018-06-28 09:20:19 +02:00
Frédéric Karamé 4de28e10c0 Initial particles are drawn in the prior distribution + bug fixes. 2018-06-13 18:43:04 +02:00
Frédéric Karamé 801d175890 Add flags to deal with errors on Cholesky matrices in CPF filter. 2018-06-11 09:46:17 +02:00
Frédéric Karamé b66d78d434 Correct the calculation of the incremental weights. 2018-06-09 14:59:20 +02:00
Frédéric Karamé cecc11c73f Add the option of Monte Carlo nonlinear Kalman filter. 2018-06-08 20:58:48 +02:00
Frédéric Karamé b7597b5060 Add the possibility of proposal approximated with Monte Carlo. 2018-06-08 20:57:38 +02:00
Frédéric Karamé be31310838 Correct the calculation of the incremental weights. 2018-06-08 20:56:24 +02:00
Frédéric Karamé d3d6a037b1 Added routines for Dynamic Striated Metropolis Hastings. 2018-06-01 11:16:29 +02:00
Houtan Bastani eeccf4021c fix report for dseries changes 2018-02-16 14:32:37 +01:00
Houtan Bastani c094e38927 update CI for homebrew change 2018-02-14 11:51:06 +01:00
Houtan Bastani e5fb0efd7b add assert for fan option 2018-02-14 11:47:55 +01:00
Houtan Bastani 2abe25e3aa update gitignore 2018-01-11 12:23:12 +01:00
Stéphane Adjemian (Charybdis) e71343cb79 Account for M_.{endo_names,exo_names} changed types. 2018-01-09 21:23:17 +01:00
Sébastien Villemot 3178cb0c44 Update link to license file in README.md. 2017-06-28 14:40:39 +02:00
Sébastien Villemot 3575db6100 Remove extra license files (keep only LICENSE.md as other Dynare submodules). 2017-06-28 14:38:35 +02:00
Houtan Bastani c05d3a5cb9 reporting: fix display of pdf latex output when Octave is used 2017-06-20 12:21:47 +02:00
Houtan Bastani aa3fdcf262 move CI to OS X 2017-06-20 12:21:43 +02:00
Houtan Bastani 136588fcef add directory to search on macOS 2017-06-16 16:40:17 +02:00
Stéphane Adjemian (Charybdis) 53d38e7833 Fixed copyright notices. 2017-05-19 00:07:01 +02:00
Stéphane Adjemian (Charybdis) 3d0abed99a Fixed indentation. 2017-05-19 00:04:08 +02:00
Stéphane Adjemian (Charybdis) 1eee8eb3f2 Fixed copyright notices. 2017-05-18 23:59:49 +02:00
Stéphane Adjemian (Charybdis) a812a00b17 Fixed indentation. 2017-05-18 23:59:10 +02:00
Houtan Bastani 046a1b3804 Implement Travis CI. Closes #8 2017-03-24 16:13:41 +01:00
Houtan Bastani 7ba160e898 update README 2017-03-24 16:13:14 +01:00
Houtan Bastani 9166579b46 only issue warning if empty dseries and dates objects are not found 2017-03-24 16:13:14 +01:00
Houtan Bastani b5802808e3 update .gitignore 2017-03-24 16:13:14 +01:00
Houtan Bastani 3b6540951b update report test files 2017-03-24 16:13:14 +01:00
Houtan Bastani e1941ca4a7 rename examples directory test 2017-03-24 16:13:14 +01:00
Houtan Bastani 215245758d update call to dyn_saveas 2017-03-23 17:57:17 +01:00
Stéphane Adjemian (Charybdis) a4158ad306 Added link to travis-ci status (unit tests). 2017-03-22 19:53:36 +01:00
Houtan Bastani ce79dbe420 update call to dyn_figure 2017-03-22 17:08:02 +01:00
Stéphane Adjemian 0c28a29392 Merge pull request #8 from JohannesPfeifer/patch-3
Properly terminate nonlinear_kalman_filter if non-positive definite m…
2017-03-15 16:27:38 +01:00
Johannes Pfeifer bd8e804435 Properly terminate nonlinear_kalman_filter if non-positive definite matrices are encountered
Otherwise, crashes can happen during mode-finding
2017-01-23 12:20:24 +01:00
Houtan Bastani 21bbf12999 update license for 2017 2017-01-09 16:13:41 +01:00
Houtan Bastani 60def33fa7 add new option tablePrecision to report_series 2017-01-09 16:12:29 +01:00
Houtan Bastani 8118eb0c49 require that ‘precision’ argument to table take non-negative integers 2017-01-09 16:12:18 +01:00
Frédéric Karamé 814cb693f6 Fix a bug in the predictive density calculation. 2016-06-30 12:12:58 +02:00
Frédéric Karamé bdd519a5f5 Modifications to facilitate Cholesky of states variances. 2016-06-30 11:42:45 +02:00
Houtan Bastani 4644a31291 fix latex file ending for linux compilation 2016-06-14 11:48:35 +02:00
Frédéric Karamé e6d081d58a Fixed bug on a structure name. 2016-06-01 18:24:27 +02:00
Frédéric Karamé 8221d5c780 Modification of a structure name when calling incremental_weights. 2016-06-01 18:19:26 +02:00
Frédéric Karamé 0141b34310 Fixed bug on structure name. 2016-06-01 17:11:28 +02:00
Stéphane Adjemian (Charybdis) 005b0907c0 Changed logic for setting weights method in CPF. 2016-06-01 16:07:07 +02:00
Stéphane Adjemian (Charybdis) 8f4fe9b341 Renamed matlab routine. 2016-06-01 14:12:02 +02:00
Houtan Bastani e16102fbf6 remove instances of strjoin 2016-02-24 14:38:20 +01:00
Houtan Bastani 332054cdc1 allow NaN's in table to be replaced by arbitrary text 2016-02-22 10:56:25 +01:00
Houtan Bastani 33c8426ca3 remove strsplit which does not exist in earlier verions of Matlab 2015-12-17 14:15:50 +01:00
Frédéric Karamé 75b17ce780 Add the possibility of Gaussian-Mixture Particle Filter without resampling. 2015-12-04 16:00:04 +01:00
Frédéric Karamé 394df6f537 Make the distinction between original Amisano and Tristani's way to calculate particles weights and the likelihood (CPF1) and Murray's way (CPF2). 2015-12-04 15:29:25 +01:00
Frédéric Karamé 9a366d6576 Re-activate the option of resampling in Gaussian Particle Filter. 2015-12-04 14:48:26 +01:00
Frédéric Karamé df842aa542 Correct the auxiliary filter part. 2015-12-04 12:42:42 +01:00
Frédéric Karamé 3c18bf1f6b Fix a bug in the gaussian density calculation. 2015-12-04 11:44:45 +01:00
Houtan Bastani af52282be0 fix typo 2015-12-02 12:36:53 +01:00
Houtan Bastani b1e8790ff5 add more helpful error messages. closes #6 2015-12-01 14:33:18 +01:00
Houtan Bastani bac8ef8520 Merge pull request #4 from FerhatMihoubi/Branch_complie
Fix bug on windows
2015-11-11 15:10:47 +01:00
ferhat 3e040087e8 Fix bug on windows 2015-11-11 15:05:56 +01:00
Houtan Bastani b94839f83b add input type check 2015-10-21 12:22:23 +02:00
Houtan Bastani de6e1faae8 add showOutput option to canned irf macro 2015-10-21 12:21:45 +02:00
Frédéric Karamé e6d627396a Fix the calculation of the likelihood on the APF. 2015-10-20 15:12:56 +02:00
Houtan Bastani 42797082ec when plotting series that are all zeros, set the y range 2015-10-20 12:58:30 +02:00
Houtan Bastani 905c3b9c40 fix typo 2015-10-20 12:24:21 +02:00
Houtan Bastani d204b44434 change default name of canned report 2015-10-20 10:35:31 +02:00
Houtan Bastani b0fc52dca1 add integer ticks to the bottom of IRFs in canned report 2015-10-20 10:31:45 +02:00
Houtan Bastani 8050deee0e update pgf layers for new texlive version under debian 2015-10-19 15:13:46 +02:00
Houtan Bastani 6c3719280e update path to include macros folder 2015-10-16 15:36:59 +02:00
Houtan Bastani 428ead788c fix spacing 2015-10-15 12:32:24 +02:00
Houtan Bastani 9f8eb4e30d fix path to always use forward slash 2015-10-15 12:31:21 +02:00
Houtan Bastani 1aca7bb7e3 Merge pull request #3 from FerhatMihoubi/master
Bug fixes and enhancement
2015-10-15 12:12:26 +02:00
ferhat bae1f89c02 Do not print out NAN values 2015-10-15 11:16:13 +02:00
ferhat 0af48c4ac9 Fix typo 2015-10-15 11:15:33 +02:00
Frédéric Karamé 7816397856 Add the possibility to use an sparse-grid Kalman filter with approximation at order 2. 2015-10-09 14:42:53 +02:00
Frédéric Karamé 46f367b299 Minor modifications in the inputs of the function. 2015-10-07 15:25:16 +02:00
Frédéric Karamé 8b79fb562b Correction on a bug and extension of the original paper for the calculation of incremental weights. 2015-10-07 15:23:42 +02:00
Frédéric Karamé bf956f9bb0 Modify the inputs of gaussian_density. 2015-10-06 17:21:02 +02:00
Frédéric Karamé ce9dace8ef fix a bug on format matrix. 2015-10-06 17:18:09 +02:00
Frédéric Karamé 57f4f5b157 Fix a bug in likelihood calculation. 2015-10-02 16:05:26 +02:00
Frédéric Karamé a64073ec3c Modify the weights to prevent crash in the cholesky of the covariance. 2015-10-02 16:02:49 +02:00
Stéphane Adjemian c4b465a2c4 Merge pull request #6 from JohannesPfeifer/patch-1
Reflect new input argument of lyapunov_symm.m of Dynare
2015-08-12 11:45:04 +02:00
Johannes Pfeifer d5ef4962bd Reflect new input argument of lyapunov_symm.m of Dynare
Related to https://github.com/DynareTeam/dynare/pull/983
2015-07-24 12:57:17 +02:00
Houtan Bastani a037e3177c fix strjoin statements 2015-07-16 16:55:29 +02:00
Houtan Bastani 2cb0bc27dc when latex option is passed, write page to its own file and include it in the report 2015-07-08 11:20:44 +02:00
Houtan Bastani cb2571b158 add header option to report class 2015-07-03 11:10:53 +02:00
Houtan Bastani 2464865b88 reporting: add latex option to page class 2015-07-03 11:09:46 +02:00
Houtan Bastani b4bbd49b7f create .gitignore 2015-07-02 11:19:37 +02:00
Houtan Bastani 3a303fcb6f create a new page for each exo variable 2015-07-02 11:15:24 +02:00
Houtan Bastani 9cd10285ec change default graph precision 2015-07-02 10:15:24 +02:00
Houtan Bastani 33aba204d8 don't add pages in case where there are several shocks that don't have associated IRFs 2015-07-02 10:14:12 +02:00
Houtan Bastani ce891a5e3d change graph names in canned report 2015-07-02 10:12:32 +02:00
Houtan Bastani b15cfd1404 update make_report_irfs 2015-07-02 10:08:08 +02:00
Houtan Bastani cea37a15e5 update irf macro 2015-07-01 15:05:17 +02:00
Houtan Bastani ca59274c87 add titleFormat to irf macro 2015-07-01 11:18:57 +02:00
Houtan Bastani 9e9f746469 automatically find pdflatex.exe on windows with texlive installation 2015-06-26 15:41:15 +02:00
Houtan Bastani 08eeb0fd1e new macro to create irf reports. #1 2015-06-17 12:49:40 +02:00
Houtan Bastani ac811378c7 add newlines to end of output to return matlab prompt to original position 2015-06-17 12:47:46 +02:00
Houtan Bastani bf6fa900db catch situation where user doesn't overrwrite the original reporting object, causing a section to have zero elements 2015-06-17 12:42:38 +02:00
Houtan Bastani 7a8467c13a remove unnecessary package 2015-06-11 17:02:20 +02:00
Houtan Bastani 5f41bb3264 simplify compile.m 2015-06-11 11:53:32 +02:00
Houtan Bastani 17d5b639f1 fix for debian's outdated latex distribution. to be reverted upon upgrade 2015-06-03 15:21:26 +02:00
Stéphane Adjemian (Hermes) 042303da68 Cosmetic change (display of online approach progress). 2015-05-28 15:25:18 +02:00
Frédéric Karamé 47bfcece40 update the function to the recent modifications in dynare_estimation. 2015-05-27 15:26:59 +02:00
Frédéric Karamé 6ab142a75b simplification of gaussian mixtures 2015-05-27 11:48:06 +02:00
Houtan Bastani 67f6f59e7f remove superfluous comments 2015-04-29 16:20:09 +02:00
Houtan Bastani 0f4e3d2888 reporting: use linewidth instead of textwidth as it works better in landscape mode 2015-04-29 16:19:23 +02:00
Houtan Bastani 84d1933143 further fixes to make fan charts work with debian’s outdated latex distro (as with 0de30dc5c170695fb89bccfb41939224959aebfe, to be reverted when Debian disto is upgraded) 2015-04-28 17:34:29 +02:00
Houtan Bastani f2002669e4 reporting: fixes to make fan charts work with debian’s outdated latex distro 2015-04-28 16:35:58 +02:00
Houtan Bastani c620943245 don't add fan chart shading to legends 2015-04-27 18:24:13 +02:00
Houtan Bastani 523c0c7864 add possibility to create fan charts 2015-04-27 18:16:05 +02:00
Houtan Bastani ec6a4e92b0 use predefined pgf layers 2015-04-24 16:13:16 +02:00
Frédéric Karamé 34cf8ca284 adapt the code to dynare evolutions 2015-04-15 10:40:27 +02:00
Houtan Bastani c2a3e40178 add readme file 2015-02-24 16:32:29 +01:00
Houtan Bastani 6980669d6e add example code, slightly modified from DynareTeam/dynare.git tests/reporting 2015-02-24 16:32:09 +01:00
Houtan Bastani 761c07cdb2 add initialization file 2015-02-24 16:31:57 +01:00
Houtan Bastani 1c1681ac3c add license info 2015-02-24 16:05:20 +01:00
Houtan Bastani e436add816 move everything to src dir 2015-02-24 16:02:19 +01:00
Frédéric Karamé 19858696bf fix a bug in the indices of the proposal calculations. 2015-01-28 15:23:09 +01:00
Houtan Bastani 29587b7f2a reporting: add titleTruncate option 2015-01-27 09:54:37 +01:00
Frédéric Karamé 49d25782bb factorize some codes across options and modify the definition of mixtures. 2015-01-23 14:40:55 +01:00
Frédéric Karamé 2b0a83ca91 factorize some codes across options. 2015-01-23 10:05:16 +01:00
Frédéric Karamé 3300a448f2 Delete resampling possibility in gaussian particle filter 2015-01-14 16:13:21 +01:00
Frédéric Karamé bcb09ee14d Fix bug on gaussian filter for the option distribution_approximation=montecarlo 2015-01-14 14:56:10 +01:00
Houtan Bastani b3a7e49464 reporting: run compilation in batchmode to speed it up slightly 2015-01-08 18:37:44 +01:00
Houtan Bastani eab8089e16 reporting: add option to stop LaTeX compilation when an error is encountered (instead of prompting the user for input) 2015-01-08 18:35:10 +01:00
Frédéric Karamé f3a4bd8a63 Remove de index_resample.m file used in the auxiliary particle filter and replaced by reample.m 2015-01-07 14:25:56 +01:00
Frédéric Karamé 81c02a58d8 Reintroduction of pruning and of options to build the sufficient statistics in the auxiliary particle filter 2015-01-07 14:22:12 +01:00
Frédéric Karamé 29db2fe060 modification of the sufficient statistics in the auxiliary particle filter 2015-01-07 13:49:33 +01:00
Frédéric Karamé d5735c9585 correction of weights calculation in the auxiliary particle filter 2015-01-07 11:26:30 +01:00
Houtan Bastani 135ae323d5 reporting: add legendAt option. closes #810 2014-12-29 22:18:08 +01:00
Houtan Bastani 224f2ed793 reporting: fix legend entry for bar graphs 2014-12-29 20:37:44 +01:00
Houtan Bastani 814ff2a835 reporting: add support for bar graphs, closes #809 2014-12-23 17:52:40 +01:00
Houtan Bastani 94533d213b reporting: fix error message 2014-12-23 17:52:17 +01:00
Frédéric Karamé d476a195e0 modification of the auxiliary particle filter and of the resample routine that can return either the resampled particles or the resampling index depending on the input (particles = 0 or not) 2014-12-18 14:46:55 +01:00
Stéphane Adjemian 86ebce712f Update README.md
Fixed typo
2014-12-18 11:31:29 +01:00
Stéphane Adjemian (Charybdis) 3c345e1d45 Replaced DynareOptions by ParticleOptions and ThreadsOptions. 2014-12-15 15:27:28 +01:00
Stéphane Adjemian (Charybdis) 5c3a4841b8 Replaced DynareOptions by ParticleOptions and ThreadsOptions. 2014-12-15 14:30:19 +01:00
Stéphane Adjemian (Charybdis) cca16be513 Fixed header. 2014-12-12 22:38:59 +01:00
Stéphane Adjemian (Charybdis) bebcba0a7d Replaced DynareOptions by ParticleOptions and ThreadsOptions. 2014-12-12 22:37:49 +01:00
Stéphane Adjemian (Charybdis) c0cfc640c4 Replaced DynareOptions by ParticleOptions and ThreadsOptions. 2014-12-12 19:14:35 +01:00
Stéphane Adjemian (Charybdis) e803fdbc88 Fixed headers. 2014-12-12 18:09:04 +01:00
Stéphane Adjemian (Charybdis) 5610856478 Replaced DynareOptions by ParticleOptions and ThreadsOptions.
ParticleOptions is DynareOptions.particles
ThreadsOptions is DynareOptions.threads
2014-12-12 17:49:17 +01:00
Stéphane Adjemian (Charybdis) dd0cc89ef3 Rewrote doc header. 2014-12-12 17:49:17 +01:00
Frédéric Karamé d533b826c1 Adds a modification to work with order 1 too. 2014-11-14 18:16:11 +01:00
Frédéric Karamé d4e4ea4ad8 Fixed definition of neff (resampling threshold). 2014-11-14 17:12:45 +01:00
Stéphane Adjemian (Telemachus) 459d02febf Removed local_state_space_iteration_2 routine. 2014-11-13 15:54:41 +01:00
Stéphane Adjemian (Telemachus) deef89316c Do not version Org files. 2014-11-12 18:01:31 +01:00
Stéphane Adjemian (Telemachus) 4c71e9b4ab Removed notes.org from Git. 2014-11-12 17:59:50 +01:00
Stéphane Adjemian (Telemachus) 27f5f298f4 Imported files from DynareTeam/dynare github repository. 2014-11-10 19:00:16 +01:00
Stéphane Adjemian (Telemachus) 0514b3949c Added provisions for documentation. 2014-11-10 18:38:48 +01:00
Stéphane Adjemian (Telemachus) 9bb61c33bf Initial commit. 2014-11-10 18:21:26 +01:00
Houtan Bastani 387a9b87b1 reporting: tables: add row highlighting option 2014-07-30 15:21:32 +02:00
Houtan Bastani 2cbe1c34d9 reporting: add writeCSV option for tables. closes #693 2014-07-29 15:21:51 +02:00
Houtan Bastani 54adbb1e69 reporting: table fix bug where the table would not be saved in the directory specified by tableDirName if the tableName option was provided 2014-07-29 15:21:51 +02:00
Houtan Bastani 13dc0e3538 reporting: add writeCSV option for graphs, #693 2014-07-29 15:21:45 +02:00
Houtan Bastani 4fa89e2fc4 reporting: write tableSubSectionHeader in bold 2014-07-28 17:28:20 +02:00
Houtan Bastani 3adc7826db reporting: fix bug where a whole row wasn’t colored if the tableSubSectionHeader option was passed at the same time 2014-07-28 17:28:20 +02:00
Houtan Bastani 310b081c41 reporting: minor aesthetic changes to table and code simplifications 2014-07-28 17:28:20 +02:00
Houtan Bastani d6a37e8fcc reporting: ensure tableRowIndent is ge 0 2014-07-28 17:28:20 +02:00
Houtan Bastani 7a529bc973 reporting: option to suppress reporting output. closes #688 2014-07-25 14:38:30 +02:00
Houtan Bastani b0bd8d62c0 reporting: bug fix. closes #673 2014-07-09 15:46:28 +02:00
Houtan Bastani 4487e41580 reporting: fix bug in creating table when data option is passed to constructor 2014-07-09 15:46:28 +02:00
Houtan Bastani 9aef6eede7 reporting: modify depricated method of changing font (thanks to Dirk Muir for the solution) 2014-07-08 16:12:17 +02:00
Houtan Bastani 8a89b63cea reporting: graph: add option yTickLabelScaled 2014-07-07 16:49:53 +02:00
Houtan Bastani 2f4540d36c reporting: remove unused graphSize option 2014-07-07 10:29:09 +02:00
Houtan Bastani 27764e5c4e reporting: add option to suppress compiler output 2014-07-07 09:49:12 +02:00
Houtan Bastani ff97205474 reporting: add option to open report at end of compilation 2014-07-07 09:45:34 +02:00
Houtan Bastani 7c7a8a5bb9 reporting: rework option handling for compile.m 2014-07-07 09:45:25 +02:00
Houtan Bastani a1d4284e7c reporting: fix bug with end tabular/end landscape 2014-07-04 16:46:09 +02:00
Houtan Bastani 52dacc673d reporting: remove checks on colors that are passed to graphs/series to allow for all color combinations supported by TikZ 2014-06-27 17:06:45 +02:00
Houtan Bastani 128a6c6d95 fix typo 2014-06-27 16:26:34 +02:00
Houtan Bastani 4fd0daee45 add missing semicolon 2014-06-27 16:18:05 +02:00
Houtan Bastani 36332da071 reporting: graph: add option tickFontSize 2014-06-27 15:56:06 +02:00
Houtan Bastani a269940940 reporting: add graph option to change title font size 2014-06-25 16:30:04 +02:00
Houtan Bastani 544b4c5a57 reporting: support a different shape for the axis in a graph 2014-06-24 15:51:29 +02:00
Houtan Bastani ee1e47883c reporting: add graph option: zeroLineColor 2014-06-20 15:41:11 +02:00
Houtan Bastani dcd151a713 reporting: fix shading on Linux 2014-06-10 15:48:49 +02:00
Houtan Bastani afa2f03db5 reporting: align graphs based on axis not axis labels 2014-06-10 10:15:24 +02:00
Houtan Bastani d038a6c9f3 reporting: add options to control y axis label 2014-06-10 10:15:15 +02:00
Houtan Bastani f2e0ce6af8 reporting: change default multiplication operator for graph precision 2014-06-09 11:47:23 +02:00
Houtan Bastani 2a490eaa80 reporting: add new Paragraph class 2014-05-23 18:10:44 +02:00
Houtan Bastani 914b81d830 reporting: make zerotol work for both graphs and reports 2014-05-22 19:03:25 +02:00
Houtan Bastani 656d74436b reporting: fix display 2014-05-22 19:03:25 +02:00
Houtan Bastani 0f3c1b1537 reporting: add new option graphShowInLegend to addSeries 2014-05-22 19:03:20 +02:00
Houtan Bastani cd6074b5d1 reporting: bug fix for graphHline 2014-05-22 17:03:52 +02:00
Houtan Bastani 0059a1bd4b reporting: bug fix for when a series doesn’t have a data option passed to it 2014-05-22 16:41:43 +02:00
Houtan Bastani bd5ba5e73d reporting: replace isa(*,’dseries’) with isdseries() 2014-05-20 14:51:46 +02:00
Houtan Bastani fac17ab6e7 reporting: replace isa(*,’dates’) with isdates() 2014-05-20 14:51:41 +02:00
Houtan Bastani 92e8c9340a reporting: clean up writeSeriesForGraph.m 2014-05-20 14:39:50 +02:00
Houtan Bastani 5b29f183b3 reporting: change vline to accept only one dates 2014-05-20 14:38:02 +02:00
Houtan Bastani 120aa7ede7 reporting: support horizontal lines 2014-05-20 14:25:01 +02:00
Houtan Bastani dc8763a810 reporting: support vertical lines 2014-05-20 14:17:24 +02:00
Houtan Bastani 62f8189a25 reporting: add new background layer 2014-05-20 14:16:52 +02:00
Houtan Bastani d40498fea1 reporting: add missing semicolon 2014-05-19 17:52:24 +02:00
Houtan Bastani f3cdc4ff79 reporting: remove instances of deprecated function strmatch 2014-05-19 17:49:52 +02:00
Houtan Bastani 905bb8a3b6 reporting: remove unused variable 2014-05-19 17:27:47 +02:00
Houtan Bastani 927bc3b9c9 reporting: allow vspaces when section is not complete (implies that section is over) 2014-05-19 17:22:29 +02:00
Houtan Bastani cb90f5e72d add missing semicolon 2014-05-19 16:31:37 +02:00
Houtan Bastani 7576ba2e03 reporting: add miscTikzAxisOptions option to addGraph 2014-05-19 15:57:43 +02:00
Houtan Bastani c0174131f6 reporting: add miscTikzPictureOptions option to addGraph 2014-05-19 15:57:43 +02:00
Houtan Bastani 1d4fe68f4d reporting: allow for miscellaneous PGFPlots options to the addPlot command 2014-05-19 15:57:37 +02:00
Houtan Bastani 9829a5e213 reporting: add option ‘graphLegendName’ to addSeries 2014-05-19 12:29:54 +02:00
Houtan Bastani 8222d4254d reporting: fix spacing between sections 2014-05-16 16:59:56 +02:00
Houtan Bastani 41d86fca9e reporting: bug fix 2014-05-16 16:43:45 +02:00
Houtan Bastani 2dd68d4ecd reporting: simplify check 2014-05-16 16:35:18 +02:00
Houtan Bastani 56d284d30a Add back function that was erroneously removed 2014-05-16 15:29:54 +02:00
Houtan Bastani c783bcfccf reporting: fix bug when data option is passed to addGraph 2014-05-16 15:00:43 +02:00
Houtan Bastani 5a35c9d54a reporting: upgrade minimum pgfplots version when Debian upgrades its version 2014-02-24 15:53:07 +01:00
Houtan Bastani 75f4994d04 reporting: add baseline option to help with tikzpicture alignment 2014-02-24 15:34:48 +01:00
Houtan Bastani 01e6c2a971 reporting: comment out spurious whitespace 2014-02-24 15:30:39 +01:00
Houtan Bastani bb3e2fdff8 reporting: fix shading 2014-02-24 09:11:11 +01:00
Houtan Bastani f035fabb14 reporting: fix xticklabels for various shading situations 2014-02-24 09:09:33 +01:00
Houtan Bastani 7dfe38198c reporting: add option 'ALL' to xTickLabels 2014-02-20 16:35:05 +01:00
Houtan Bastani eacea6d66d reporting: change xTickLabels default to be first date, last date, and, if passed, the first date of the shade region. Accordingly, change the default of the tick rotation to be 0. 2014-02-20 16:24:37 +01:00
Houtan Bastani f877285c3b reporting: change figName option to graphName; change figDirName option to graphDirName 2014-02-19 15:23:56 +01:00
Houtan Bastani 84faa840c0 reporting: change option names to camelCase 2014-02-19 15:10:04 +01:00
Houtan Bastani c693f745fa reporting: extract tables into individual files for easy inclusion by user in their paper 2014-02-19 10:04:57 +01:00
Houtan Bastani 68a8e42933 reporting: table.write: get length only once 2014-02-19 09:51:26 +01:00
Houtan Bastani 2e8ef3ad5f reporting: fix name of file 2014-02-19 09:49:11 +01:00
Houtan Bastani 414ef860ab reporting: fix bug causing directory to be ignored if figname option was passed to addGraph 2014-02-19 09:05:55 +01:00
Houtan Bastani 96cd971f66 reporting: rename reporting_object_display.m 2014-02-19 08:24:46 +01:00
Houtan Bastani 7cfedcd2f6 reporting: make the titleFormat default work for both titles and subtitles, not just titles 2014-02-17 12:25:49 +01:00
Houtan Bastani a71b8808df reporting: add subtitles for graphs, closes #580 2014-02-17 12:11:41 +01:00
Houtan Bastani a4b45bae37 reporting: change default for titleFormat of page 2014-02-17 11:19:50 +01:00
Houtan Bastani 5f82248caf reporting: add subtitle support for tables, ref #580 2014-02-17 11:19:46 +01:00
Houtan Bastani 3751fd9f39 reporting: remove unused package and consolidate fprintf statements 2014-02-14 17:45:04 +01:00
Houtan Bastani d71878e327 reporting: for easier figure reference, by default save report figures as: pg%d_sec%d_row%d_col%d.tex 2014-02-14 16:18:05 +01:00
Houtan Bastani 4c0cbaceff reporting: include graph title in tikz code as opposed to latex 2014-02-14 15:36:16 +01:00
Houtan Bastani f92e714000 reporting: deal with nans/inf/-inf data by jumping it 2014-02-14 15:24:44 +01:00
Houtan Bastani ed80ed12fb reporting: compile with synctex option 2014-02-14 11:44:14 +01:00
Houtan Bastani a940a028c6 add missing semicolon 2014-02-14 11:41:05 +01:00
Houtan Bastani 97da5d9ae3 reporting: add options xAxisTight and yAxisTight 2014-02-13 17:01:34 +01:00
Houtan Bastani 7f199ee114 reporting: implement enlarge y limits for graph; requires a change in shading to get programmed ymin => using fill now 2014-02-13 16:47:17 +01:00
Houtan Bastani 95f9c37726 reporting: fix name of function in error messages 2014-02-13 15:25:54 +01:00
Houtan Bastani 7cf2d46463 reporting: set up graph shade opacity 2014-02-13 15:22:38 +01:00
Houtan Bastani 67360a1711 reporting: set up graph shade color 2014-02-13 15:22:31 +01:00
Houtan Bastani fb7def044a reporting: set up legends for graphs 2014-02-13 15:14:29 +01:00
Houtan Bastani 0d364975db reporting: make graph line markers work with tikz 2014-02-12 16:13:41 +01:00
Houtan Bastani 2a38a2615d reporting: change series method names for writing 2014-02-12 14:48:48 +01:00
Houtan Bastani 27fea2633a reporting: re-impliment yrange option 2014-02-11 18:25:50 +01:00
Houtan Bastani 1d76ad5496 reporting: new option xTickLabelAnchor 2014-02-11 17:04:06 +01:00
Houtan Bastani 53d249cd88 fix typo 2014-02-11 17:04:06 +01:00
Houtan Bastani f90a6836e7 reporting: new option xTickLabelRotation 2014-02-11 17:04:06 +01:00
Houtan Bastani 617db5ba64 reporting: add custom height/width to graphs 2014-02-11 15:34:42 +01:00
Houtan Bastani adda7d8604 first pass at tikz/pgf graphs 2014-02-11 15:34:35 +01:00
Houtan Bastani 1cfc233633 reporting: remove unused method 2014-02-11 15:21:01 +01:00
Houtan Bastani 24f550a2e9 reporting: remove unused methods 2014-02-11 13:02:20 +01:00
Houtan Bastani 33d22eaf9b reporting: replace num2str with sprintf 2014-02-10 18:03:05 +01:00
Houtan Bastani c21044ba87 reporting: simplify graph code 2014-02-10 17:10:09 +01:00
Houtan Bastani fa020902a0 reporting: simplify section code 2014-02-10 16:21:30 +01:00
Houtan Bastani c862fdfbb7 reporting: let subsasgn take {} ref 2014-02-10 16:19:01 +01:00
Houtan Bastani ef6935fe96 reporting: fix bug 2014-02-07 16:23:20 +01:00
Houtan Bastani f3be3f811c reporting: remove unused function numVspace 2014-02-07 16:22:32 +01:00
Houtan Bastani 21895669db reporting: remove all printing to screen 2014-02-07 16:22:32 +01:00
Houtan Bastani 956a7644b0 reporting: fix display 2014-02-06 18:56:01 +01:00
Houtan Bastani b642de2343 reporting: simplify table code 2014-02-06 18:49:59 +01:00
Houtan Bastani 48d077cd4e reporting: mute spurrious output 2014-02-06 18:12:23 +01:00
Houtan Bastani 2070610fe2 reporting: simplify code (remove sections object) 2014-02-06 18:11:31 +01:00
Houtan Bastani 5e96706727 reporting: simplify code 2014-02-06 17:29:24 +01:00
Houtan Bastani ae92cca4a2 reporting, dates: make shiftS calls more efficient 2014-02-06 15:30:19 +01:00
Houtan Bastani f776f5c5cd reporting: check passed values 2014-02-04 17:03:25 +01:00
Houtan Bastani ba6336dddc fix bug introduced in 4caa36232b 2014-02-03 15:53:16 +01:00
Houtan Bastani 60e292b70b reporting: fix assertion 2014-02-03 15:49:29 +01:00
Houtan Bastani c0372ab81f fix typo 2014-01-24 11:11:57 -06:00
Houtan Bastani 1581202772 reporting: add indentation to table rows. closes #581 2014-01-24 09:53:53 -06:00
Houtan Bastani fbcc6830f2 reporting: print less to screen by default 2014-01-23 17:47:04 -06:00
Houtan Bastani 86bb71888f fix typo 2014-01-23 17:03:25 -06:00
Houtan Bastani c8b147c0c0 reporting: support data of all frequencies in table 2014-01-03 17:20:17 +01:00
Houtan Bastani ce6fa17483 reporting: support monthly data in table 2014-01-03 16:04:39 +01:00
Houtan Bastani 0678b98eca reporting: simplify code 2014-01-03 16:01:26 +01:00
Houtan Bastani 764b31de99 reporting: add tableDataRhs option to series 2014-01-02 15:28:23 +01:00
Houtan Bastani f47555a92f reporting: make vlineAfter accept a cell array of dates 2014-01-02 09:35:45 +01:00
Houtan Bastani 91f408b6b9 reporting: remove annualAverages option 2013-12-31 12:54:49 +01:00
Sébastien Villemot d21738853c Remove spurious executable permission 2013-12-16 16:23:50 +01:00
Houtan Bastani 49fc522b27 reporting: bug fix: Windows can't handle windows-style file separators in latex 2013-12-13 17:23:56 +01:00
Houtan Bastani a3a6e7e7b9 reporting: bug fix: avoid underscores altogether 2013-12-13 17:23:26 +01:00
Houtan Bastani 6a0d9b3d59 reporting: fix if statement for changes in dynDates/dates class 2013-12-13 15:36:04 +01:00
Houtan Bastani 517d242059 reporting: add xTicks argument 2013-12-13 15:36:04 +01:00
Houtan Bastani 2b23bcac46 reporting: fix typo 2013-12-12 16:05:57 +01:00
Houtan Bastani 7fa3ab3999 reporting: fix figure inclusion for windows 2013-12-12 16:05:57 +01:00
Houtan Bastani da83298e46 reporting: for windows filenames escape underscore 2013-12-12 16:05:57 +01:00
Houtan Bastani 8315ae52a4 fix permissions 2013-12-12 16:05:57 +01:00
Houtan Bastani 94fc7382ca reporting: replace format with date2string 2013-11-22 17:45:15 +01:00
Houtan Bastani 664fa0d5e8 reporting: replace getDatesCellStringArray with strings 2013-11-22 17:21:53 +01:00
Houtan Bastani ab2fa28ea6 reporting: replace .time with .dates 2013-11-22 17:14:29 +01:00
Houtan Bastani 913612e604 reporting: replace occurrences of dynDate with dates 2013-11-22 17:11:57 +01:00
Stéphane Adjemian (Charybdis) d4e903e665 Cosmetic changes. Added isoctave function to replace exist('OCTAVE_VERSION'). 2013-11-04 10:54:45 +01:00
Stéphane Adjemian (Charybdis) 2174190e49 Merge branch 'master' into remove-dynDate-class
Conflicts:
	matlab/reports/@report_series/getLine.m
	matlab/reports/@report_series/write.m
	matlab/reports/@report_table/report_table.m
	matlab/reports/@report_table/write.m
2013-10-28 15:04:21 +01:00
Stéphane Adjemian (Charybdis) cb9732a609 Renamed dynSeries class as dseries. 2013-10-18 17:38:43 +02:00
Houtan Bastani 64a5ab28a9 reporting: change series class name to report_series to avoid conflict with control systems toolbox function series 2013-10-18 15:20:44 +02:00
Houtan Bastani 1e62b4e77e reporting: fix typo 2013-10-18 15:20:44 +02:00
Houtan Bastani 4cef528e56 reporting: change table class name to report_table to avoid conflict with matlab function table 2013-10-18 15:20:38 +02:00
Stéphane Adjemian (Charybdis) 2bb645ec70 Renamed dynDates class as dates. 2013-10-15 15:36:21 +02:00
Houtan Bastani 3dbb9bd6a2 reporting: fix syntax for dynSeries change 2013-10-09 14:43:43 +02:00
Houtan Bastani 151c3c328b reporting: make tableSubSectionHeader prettier when vlineAfterEndOfPeriod is true 2013-09-27 11:14:00 +02:00
Houtan Bastani 376c605499 reporting: annualAverages option for addTable 2013-09-26 16:34:36 +02:00
Houtan Bastani f10dbf60c6 reporting: fix hline for table 2013-09-26 16:08:13 +02:00
Houtan Bastani 43504f9d64 reporting: table: remove unused variable 2013-09-26 15:21:08 +02:00
Houtan Bastani 07fc0307ab reporting: series: tableRowColor add missing check 2013-09-26 14:48:59 +02:00
Houtan Bastani 5fd2a4755c reporting: series: fix spacing of table cell separators and eol's 2013-09-26 14:45:46 +02:00
Houtan Bastani d22ebccf2c reporting: add new series option tableSubSectionHeader 2013-09-26 14:43:13 +02:00
Houtan Bastani 493525e14a reporting: new table option vlineAfterEndOfPeriod 2013-09-25 15:28:34 +02:00
Houtan Bastani c4540358db reporting: default value bug fix 2013-09-25 15:28:34 +02:00
Houtan Bastani 56a79d353d reporting: add series option tableRowColor 2013-09-25 14:11:58 +02:00
Houtan Bastani 9b2a8d12e0 reporting: @series: add zerotol option 2013-07-24 10:40:01 -04:00
Houtan Bastani df05b5204e reporting: @graph: new option xTickLabels 2013-07-22 13:17:26 -04:00
Houtan Bastani 704e72a0f2 reporting: @graph: add new option graphSize 2013-07-22 12:41:41 -04:00
Houtan Bastani b8d4650074 reporting: bug fix in echo for octave 2013-06-24 17:00:59 +02:00
Houtan Bastani f1c8147d91 reporting: fix typo 2013-06-24 12:12:26 +02:00
Houtan Bastani a96b3d5074 reporting: in windows, replace native filesep with forward slash for inclusion in tex file 2013-06-11 17:12:16 +02:00
Houtan Bastani 8ece1f1245 reporting: search for pdflatex.exe on windows 2013-06-11 17:11:48 +02:00
Houtan Bastani 17081da6e1 reporting: fix echo command in system searches for pdflatex 2013-06-11 17:11:15 +02:00
Houtan Bastani 68e4b22348 reporting: @series: add new option tableMarkerLimit 2013-05-17 14:02:59 +02:00
Houtan Bastani 48e5541bce reporting: @series: fix comment 2013-05-17 13:50:43 +02:00
Houtan Bastani 184167b404 reporting: @series: fix coloring 2013-05-17 13:49:45 +02:00
Houtan Bastani 7a56e7ab7a reporting: @report: bug fix: test for os x on octave 2013-05-16 14:31:50 +02:00
Houtan Bastani dc3792f8b3 reporting: @report: simplify test for os x 2013-05-16 14:31:49 +02:00
Houtan Bastani 35f1724f42 reporting: use matlab2tikz when using Octave w OS X 2013-05-16 14:31:49 +02:00
Houtan Bastani 5981d2a9d6 reporting: centralize/automate display.m 2013-05-16 14:31:40 +02:00
Houtan Bastani cc5a6f0ff0 reporting: @seriesElements: rename numElements to numSeriesElements to conform with other numClass methods 2013-05-16 14:31:40 +02:00
Houtan Bastani f4ae8dbeab reporting: @objArray: change numObjs to numObjArray to conform with other numClass methods 2013-05-16 14:31:40 +02:00
Houtan Bastani 9b67b92ece reporting: remove footnote option 2013-05-15 16:28:32 +02:00
Houtan Bastani 3d0b2f49e3 reporting: remove config option 2013-05-15 16:23:58 +02:00
Houtan Bastani c1f73901b5 reporting: aesthetic change 2013-05-15 13:05:33 +02:00
Houtan Bastani 01f1474c56 reporting: @report: add compiler option to compile() as alternative method to pass compiler information 2013-05-15 13:05:33 +02:00
Houtan Bastani b0ea699799 reporting: @report: throw explicit error if user has not passed compiler option on Windows 2013-05-15 13:05:26 +02:00
Houtan Bastani 12a5950394 reporting: @graph: only take string representation of color 2013-05-14 18:36:01 +02:00
Houtan Bastani c4b529ce2b reporting: on error reading user options, print actual option passed not lowercase version of it 2013-05-14 17:24:41 +02:00
Houtan Bastani 2e3326b3b4 reporting: @series: fix display 2013-05-14 16:52:09 +02:00
Houtan Bastani 201178d7e0 reporting: @series: change showTableMarkers to tableShowMarkers 2013-05-14 16:52:09 +02:00
Houtan Bastani f9f9d7de0d reporting: @series: change lineWidth to graphLineWidth 2013-05-14 16:52:09 +02:00
Houtan Bastani 0f48b7dce3 reporting: @series: rename lineStyle as graphLineStyle 2013-05-14 16:52:08 +02:00
Houtan Bastani 7b97c358f3 reporting: change color to graphLineColor 2013-05-14 16:52:08 +02:00
Houtan Bastani b521b6adee reporting: @series: remove unnecessary assertion 2013-05-14 16:52:08 +02:00
Houtan Bastani 8e20b98d98 reporting: fix typos in validity checks 2013-05-14 13:11:46 +02:00
Houtan Bastani 02ca95e811 reporting: change hlines to showHlines 2013-05-14 13:11:46 +02:00
Houtan Bastani ec49704822 reporting: implement hlines option 2013-05-14 13:11:46 +02:00
Houtan Bastani d3cf432e30 reporting: change vlines to showVlines 2013-05-14 13:11:46 +02:00
Houtan Bastani 95bed0fd57 reporting: change zeroline to showZeroline 2013-05-13 18:48:43 +02:00
Houtan Bastani 8d645b642f reporting: bug fix: only assign a tempname to figname when one doesn't already exist 2013-05-13 18:19:16 +02:00
Houtan Bastani e74412249e reporting: make option names uniform by removing underscores to conform with Matlab style options
Conflicts:
	matlab/reports/@series/series.m
	matlab/reports/@series/write.m
2013-05-13 18:16:52 +02:00
Houtan Bastani 8a7c0d5611 reporting: change tableMarkers to showTableMarkers 2013-05-13 18:16:52 +02:00
Houtan Bastani 7e0c50421e reporting: preserve case when assigning method options while allowing user to enter any case 2013-05-13 18:16:52 +02:00
Houtan Bastani aad042ec27 reporting: change legend_boxoff to showLegendBox 2013-05-13 18:16:52 +02:00
Houtan Bastani af11f6449f reporting: change legend to showLegend 2013-05-13 18:16:52 +02:00
Houtan Bastani bb7d6c750c reporting: change showdate to showDate 2013-05-13 18:16:52 +02:00
Houtan Bastani d98687aacf reporting: change grid option to showGrid 2013-05-13 18:16:52 +02:00
Houtan Bastani 3c8164f101 reporting: fix xticklabels 2013-05-03 14:44:30 +02:00
Houtan Bastani b7df250525 reporting: cosmetic changes 2013-05-03 08:05:09 +02:00
Houtan Bastani aaf0cc48f7 reporting: for octave, use octave tikz conversion as opposed to matlab2tikz 2013-05-03 07:37:12 +02:00
Houtan Bastani 145fcfdd19 reporting: write pdf compilation to stdout in Octave 2013-05-03 07:33:50 +02:00
Houtan Bastani 515ee0d9af fix typo 2013-04-26 15:04:56 +02:00
Houtan Bastani 74a8e9bcc1 reporting: @graph: add shade_color option 2013-04-25 18:40:02 +02:00
Houtan Bastani a8c9f2afdd reporting: @graph: add option shade_opacity 2013-04-25 18:40:02 +02:00
Houtan Bastani 12c94e6881 reporting: @graph: add option to turn legend box on or off 2013-04-24 18:12:11 +02:00
Houtan Bastani 17a2c4000d reporting: @graph: avoid legend crash on octave 2013-04-24 17:59:45 +02:00
Houtan Bastani 85ea29e1a8 reporting: @graph: write title directly in latex file (as opposed to Matlab plot).
If you don't do this, the title will be centered over the plot (not including YTickLabel width) as opposed to within the cell. This can be weird if you have one table in the section as the plot title will not center with the page title.
2013-04-19 18:24:01 +02:00
Houtan Bastani 91162e9eb0 reporting: @section: adjust spacing 2013-04-19 18:24:01 +02:00
Houtan Bastani 9143a805fa reporting: @reporting: open pdf file after compilation (Matlab only) 2013-04-18 17:28:59 +02:00
Houtan Bastani 2cb40a658d reporting: @graph: set prettier spacing of xticklabels 2013-04-18 17:19:48 +02:00
Houtan Bastani 8947c52c1f reporting: @report: add compile method 2013-04-10 18:08:14 +02:00
Houtan Bastani ef7bb4f04f reporting: add more info to stdout during processing/writing 2013-04-10 14:55:19 +02:00
Houtan Bastani 60ee6c08b3 reporting: comment cleanup 2013-04-10 13:01:22 +02:00
Houtan Bastani 90b164d288 reporting: allow for manual height adjustment of sections 2013-04-10 12:53:41 +02:00
Houtan Bastani 628f1fef43 reporting: @graph: keep line handles for use with legend 2013-04-09 17:37:54 +02:00
Houtan Bastani ad2b5fed3e reporting: @graph: legend uses tex 2013-04-09 17:37:54 +02:00
Houtan Bastani 4841f700eb reporting: @graph: ensure xlim is not larger than actual xlimits 2013-04-09 17:37:54 +02:00
Houtan Bastani 22962be7c1 reporting: @graph: use green shading which is easier to see because 'FaceAlpha' doesn't work on octave (at least on os x) 2013-04-09 11:49:16 +02:00
Houtan Bastani dd987523c8 reporting: @graph: if shading, move to bottom 2013-04-09 11:16:30 +02:00
Houtan Bastani ec0dc6148c reporting: @graph: uistack fix for octave & move zeroline writing up 2013-04-09 11:16:01 +02:00
Houtan Bastani 540c59ee85 reporting: @graph: push zeroline to bottom 2013-04-05 13:15:00 +02:00
Houtan Bastani 2921f91ca3 reporting: @graph: add zeroline option 2013-04-05 11:48:56 +02:00
Houtan Bastani 11e90492df reporting: @report: simplified syntax for adding vspace 2013-04-04 08:50:49 +02:00
Houtan Bastani cec93b6b37 reporting: @elements: add end.m 2013-04-04 08:48:24 +02:00
Houtan Bastani d1b4a10ffe reporting: @table: fix display 2013-04-04 08:42:41 +02:00
Houtan Bastani c983d99169 reporting: fix typo 2013-04-04 07:35:54 +02:00
Houtan Bastani 8ac9ac6f68 reporting: @series: write tex name to table 2013-04-03 19:13:32 +02:00
Houtan Bastani d78e491278 reporting: @series: add align_right option 2013-04-03 16:28:17 +02:00
Houtan Bastani cc6d29c5fc reporting: @table: add vline_after option 2013-04-03 14:40:06 +02:00
Houtan Bastani d0be97c4e4 reporting: @table: allow control of title font size 2013-04-03 11:37:19 +02:00
Houtan Bastani ee7f2fb7d0 reporting: @series support writing colors/marking table rows 2013-04-02 15:00:27 +02:00
Houtan Bastani 57c10f5ff8 reporting: @seriesElements: bug fix 2013-04-02 15:00:27 +02:00
Houtan Bastani 7280ec13a7 reporting: fix typo 2013-04-02 15:00:27 +02:00
Houtan Bastani 7b14bdafe9 reporting: @series: use graph_* to precede graph-specific options 2013-04-02 15:00:27 +02:00
Houtan Bastani 7068bc4f80 dynDates: add end keyword 2013-04-02 11:12:00 +02:00
Houtan Bastani 33e80b5816 reporting: @table: use @series 2013-04-02 11:08:23 +02:00
Houtan Bastani c94f1b98b1 reporting: @graph: bug fix 2013-03-29 17:58:54 +01:00
Houtan Bastani 1f988bcdf4 reporting: factorize max range code for eventual use with @table 2013-03-29 17:25:04 +01:00
Houtan Bastani 0d33a12d5b reporting: simplifying syntax at report object level for series 2013-03-29 17:25:04 +01:00
Houtan Bastani 922c0066c7 reporting: use end keyword in simplified syntax 2013-03-29 17:25:04 +01:00
Houtan Bastani 03e306785c reporting: @series use size instead of numel 2013-03-29 15:55:28 +01:00
Houtan Bastani 6e9be0feb4 reporting: support end keyword for indexing 2013-03-29 15:55:28 +01:00
Houtan Bastani 953dab0358 reporting: @graph: code cleanup 2013-03-29 15:55:27 +01:00
Houtan Bastani 2529b12660 reporting: @graph: issue warning if no series to plot 2013-03-29 15:55:27 +01:00
Houtan Bastani 258acc58ad reporting: numel -> numElements, numPages 2013-03-29 10:16:16 +01:00
Houtan Bastani 1b25e97051 reporting: @section: remove unsupported field 2013-03-28 18:08:16 +01:00
Houtan Bastani 7c7ff24ebe reporting: fix typo 2013-03-28 18:08:16 +01:00
Houtan Bastani 6b3b92d7dd reporting: @graph, @series, support syntax simplification 2013-03-28 18:08:16 +01:00
Houtan Bastani edf643af6b reporting: rename numElements as numel 2013-03-28 18:08:15 +01:00
Houtan Bastani a9ff5c74d3 reporting: @series class 2013-03-28 18:08:15 +01:00
Houtan Bastani 85d4bd69a3 reporting: @vspace 2013-03-20 18:17:36 +01:00
Houtan Bastani 5c82fcc87f reporting: spacing cleanup 2013-03-20 16:07:06 +01:00
Houtan Bastani 3ba1dcd408 reporting: @table, @graph: require data to be dynSeries, simplify checks 2013-03-20 15:42:56 +01:00
Houtan Bastani 6d0cd7ba5a reporting: @table: vlines 2013-03-20 12:56:49 +01:00
Houtan Bastani 1f73c74211 reporting: @table: only print given date range 2013-03-19 14:35:05 +01:00
Houtan Bastani 59ef4b9e68 reporting: add centering 2013-03-19 14:34:56 +01:00
Houtan Bastani ce65626a68 reporting: @table: simplify code 2013-03-19 12:51:02 +01:00
Houtan Bastani 5d5f394eb1 reporting: @page: allow for multiple titles, title_format, first args can be provided as strings or cellstr, multiple args as cellstr 2013-03-19 12:50:07 +01:00
Houtan Bastani 94c37bcf96 reporting: @graph: accept dynDate ranges for shade and xrange and float lower/upper bound for yrange 2013-03-15 18:56:03 +01:00
Houtan Bastani d905c6ad84 reporting: @graph: support multiple data sets in one graph 2013-03-15 18:56:03 +01:00
Houtan Bastani faf2d3be3f reporting: cosmetic changes 2013-03-15 18:56:03 +01:00
Houtan Bastani c09f1d02d0 reporting: @section: check user input 2013-03-15 18:56:02 +01:00
Houtan Bastani 9158ad5b8e reporting: @page: check user input 2013-03-15 18:56:02 +01:00
Houtan Bastani 13d82d94ed reporting: @report: check user input 2013-03-15 18:56:02 +01:00
Houtan Bastani 7efaaea364 reporting: @graph: check user input 2013-03-15 18:56:02 +01:00
Houtan Bastani 59a190a282 reporting: @table: user input bug fix 2013-03-15 17:23:21 +01:00
Houtan Bastani fb8cf54f08 reporting: check user input for table class 2013-03-14 19:15:00 +01:00
Houtan Bastani 33b76367ab reporting: allow selection of series in table 2013-03-14 18:45:10 +01:00
Houtan Bastani 263c84e985 reporting: xrange & yrange 2013-03-14 18:37:31 +01:00
Houtan Bastani b400fea376 reporting: change way to create temporary file 2013-03-14 14:46:32 +01:00
Houtan Bastani 2230380a35 reporting: code cleanup 2013-03-14 11:26:33 +01:00
Houtan Bastani 1d8fdfd31d reporting: simplified commands 2013-03-14 11:26:33 +01:00
Stéphane Adjemian (Ulysses) 3b8b6f82cf Moved shiftS function. 2013-03-14 11:08:34 +01:00
Houtan Bastani fbf807ad0f reporting: make errors more clear 2013-03-08 19:25:24 +01:00
Houtan Bastani 51f83a118d reporting: table 2013-03-08 18:59:26 +01:00
Houtan Bastani 16aebf892c reporting (WIP) 2013-03-07 16:40:12 +01:00
Houtan Bastani 1c371389df reporting (WIP) 2013-02-27 13:18:53 +01:00
Houtan Bastani ff4a155f07 reporting (WIP) 2013-02-18 18:16:44 +01:00
Houtan Bastani 95e2dd079e reporting (WIP) 2013-02-14 18:14:44 +01:00
Houtan Bastani 218c1655a1 reporting (WIP) 2013-02-12 14:53:36 +01:00
1355 changed files with 57582 additions and 50613 deletions

27
.clang-format Normal file
View File

@ -0,0 +1,27 @@
# NB: whenever the present file is modified, the same modification should be
# applied to the copy in preprocessor.git
# For general information about our coding style, and the specific version
# of clang-format used, see:
# https://git.dynare.org/Dynare/dynare/-/wikis/CodingGuidelines#c-code
# For the list of options of clang-format, see:
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# Effective configuration can be obtained with:
# clang-format --dump-config
Language: Cpp
Standard: c++20
ColumnLimit: 100
BasedOnStyle: GNU
AllowShortFunctionsOnASingleLine: None
AlwaysBreakTemplateDeclarations: Yes
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
Cpp11BracedListStyle: true
DeriveLineEnding: false
IndentPPDirectives: AfterHash
PackConstructorInitializers: NextLine
PPIndentWidth: 1
PointerAlignment: Left
SpaceAfterTemplateKeyword: false
SpaceBeforeParens: ControlStatements
SpaceBeforeCpp11BracedList: true

8
.clang-tidy Normal file
View File

@ -0,0 +1,8 @@
# NB: to use clang-tidy on the MEX source code, make sure that you have
# libomp-dev installed (the LLVM implementation of OpenMP)
# TODO: add the following check families:
# - bugprone-*
# - cppcoreguidelines-
Checks: 'performance-*,modernize-*,-modernize-use-trailing-return-type,-clang-diagnostic-unqualified-std-cast-call'

View File

@ -1,6 +1,8 @@
((c-mode . ((indent-tabs-mode . nil)
(fill-column . 100)
(c-file-style . "gnu")))
(c++-mode . ((indent-tabs-mode . nil)
(fill-column . 100)
(c-file-style . "gnu")))
(makefile-mode . ((indent-tabs-mode . t)))
(octave-mode . ((indent-tabs-mode . nil)

136
.gitignore vendored
View File

@ -3,108 +3,12 @@
# Any file that is displayed should be removed from the ignore list
# (possibly by an exclusion rule beginning with an exclamation mark)
# Generic ignore rules
*~
*.o
*.a
*.fig
\#*\#
TAGS
*.mat
# Build system rules
.deps
Makefile
Makefile.in
confdefs.h
configure
config.log
config.status
aclocal.m4
autom4te.cache
config.guess
config.sub
depcomp
install-sh
/missing
/mex/build/matlab/missing
/mex/build/octave/missing
/compile
/mex/build/matlab/compile
/mex/build/octave/compile
ylwrap
ar-lib
# checksum associated with fast option
checksum
# Make Check Rules
*.trs
*.tls
# Doc rules
*.pdf
*.aux
*.log
*.out
*.toc
*.idx
*.scn
*.nav
*.snm
*.vrb
*.bbl
*.blg
*.lof
/doc/manual/build
/doc/manual/utils/version.py
# Created when building the reference manual
/doc/manual/utils/__pycache__/*
!/doc/guide.bbl
!/doc/parallel/AvenueParadigm.pdf
!/doc/parallel/iVaNo_*.pdf
!/doc/parallel/netbook_*.pdf
!/doc/parallel/quest_*.pdf
!/doc/parallel/RWMH_quest1_*.pdf
!/doc/parallel/waitbars*.pdf
doc/internals/*.html
doc/internals/ltxpng
# MATLAB dir
/matlab/preprocessor64/
/matlab/dynare_version.m
# DLL rules
*.mex
*.mexa64
*.mexw64
*.mexmaci64
*.mexmaca64
/mex/matlab/
/mex/octave/
# Symbolic links created for building MEX files
/mex/build/matlab/*/*.c
/mex/build/matlab/*/*.cc
/mex/build/matlab/*/*.f08
/mex/build/matlab/*/*.F08
/mex/build/octave/*/*.c
/mex/build/octave/*/*.cc
/mex/build/octave/*/*.f08
/mex/build/octave/*/*.F08
# Fortran modules
/mex/build/matlab/*/*.mod
/mex/build/octave/*/*.mod
# Extra rules for trust_region MEX testfiles
/mex/sources/block_trust_region/test/*.mod
/mex/sources/block_trust_region/test/dulmage_mendelsohn_test
/mex/sources/block_trust_region/test/trust_region_test
!/mex/sources/block_trust_region/test/Makefile
# Windows
!/windows/Makefile
!/windows/deps/Makefile
# Created by the Windows package build script
/windows/deps/lib64/
/windows/deps/lib64-msys2/
/windows/deps/matlab64/
@ -115,35 +19,17 @@ doc/internals/ltxpng
/windows/exe/
/windows/7z/
/windows/zip/
/matlab/preprocessor64/
/matlab/supported_octave_version.m
# MacOS stuff
.DS_Store
/macOS/pkg/
/macOS/deps/sources64/
# Created by the macOS package build script
/macOS/deps/arm64/sources64/
/macOS/deps/x86_64/sources64/
/macOS/deps/tarballs/
/macOS/deps/lib64/
!/macOS/Makefile
!/macOS/deps/Makefile
/macOS/deps/arm64/lib64/
/macOS/deps/x86_64/lib64/
build-doc
# Emacs stuff
TAGS
scripts/dynare.elc
# MS-Sbvar
/contrib/ms-sbvar/*.prn
/contrib/ms-sbvar/*.dat
/contrib/ms-sbvar/sbvar_commandline
/contrib/ms-sbvar/sbvar_init_file
!/contrib/ms-sbvar/Makefile
/tests/ms-sbvar/*.tmp
# Reporting
*synctex.gz
tests/reporting/tmpRepDir
# Octave variables saved when Octave crashes
octave-workspace
# VERSION generated file
VERSION
matlab/supported_octave_version.m

View File

@ -1,72 +1,84 @@
variables:
GIT_SUBMODULE_STRATEGY: recursive
TERM: linux
MATLAB_VERSION: R2023a
OLD_MATLAB_VERSION: R2014a
MATLAB_VERSION: R2023b
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'
# The next stanza creates the version number used for the source tarball and the
# binary packages. Here are the following possible cases:
# - 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:
- '[[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Dynare ]] && [[ -n $CI_COMMIT_TAG ]] && export VERSION=$CI_COMMIT_TAG'
- '[[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Dynare ]] && [[ $CI_COMMIT_REF_NAME == master ]] && export VERSION=6-unstable-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA'
- '[[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Dynare ]] && export VERSION=$CI_COMMIT_REF_NAME-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA'
- '[[ -z $VERSION ]] && export VERSION=$CI_PROJECT_NAMESPACE-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA'
- '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=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'
stages:
- build
- test
- pkg
- sign
- deploy
build_binaries:
build_matlab:
stage: build
script:
- autoreconf -si
- ./configure --with-matlab=/opt/MATLAB/$MATLAB_VERSION PACKAGE_VERSION=$VERSION PACKAGE_STRING="dynare $VERSION"
- make -j $(nproc) LN_S="cp -p"
- meson setup -Dbuild_for=matlab -Dmatlab_path=/opt/MATLAB/$MATLAB_VERSION -Dbuildtype=release build-matlab
- meson compile -v -C build-matlab
artifacts:
paths:
- preprocessor/dynare-preprocessor
- mex/octave/
- mex/matlab/
- build-matlab/
expire_in: 3 days
build_octave:
stage: build
script:
- meson setup -Dbuild_for=octave -Dbuildtype=release build-octave
- meson compile -v -C build-octave
artifacts:
paths:
- build-octave/
expire_in: 3 days
build_doc:
stage: build
script:
- autoreconf -si
- ./configure --disable-matlab --disable-octave PACKAGE_VERSION=$VERSION PACKAGE_STRING="dynare $VERSION"
- make -j $(nproc) pdf html
- meson rewrite kwargs set project / version "$VERSION"
# Use a local copy of MathJax to avoid using CDN (which are a privacy issue)
# NB: Debian 12 “Bookworm” has MathJax 2. The following needs to be updated
# when Debian moves to MathJax 3.
- meson setup -Dbuild_for=octave -Dmathjax_path=mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML build-doc
- meson compile -v -C build-doc doc
- cp -dR /usr/share/javascript/mathjax build-doc/dynare-manual.html/_static/
artifacts:
paths:
- doc/manual/build/
- doc/**/*.pdf
- preprocessor/doc/*/*.pdf
- build-doc/
expire_in: 3 days
pkg_source:
stage: pkg
script:
- rm doc/manual/source/_static/mathjax && sed -i "/^mathjax_path *=/d" doc/manual/source/conf.py
- 'for f in configure.ac preprocessor/configure.ac mex/build/matlab/configure.ac mex/build/octave/configure.ac; do sed -i "s/^AC_INIT(\[\(.*\)\],\s*\[\(.*\)\])/AC_INIT([\1], [$VERSION])/" $f; done'
- autoreconf -si
- ./configure --with-matlab=/opt/MATLAB/$MATLAB_VERSION
- make dist
- meson rewrite kwargs set project / version "$VERSION"
- git commit -a -m "Source for $VERSION"
- meson setup -Dbuild_for=octave build-src
- meson dist -C build-src --no-tests
artifacts:
paths:
- dynare-*.tar.xz
- build-src/meson-dist/dynare-*.tar.xz
expire_in: 3 days
needs: []
pkg_windows:
stage: pkg
script:
- meson rewrite kwargs set project / version "$VERSION"
- mkdir -p windows/deps/tarballs && cp /usr/lib/dynare-runner/matlab64-* windows/deps/tarballs/
- make -C windows
- rm windows/deps/tarballs/matlab64-* # No need to cache these files
@ -90,16 +102,18 @@ pkg_windows:
expire_in: 3 days
needs: [ "build_doc" ]
pkg_macOS:
pkg_macOS_x86_64:
stage: pkg
script:
- ln -s ~/tarballs macOS/deps/
- arch -x86_64 make -C macOS
# 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
- make -C macOS build-x86_64
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- macOS/deps/sources64/
- macOS/deps/lib64/
- macOS/deps/x86_64/sources64/
- macOS/deps/x86_64/lib64/
tags:
- macOS
artifacts:
@ -108,32 +122,46 @@ pkg_macOS:
expire_in: 3 days
needs: [ "build_doc" ]
.test_matlab_template:
stage: test
pkg_macOS_arm64:
stage: pkg
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
- make -C macOS build-arm64
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- macOS/deps/arm64/sources64/
- macOS/deps/arm64/lib64/
tags:
- macOS
artifacts:
paths:
- tests/**/*.m.log
- tests/**/*.m.trs
- tests/**/*.jnl
- tests/run_test_matlab_output.txt
when: always
needs: [ "build_binaries" ]
- macOS/pkg/*
expire_in: 3 days
needs: [ "build_doc" ]
test_matlab:
extends: .test_matlab_template
stage: test
script:
- autoreconf -si
- ./configure --disable-octave --with-matlab=/opt/MATLAB/$MATLAB_VERSION
- make -j $(($(nproc) * 3 / 4)) -C tests check-matlab
- meson test -C build-matlab --no-rebuild --num-processes $(($(nproc) * 3 / 4))
artifacts:
paths:
- build-matlab/meson-logs/testlog.txt
when: always
needs: [ "build_matlab" ]
test_old_matlab:
extends: .test_matlab_template
stage: test
script:
- autoreconf -si
- ./configure --disable-octave --with-matlab=/opt/MATLAB/$OLD_MATLAB_VERSION
- make -C mex/build/matlab clean
- make -j $(nproc) -C mex/build/matlab
- make -j $(($(nproc) * 3 / 4)) -C tests check-matlab
- meson setup -Dbuild_for=matlab -Dmatlab_path=/opt/MATLAB/$OLD_MATLAB_VERSION -Dbuildtype=release build-old-matlab
- meson compile -v -C build-old-matlab
- meson test -C build-old-matlab --num-processes $(($(nproc) * 3 / 4))
artifacts:
paths:
- build-old-matlab/meson-logs/testlog.txt
when: always
when: manual
test_octave:
@ -141,22 +169,41 @@ test_octave:
variables:
OPENBLAS_NUM_THREADS: 1
script:
- autoreconf -si
- ./configure --disable-matlab
- make -j $(nproc) -C tests check-octave
- meson test -C build-octave --no-rebuild
artifacts:
paths:
- tests/**/*.o.log
- tests/**/*.o.trs
- tests/**/*.jnl
- tests/run_test_octave_output.txt
- build-octave/meson-logs/testlog.txt
when: always
needs: [ "build_binaries" ]
needs: [ "build_octave" ]
when: manual
# For the deploy jobs, we dont use the “needs” keyword, since we dont want
# those jobs to start before the “test” and “pkg” stages have succeeded. Hence
# we stick to the “dependencies” keyword.
test_clang_format:
stage: test
script:
- meson setup -Dbuild_for=octave build-clang-format
- ninja -C build-clang-format clang-format-check
needs: []
# For the sign and deploy jobs, we dont use the “needs” keyword, since we
# dont want those jobs to start before the “test” and “pkg” stages have
# succeeded. Hence we stick to the “dependencies” keyword.
sign_windows:
stage: sign
rules:
- if: '$CI_PROJECT_NAMESPACE == "Dynare" && $CI_COMMIT_REF_NAME == "master"'
when: on_success
- when: never
tags:
- sign
dependencies:
- pkg_windows
script:
- f=(windows/exe/*) && mkdir -p windows/exe-signed/ && osslsigncode sign -pkcs11module /usr/lib/x86_64-linux-gnu/libykcs11.so.2 -key "pkcs11:id=%01;type=private;pin-value=$YUBIKEY_PIN" -certs ~/cepremap-code-signing-comodo-sectigo.pem -n Dynare -i https://www.dynare.org -t http://timestamp.comodoca.com -in ${f[0]} -out windows/exe-signed/${f[0]##*/}
artifacts:
paths:
- windows/exe-signed/*
expire_in: 3 days
deploy_manual_unstable:
stage: deploy
@ -165,13 +212,11 @@ deploy_manual_unstable:
when: on_success
- when: never
tags:
- restricted
- deploy
dependencies:
- build_doc
script:
- rm -rf doc/manual/build/html/_static/mathjax
- ln -s /usr/share/javascript/mathjax doc/manual/build/html/_static/mathjax
- rsync --recursive --links --delete doc/manual/build/html/ /srv/www.dynare.org/manual-unstable/
- rsync --recursive --links --delete build-doc/dynare-manual.html/ /srv/www.dynare.org/manual-unstable/
deploy_snapshot_unstable:
stage: deploy
@ -180,17 +225,19 @@ deploy_snapshot_unstable:
when: on_success
- when: never
tags:
- restricted
- deploy
dependencies:
- pkg_source
- pkg_windows
- pkg_macOS
- sign_windows
- pkg_macOS_arm64
- pkg_macOS_x86_64
script:
- f=(windows/exe/*) && osslsigncode sign -pkcs12 ~/cepremap-comodo-sectigo-code-signing.p12 -n Dynare -i https://www.dynare.org -t http://timestamp.comodoca.com -in ${f[0]} -out ${f[0]}.signed && mv ${f[0]}.signed ${f[0]}
- cp *.tar.xz /srv/www.dynare.org/snapshot/source/ && ln -sf *.tar.xz /srv/www.dynare.org/snapshot/source/dynare-latest-src.tar.xz
- f=(windows/exe/*) && cp ${f[0]} /srv/www.dynare.org/snapshot/windows/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/windows/dynare-latest-win.exe
- cp build-src/meson-dist/*.tar.xz /srv/www.dynare.org/snapshot/source/ && ln -sf *.tar.xz /srv/www.dynare.org/snapshot/source/dynare-latest-src.tar.xz
- f=(windows/exe-signed/*) && cp ${f[0]} /srv/www.dynare.org/snapshot/windows/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/windows/dynare-latest-win.exe
- f=(windows/7z/*) && cp ${f[0]} /srv/www.dynare.org/snapshot/windows-7z/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/windows-7z/dynare-latest-win.7z
- f=(windows/zip/*) && cp ${f[0]} /srv/www.dynare.org/snapshot/windows-zip/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/windows-zip/dynare-latest-win.zip
- f=(macOS/pkg/*) && cp ${f[0]} /srv/www.dynare.org/snapshot/macos/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/macos/dynare-latest-macos.pkg
- f=(macOS/pkg/*-arm64.pkg) && cp ${f[0]} /srv/www.dynare.org/snapshot/macos-arm64/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/macos-arm64/dynare-latest-macos-arm64.pkg
- f=(macOS/pkg/*-x86_64.pkg) && cp ${f[0]} /srv/www.dynare.org/snapshot/macos-x86_64/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/macos-x86_64/dynare-latest-macos-x86_64.pkg
- ~/update-snapshot-list.sh
- curl -X POST -F token="$WEBSITE_PIPELINE_TRIGGER_TOKEN" -F ref=master https://git.dynare.org/api/v4/projects/40/trigger/pipeline

11
.gitmodules vendored
View File

@ -10,19 +10,10 @@
[submodule "matlab/utilities/tests"]
path = matlab/utilities/tests
url = ../../Dynare/m-unit-tests.git
[submodule "matlab/particles"]
path = matlab/particles
url = ../../Dynare/particles.git
[submodule "matlab/modules/dseries"]
path = matlab/modules/dseries
path = matlab/dseries
url = ../../Dynare/dseries.git
branch = master
[submodule "matlab/modules/reporting"]
path = matlab/modules/reporting
url = ../../Dynare/reporting.git
[submodule "contrib/jsonlab"]
path = contrib/jsonlab
url = https://github.com/fangq/jsonlab.git
[submodule "preprocessor"]
path = preprocessor
url = ../../Dynare/preprocessor.git

View File

@ -12,10 +12,8 @@ Please note that the repositories under the purview of this page are:
* [Dynare](https://git.dynare.org/Dynare/dynare)
* [Preprocessor](https://git.dynare.org/Dynare/preprocessor)
* [Particles](https://git.dynare.org/Dynare/particles)
* [Dseries](https://git.dynare.org/Dynare/dseries)
* [Reporting](https://git.dynare.org/Dynare/reporting)
* [Testsuite](https://git.dynare.org/Dynare/testsuite)
* [M-unit-tests](https://git.dynare.org/Dynare/m-unit-tests)
## Making your Intentions Known
@ -94,9 +92,9 @@ The output from the latest run of the test suite can be found in the `test_matla
Its useful to contribute `.mod` files that test some aspect of Dynare that is not currently tested. A `.mod` file that runs into a bug is perfect. As the test suite currently takes several hours to run, we prefer you modify a current test to also create the bug youve found. If you cant do that, please add a new test that runs as quickly as possible. It will contain only those commands necessary to create the bug, nothing more. To contribute a test, after having made an issue and cloned and forked the repository as described above, do the following:
1. Modify the `MODFILES` variable in `tests/Makefile.am` with a line containing your test file name
1. If any ancillary files are needed to run your test, please include them in the `EXTRA_DIST` variable in `tests/Makefile.am`
1. Add and commit your test file and `tests/Makefile.am` as described above
1. Modify the `mod_and_m_tests` variable in `meson.build` with a entry containing your test file name
1. If any ancillary files are needed to run your test, please include them in the `'extra'` field
1. Add and commit your test file and `meson.build` as described above
1. Push and create a pull request as described above
### Unit tests

View File

@ -1,67 +0,0 @@
SUBDIRS = preprocessor doc tests mex/sources
if ENABLE_MATLAB
SUBDIRS += mex/build/matlab
endif
if ENABLE_OCTAVE
SUBDIRS += mex/build/octave
endif
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = \
matlab \
contrib \
NEWS.md \
license.txt \
README.md \
COPYING \
CONTRIBUTING.md \
windows \
macOS \
examples \
scripts \
.dir-locals.el
all-local:
# Create top-level preprocessor symlink needed by matlab/dynare.m (when Dynare is run
# from the locally-built copy)
$(LN_S) -f $(abs_builddir)/preprocessor/src/dynare-preprocessor$(EXEEXT) $(abs_builddir)/preprocessor/dynare-preprocessor$(EXEEXT)
# Create backward-compatibility symlink for old location of preprocessor
$(MKDIR_P) matlab/preprocessor64/
$(LN_S) -f $(abs_builddir)/preprocessor/src/dynare-preprocessor$(EXEEXT) $(abs_srcdir)/matlab/preprocessor64/dynare_m$(EXEEXT)
clean-local:
rm -f preprocessor/dynare-preprocessor$(EXEEXT)
rm -rf matlab/preprocessor64/
dist-hook:
rm -rf `find $(distdir)/matlab $(distdir)/examples -name *~`
rm -f $(distdir)/matlab/dynare_version.m
rm -rf $(distdir)/matlab/preprocessor64/
$(MKDIR_P) $(distdir)/mex/matlab $(distdir)/mex/octave
rm -rf `find $(distdir) -name '.git*'`
install-exec-local:
$(MKDIR_P) $(DESTDIR)$(pkglibdir)/preprocessor
# The following will break under Windows, but we dont use the install rule there
$(LN_S) -f $(bindir)/dynare-preprocessor$(EXEEXT) $(DESTDIR)$(pkglibdir)/preprocessor/dynare-preprocessor$(EXEEXT)
$(MKDIR_P) $(DESTDIR)$(pkglibdir)/contrib/ms-sbvar/TZcode
cp -r contrib/ms-sbvar/TZcode/MatlabFiles $(DESTDIR)$(pkglibdir)/contrib/ms-sbvar/TZcode
$(MKDIR_P) $(DESTDIR)$(pkglibdir)/contrib/jsonlab
cp -r contrib/jsonlab $(DESTDIR)$(pkglibdir)/contrib/jsonlab
cp -r examples $(DESTDIR)$(pkglibdir)
cp -r matlab $(DESTDIR)$(pkglibdir)
find $(DESTDIR)$(pkglibdir) -name LICENSE.md -delete
# Recreate backward-compatibility symlink
rm -f $(DESTDIR)$(pkglibdir)/matlab/preprocessor64/dynare_m$(EXEEXT)
$(LN_S) -f $(bindir)/dynare-preprocessor$(EXEEXT) $(DESTDIR)$(pkglibdir)/matlab/preprocessor64/dynare_m$(EXEEXT)
# We dont fail over doc install rules, since the user may deliberately not have compiled them
# (e.g. with the “nodoc” option under Debian)
$(MKDIR_P) $(DESTDIR)$(docdir)
-cp doc/*.pdf doc/gsa/gsa.pdf doc/parallel/parallel.pdf doc/dseries-and-reporting/dseriesReporting.pdf preprocessor/doc/preprocessor/preprocessor.pdf preprocessor/doc/macroprocessor/macroprocessor.pdf doc/manual/build/latex/dynare-manual.pdf $(DESTDIR)$(docdir)
-cp -r doc/manual/build/html $(DESTDIR)$(docdir)/dynare-manual.html
uninstall-local:
rm -rf $(DESTDIR)$(pkglibdir)
rm -rf $(DESTDIR)$(docdir)

461
NEWS.md
View File

@ -1,3 +1,464 @@
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 models
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. 434455.
- 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), 145.
- Christiano, Lawrence J., Mathias Trabandt, and Karl Walentin (2010): “DSGE
Models for Monetary Policy Analysis,” In: *Handbook of Monetary Economics
3*, 285367.
- 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)
===========================================
We are pleased to announce the release of Dynare 5.5.
This maintenance release fixes various bugs.
The Windows, macOS and source packages are already available for download at
[the Dynare website](https://www.dynare.org/download/).
All users are strongly encouraged to upgrade.
This release is compatible with MATLAB versions ranging from 8.3 (R2014a) to
23.2 (R2023b), and with GNU Octave version 8.3.0 (under Windows).
Note for macOS users with an Apple Silicon processor: this is the first Dynare
release that comes with native Apple Silicon (arm64) support under MATLAB.
Please download the corresponding package, to be used with MATLAB R2023b for
Apple Silicon.
Here is a list of the problems identified in version 5.4 and that have been
fixed in version 5.5:
* In a stochastic context, results could be incorrect if an endogenous with a
lead ⩾ 2 or an exogenous with a lead ⩾ 1 appeared in the argument(s) of a
call to a (nonlinear) external function
* With the `use_dll` option of the `model` block, the expression `sign(x)`
would evaluate to ±1 instead of 0 if `x=0`
* If the guess value given to the `steady` command was such that the residuals
were all below tolerance, except some that are `NaN`, then this guess value
was incorrectly accepted as the solution to the steady state problem
* The `method_of_moments` command with GMM was ignoring the
`analytic_standard_errors` option when using `mode_compute=4`
* Homotopy with the `extended_path` command at `order=0` was broken
* The `parallel_use_psexec` command-line option was ignored
* With the `bytecode` option of the `model` block, using the operators `abs()`,
`cbrt()` and `sign()` would lead to a crash
* The `fast` command-line option was broken under MATLAB with Windows
* Ramsey steady state computation could fail if an `expectation` or `diff`
operator was present in the model
* A crash could occur if some external function call was present in an
auxiliary variable
* The `endogenous_prior` option of the `estimation` command could erroneously
display a warning message about missing observations
* The `model_comparison` command would crash if the `.mod` file name had less
than four characters
* The `shock_decomposition` command would overwrite previously stored smoother
results
* The `x13` interface in dseries did not handle missing values, particularly at
the beginning of a series
* The `x13` interface in dseries would occasionally crash under Windows with
segmentation violations
* OccBin: estimation would crash if a previous `shocks(surprise)` simulation
was conducted
* The `internals` command would not find the location of the `_results.mat`
file
* The `prior optimize` command would not work with `mode_compute=5`
Announcement for Dynare 5.4 (on 2023-03-22)
===========================================

284
README.md
View File

@ -33,8 +33,6 @@ This source can be retrieved in three forms:
- using the stable source archive of the latest Dynare version from <https://www.dynare.org/download/>
- using a source snapshot of the unstable version, also from <https://www.dynare.org/download/>
Note that if you obtain the source code via git, you will need to install more tools (see below).
The first section of this page gives general instructions, which apply to all platforms. Then some specific platforms are discussed.
**Note:** Here, when we refer to 32-bit or 64-bit, we refer to the type of
@ -58,6 +56,7 @@ a 32-bit Octave.
1. [**Fedora, CentOS or RHEL**](#fedora-centos-or-rhel)
1. [**Windows**](#windows)
1. [**macOS**](#macos)
1. [**Docker**](#docker)
## General Instructions
@ -65,28 +64,27 @@ a 32-bit Octave.
A number of tools and libraries are needed in order to recompile everything. You don't necessarily need to install everything, depending on what you want to compile.
- A POSIX compliant shell and an implementation of Make (mandatory)
- The [GNU Compiler Collection](https://gcc.gnu.org/), version 10 or later, with
gcc, g++ and gfortran (mandatory)
gcc, g++ and gfortran
- [MATLAB](https://mathworks.com) (if you want to compile the MEX for MATLAB)
- [GNU Octave](https://www.octave.org) with
- the development headers (if you want to compile the MEX for Octave)
- the development libraries corresponding to the [UMFPACK](https://people.engr.tamu.edu/davis/suitesparse.html) packaged with Octave
- Optionally, the [Control](https://octave.sourceforge.io/control/), [IO](https://octave.sourceforge.io/io/), [Optimization](https://octave.sourceforge.io/optim/) and [Statistics](https://octave.sourceforge.io/statistics/) package either installed via your package manager or through [Octave Forge](https://octave.sourceforge.io/).
- the development libraries corresponding to the [UMFPACK](https://people.engr.tamu.edu/davis/suitesparse.html) packaged with Octave (if you want to compile the MEX for Octave)
- the [statistics](https://octave.sourceforge.io/statistics/) package and, optionally, the [control](https://octave.sourceforge.io/control/), [io](https://octave.sourceforge.io/io/) and [optimization](https://octave.sourceforge.io/optim/) packages, either installed via your package manager or through [Octave Forge](https://octave.sourceforge.io/)
- [Meson](https://mesonbuild.com), version 0.64.0 or later
- [Pkgconf](http://pkgconf.org/), or another pkg-config implementation
- [Bash](https://www.gnu.org/software/bash/)
- [Boost libraries](https://www.boost.org), version 1.36 or later
- [Bison](https://www.gnu.org/software/bison/), version 3.2 or later (only if you get the source through Git)
- [Flex](https://github.com/westes/flex), version 2.5.4 or later (only if you get the source through Git)
- [Autoconf](https://www.gnu.org/software/autoconf/), version 2.62 or later (only if you get the source through Git)
- [Automake](https://www.gnu.org/software/automake/), version 1.11.2 or later (only if you get the source through Git)
- [MAT File I/O library](https://sourceforge.net/projects/matio/), version 1.5 or later (if you want to compile Markov-Switching SBVAR code)
- [SLICOT](http://www.slicot.org) (if you want to compile the Kalman steady state DLL)
- [GSL library](https://www.gnu.org/software/gsl/) (if you want to compile Markov-Switching SBVAR code)
- [Bison](https://www.gnu.org/software/bison/), version 3.2 or later
- [Flex](https://github.com/westes/flex), version 2.5.4 or later
- [MAT File I/O library](https://sourceforge.net/projects/matio/), version 1.5 or later (only when compiling for Octave)
- [SLICOT](http://www.slicot.org)
- [GSL library](https://www.gnu.org/software/gsl/)
- A decent LaTeX distribution (if you want to compile PDF documentation),
ideally with Beamer
- For building the reference manual:
- [Sphinx](https://www.sphinx-doc.org/)
- [MathJax](https://www.mathjax.org/)
- [Doxygen](https://www.doxygen.nl) (if you want to build Dynare preprocessor source documentation)
- [X-13ARIMA-SEATS Seasonal Adjustment Program](https://www.census.gov/data/software/x13as.html)
### Preparing the sources
@ -98,99 +96,69 @@ have the [Git LFS](https://git-lfs.github.com/) extension installed):
```sh
git clone --recurse-submodules https://git.dynare.org/Dynare/dynare.git
cd dynare
autoreconf -si
```
The last line runs Autoconf and Automake in order to prepare the build environment (this is not necessary if you got the sources from an official source archive or the source snapshot). If you want a certain version (e.g. 5.x) , then add `--single-branch --branch 5.x` to the git clone command.
If you want a certain version (e.g. 5.x) , then add `--single-branch --branch 5.x` to the git clone command.
### Configuring the build tree
### Configuring the build directory
Simply launch the configure script from a terminal:
If you want to compile for MATLAB, please run the following (after adapting the path to MATLAB):
```sh
./configure --with-matlab=<…>
meson setup -Dmatlab_path=/usr/local/MATLAB/R2023b -Dbuildtype=debugoptimized build-matlab
```
where the path to MATLAB is specified.
The build directory will thus be `build-matlab`.
Some important options:
- `--disable-matlab`: skip the compilation of MEX files for MATLAB
- `--disable-octave`: skip the compilation of MEX files for Octave
- `--disable-doc`: skip the compilation of the documentation (PDF and HTML)
You may need to specify additional options to the configure script, see the output of the `--help` option, and also the platform specific instructions below. If the configuration goes well, the script will tell you which components are correctly configured and will be built.
Note that it is possible that some MEX files cannot be compiled, due to missing
build dependencies. If you find no way of installing the missing dependencies,
a workaround can be to give up on compiling these MEX files and rather use
slower implementations (in the MATLAB/Octave language) that are available under
the `matlab/missing/mex/` subdirectories. For example, if you fail to compile
the gensylv MEX, you can type the following at the MATLAB/Octave prompt before
running Dynare:
```matlab
addpath <DYNARE_ROOT>/matlab/missing/mex/gensylv
Or for Octave:
```sh
meson setup -Dbuild_for=octave -Dbuildtype=debugoptimized build-octave
```
(where you need to replace `<DYNARE_ROOT>` with the full path to your Dynare copy).
The build directory will thus be `build-octave`.
Note that if you do not chose `build-matlab` (under MATLAB) or `build-octave`
(under Octave) as the build directory, you will need to set the environment
variable `DYNARE_BUILD_DIR` to the full path of your build tree, before running
MATLAB or Octave, if you want Dynare to be able to find the preprocessor and
the MEX files.
It is possible to specify various Meson options, see the Meson documentation
for more details. Modifying options of an existing build directory can be
done using the `meson configure` command.
### Building
Binaries are built with:
For compiling the preprocessor and the MEX files:
```sh
make
meson compile -C <builddir>
```
PDF and HTML documentation are respectively built with:
where `<builddir>` is the build directory, typically either `build-matlab` or `build-octave`.
PDF and HTML documentation can be built with:
```sh
make pdf
make html
meson compile -C <builddir> doc
```
### Check
The Git source comes with unit tests (in the MATLAB functions) and integration tests (under the `tests` subfolder). All the tests can be run with:
Dynare comes with unit tests (in the MATLAB functions) and integration tests (under the `tests` subfolder). All the tests can be run with:
```sh
make check
```
in the `tests` subfolder. If Dynare has been compiled against MATLAB and Octave, the tests will be run with both MATLAB and Octave. Depending on the performance of your machine, this can take several hours. It is possible to run the tests only with MATLAB:
```sh
make check-matlab
```
or only with Octave:
```sh
make check-octave
meson test -C <builddir>
```
Depending on the performance of your machine, this can take several hours.
Note that running the testsuite with Octave requires the additional packages `pstoedit`, `epstool`, `xfig`, and `gnuplot`.
A summary of the results is available in `tests/run_test_matlab_output.txt` or `tests/run_test_octave_output.txt`. 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:
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
make deterministic_simulations
meson test -C <builddir> --suite deterministic_simulations
```
This will run all the integration tests in `tests/deterministic_simulations` with MATLAB and Octave. Again, it is possible to do this only with MATLAB:
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
make m/deterministic_simulations
meson test -C <builddir> deterministic_simulations/lbj/rbc.mod
```
or with Octave:
```sh
make o/deterministic_simulations
```
Finally if you want to run a single integration test, e.g. `deterministic_simulations/lbj/rbc.mod` with MATLAB:
```sh
make deterministic_simulations/lbj/rbc.m.trs
```
or with Octave:
```sh
make deterministic_simulations/lbj/rbc.o.trs
```
The result of the test (`PASSED` or `FAILED`) will be printed in the terminal, the produced log can be displayed with:
```sh
make deterministic_simulations/lbj/rbc.m.drs
```
or
```sh
make deterministic_simulations/lbj/rbc.o.drs
```
Note that only tests will be executed where the `m.trs/o.trs` does not yet exist. You can run
```sh
make clean
```
in the `tests` folder to delete files that were created by the run of the testsuite. You can also manually delete the desired `m.trs/o.trs` file(s).
NB: Some individual tests cannot be run using that syntax, if they are a dependency in a chain of tests (see the `mod_and_m_tests` variable `meson.build`); in that case, you should use the name of the last `.mod` file in the chain as the test name to be passed to `meson test`.
## Debian or Ubuntu
@ -199,7 +167,6 @@ All the prerequisites are packaged:
- `gcc`
- `g++`
- `gfortran`
- `make`
- `octave-dev` (or `liboctave-dev` on older Debian/Ubuntu releases)
- `libboost-graph-dev`
- `libgsl-dev`
@ -208,39 +175,31 @@ All the prerequisites are packaged:
- `libsuitesparse-dev`
- `flex` and `libfl-dev`
- `bison`
- `autoconf`
- `automake`
- `meson`
- `pkgconf`
- `texlive`
- `texlive-publishers` (for Econometrica bibliographic style)
- `texlive-latex-extra` (for fullpage.sty)
- `texlive-fonts-extra` (for ccicons)
- `texlive-science` (for amstex)
- `texlive-plain-generic`
- `lmodern` (for macroprocessor PDF)
- `python3-sphinx`
- `tex-gyre`
- `latexmk`
- `libjs-mathjax`
- `doxygen`
- `x13as`
You can install them all at once with:
```sh
apt install gcc g++ gfortran make octave-dev libboost-graph-dev libgsl-dev libmatio-dev libslicot-dev libslicot-pic libsuitesparse-dev flex libfl-dev bison autoconf automake texlive texlive-publishers texlive-latex-extra texlive-fonts-extra texlive-science texlive-plain-generic lmodern python3-sphinx tex-gyre latexmk libjs-mathjax doxygen 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 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.
Tested on
- Debian “Buster” 10
- Debian “Bullseye” 11
- Ubuntu 20.04
- Ubuntu 20.10
## Fedora, CentOS or RHEL
Almost all prerequisites are packaged:
- `gcc`, `gcc-c++`, `make`
- `gcc`, `gcc-c++`
- `gcc-gfortran`
- `boost-devel`
- `gsl-devel`
@ -248,24 +207,23 @@ Almost all prerequisites are packaged:
- `suitesparse-devel`
- `flex`
- `bison`
- `autoconf`
- `automake`
- `meson`
- `redhat-rpm-config`
- `octave`, `octave-devel`, `octave-statistics`, `octave-io`, `octave-optim`, `octave-control`
- `texlive-scheme-minimal`, `texlive-collection-publishers`, `texlive-collection-latexextra`, `texlive-collection-fontsextra`, `texlive-collection-latexrecommended`, `texlive-collection-science`, `texlive-collection-plaingeneric`, `texlive-lm`
- `python3-sphinx`
- `latexmk`
- `mathjax`
- `doxygen`
- `make` (for building Slicot)
You can install them all at once with:
```sh
# Minimal packages (use --disable-doc and --disable-octave flags)
dnf install -y gcc gcc-c++ make gcc-gfortran boost-devel gsl-devel matio-devel suitesparse-devel flex bison autoconf automake redhat-rpm-config
# Octave packages (use --disable-doc flag)
# Minimal packages
dnf install -y gcc gcc-c++ make gcc-gfortran boost-devel gsl-devel matio-devel suitesparse-devel flex bison meson redhat-rpm-config
# Octave packages
dnf install octave octave-devel octave-statistics octave-io octave-optim octave-control
# Documentation packages
dnf install texlive-scheme-minimal texlive-collection-publishers texlive-collection-latexextra texlive-collection-fontsextra texlive-collection-latexrecommended texlive-collection-science texlive-collection-plaingeneric texlive-lm python3-sphinx latexmk mathjax doxygen
# Documentation packages (only needed if you build documentation)
dnf install texlive-scheme-minimal texlive-collection-publishers texlive-collection-latexextra texlive-collection-fontsextra texlive-collection-latexrecommended texlive-collection-science texlive-collection-plaingeneric texlive-lm python3-sphinx latexmk mathjax
```
In Fedora these are available from the default repositories; whereas for CentOS and RHEL you need to enable the [Extra Packages for Enterprise Linux (EPEL)](https://fedoraproject.org/wiki/EPEL) repository and either the PowerTools repository for CentOS or the CodeReady Linux Builder repository for RHEL:
```sh
@ -276,7 +234,7 @@ dnf config-manager --set-enabled PowerTools
ARCH=$( /bin/arch )
subscription-manager repos --enable "codeready-builder-for-rhel-8-${ARCH}-rpms"
```
The documentation packages have slightly different names in CentOS and RHEL, you can also choose to pass the `--disable-doc` flag to your configure script to skip these dependencies.
The documentation packages have slightly different names in CentOS and RHEL, but this should only impact you if you build the documentation.
`Slicot` and `x13as` need to be compiled from source:
@ -287,16 +245,19 @@ 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
make FORTRAN=gfortran OPTS="-O2 -fPIC -fdefault-integer-8" LOADER=gfortran lib
mkdir -p /home/$USER/dynare/slicot/lib
cp slicot.a /home/$USER/dynare/slicot/lib/libslicot64_pic.a #for matlab
cp slicot.a /home/$USER/dynare/slicot/lib/libslicot_pic.a #for octave
# The following two lines are only for MATLAB
make 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
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-b59.tar.gz
tar xf x13as_asciisrc-v1-1-b59.tar.gz
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
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/
@ -304,17 +265,16 @@ 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.
Keep in mind to use the `--with-slicot` option to the configure command, e.g.:
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
autoreconf -si
./configure --with-slicot=/home/$USER/dynare/slicot --with-matlab=/usr/local/MATLAB/R2020b
make -j$(($(nproc)+1)) #rule of thumb: one more than CPUs as shown by e.g. lscpu
meson setup -Dmatlab_path=/usr/local/MATLAB/R2023b -Dfortran_args="[ '-B', '/home/$USER/dynare/slicot']" -Dbuildtype=debugoptimized build-matlab
meson compile -C build-matlab
```
If your distribution ships an older version of `bison`, compile it from source and append it *temporarily* to your path before calling the configure script:
If your distribution ships an older version of `bison`, compile it from source and append it *temporarily* to your path before running meson:
```sh
bison --version # bison (GNU Bison) 3.0.4
mkdir -p /home/$USER/dynare/bison
@ -330,12 +290,6 @@ bison --version # bison (GNU Bison) 3.6.4
```
Now configure dynare as above.
Tested on
- CentOS 8
- Fedora Workstation 32
- Fedora Workstation 33
- Red Hat Enterprise Linux 8
## Windows
- Install [MSYS2](http://www.msys2.org)
@ -349,9 +303,9 @@ pacman -Syu
window to complete the upgrade.
- Install all needed dependencies:
```sh
pacman -S git autoconf automake-wrapper bison flex make tar texinfo mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-boost mingw-w64-x86_64-gsl mingw-w64-x86_64-matio
pacman -S git bison flex make tar mingw-w64-x86_64-meson mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-boost mingw-w64-x86_64-gsl mingw-w64-x86_64-matio mingw-w64-x86_64-pkgconf
```
- Compile and install SLICOT, needed for the `kalman_steady_state` MEX file
- 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
@ -365,11 +319,10 @@ cd ..
```sh
git clone --recurse-submodules https://git.dynare.org/Dynare/dynare.git
cd dynare
autoreconf -si
```
- Configure Dynare from the source directory:
```sh
./configure --with-slicot=/usr/local --with-matlab=<…> --disable-octave --disable-doc
meson setup -Dmatlab_path=<…> -Dbuildtype=debugoptimized -Dprefer_static=true -Dfortran_args="['-B','/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
@ -379,11 +332,11 @@ does not have short filenames (8dot3), then you can run `mkdir -p
then pass `/usr/local/MATLAB/…` as MATLAB path to the configure script.
- Compile:
```sh
make
meson compile -C build-matlab
```
- Run the testsuite:
```sh
make -C tests check-matlab
meson test -C build-matlab
```
**Note:** The above assumes that you have a 64-bit version of MATLAB. It can be
@ -453,29 +406,29 @@ export PATH="$BREWDIR/bin:$PATH"
```
- Install required Homebrew packages and link sphinx-doc:
- Install required Homebrew packages:
```sh
arch -$ARCH $BREWDIR/bin/brew install automake bison flex boost gcc gsl libmatio veclibfort octave sphinx-doc docutils wget
arch -$ARCH $BREWDIR/bin/brew install meson bison flex boost gcc gsl libmatio veclibfort octave sphinx-doc docutils wget pkg-config git-lfs
```
If you want to compile the documentation, you need to link sphinx-doc:
If you are installing `git-lfs` for the first time, you need to run `git lfs install` once after installing it.
- Link the sphinx-doc package to be able to compile the documentation:
```sh
arch -$ARCH $BREWDIR/bin/brew link --force sphinx-doc
```
Otherwise add `--disable-doc` flag to the `configure` command below, if you want to skip this.
- Install [MacTeX](http://www.tug.org/mactex/index.html) using the universal installer. MacTeX runs natively on both ARM and Intel machines. On Apple Silicon, it is advised to symlink `pdflatex` and `bibtex` into `/usr/local/bin`:
- Install [MacTeX](http://www.tug.org/mactex/index.html) using the universal installer, if you want to build the documentation. MacTeX runs natively on both ARM and Intel machines. On Apple Silicon, it is advised to symlink `pdflatex`, `bibtex` and `latexmk` into `/usr/local/bin`:
```sh
sudo ln -s /Library/TeX/texbin/pdflatex /usr/local/bin/pdflatex
sudo ln -s /Library/TeX/texbin/bibtex /usr/local/bin/bibtex
sudo ln -s /Library/TeX/texbin/latexmk /usr/local/bin/latexmk
```
Alternatively, if you dont want to install MacTeX, you should pass the `--disable-doc` flag to the `configure` command below.
If you don't have admin privileges, then you can also symlink them into `$HOME/.local/bin` and add this folder to your PATH.
- Install MATLAB and additional toolboxes.
We recommend, but don't require, the following: Optimization, Global Optimization, Statistics and Machine Learning, Econometrics, and Control System.
For Apple Silicon: MATLAB offers a native Apple silicon version of R2022b as an open beta. You can sign up and install it (including a suitable Java 8 JRE, e.g. Amazon Corretto 8) using
[the official instructions](https://de.mathworks.com/support/apple-silicon-r2022b-beta.html).
Unfortunately, this version does not support yet the Optimization, Global Optimization and Econometrics toolboxes.
If you need these, please run the Intel version (under Rosetta 2) instead.
For Apple Silicon: MATLAB offers a native Apple silicon version (arm64) as of version R2023b, see [the official instructions](https://de.mathworks.com/support/requirements/apple-silicon.html) how to install it.
You can also run the Intel version (x86_64) under Rosetta 2.
Don't forget to run MATLAB at least once to make sure you have a valid license.
- Create a folder for Dynare and its dependencies
@ -483,7 +436,7 @@ Don't forget to run MATLAB at least once to make sure you have a valid license.
export DYNAREDIR=$HOME/dynare
```
- Compile and install SLICOT, needed for e.g. the `kalman_steady_state` MEX file.
- Compile and install SLICOT
```sh
mkdir -p $DYNAREDIR/slicot/lib
cd $DYNAREDIR/slicot
@ -495,22 +448,21 @@ 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
cp slicot.a $DYNAREDIR/slicot/lib/libslicot64_pic.a
cd $HOME/dynare
```
- Compile and install the X-13ARIMA-SEATS Seasonal Adjustment Program
```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-b59.tar.gz
tar xf x13as_asciisrc-v1-1-b59.tar.gz
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
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
mkdir -p $HOME/.local/bin
cp x13as $HOME/.local/bin/x13as
cd ;
sudo cp $DYNAREDIR/x13as/x13as /usr/local/bin/x13as
cd $DYNAREDIR
x13as
```
Alternatively, if you don't have admin privileges you can install it into `$HOME/.local/bin` and add this folder to your PATH.
### Compile Dynare from source
The following commands will download the Dynare source code and compile
@ -519,48 +471,48 @@ folder where you want Dynare installed.
- Prepare the Dynare sources for the unstable version:
```sh
mkdir -p $DYNAREDIR/unstable
git clone --recurse-submodules https://git.dynare.org/Dynare/dynare.git $DYNAREDIR/unstable
cd $DYNAREDIR/unstable
arch -$ARCH autoreconf -si
```
You can also choose a specific version of Dynare by checking out the corresponding branch or a specific tag with git.
If you want a certain version (e.g. 5.x) , then add `--single-branch --branch 5.x` to the git clone command.
- Configure Dynare from the source directory:
```sh
arch -$ARCH ./configure --prefix=$BREWDIR CC=gcc-13 CXX=g++-13 CPPFLAGS=-I$BREWDIR/include LDFLAGS=-L$BREWDIR/lib LEX=$BREWDIR/opt/flex/bin/flex YACC=$BREWDIR/opt/bison/bin/bison --with-slicot=$DYNAREDIR/slicot --with-matlab=/Applications/MATLAB_R2022b_Beta.app
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
```
where you need to adapt the path to MATLAB. If you dont have MATLAB, simply replace `--with-matlab=<…>` by `--disable-matlab`.
Similarly, if you don't want to compile for Octave add a `--disable-octave` flag.
Check the output of the command whether Dynare is configured for building everything except the internal docs of Dynare and M2HTML.
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`.
- Compile:
```sh
arch -$ARCH make -j$(sysctl -n hw.ncpu)
arch -$ARCH meson compile -C $BUILDDIR
```
If no errors occured, you are done. Dynare is now ready to use.
If you additionally want to compile the documentation run:
- If you additionally want to compile the documentation run:
```sh
arch -$ARCH make pdf
arch -$ARCH make html
arch -$ARCH meson compile -C $BUILDDIR doc
```
### Optional: pass the full PATH to MATLAB to run system commands
If you start MATLAB from a terminal, you will get the PATH inherited from the shell.
However, when you click on the application icon in macOS, you are not running at the terminal level:
the program is run by launcher, which does not go through a shell login session.
In other words, you get the system default PATH which includes `/usr/bin:/bin:/usr/sbin:/sbin`, but not `/usr/local/bin` or `$HOME/.local/bin`.
So if you want to use system commands like `pdflatex` or `x13as` you should either call them by their full path (e.g `/Library/TeX/texbin/pdflatex`)
or append the PATH in MATLAB by running `setenv('PATH', [getenv('PATH') ':/usr/local/bin:$HOME/.local/bin:/Library/TeX/texbin']);`.
Alternatively, you can create a `startup.m` file or change the system default PATH in the `/etc/paths` file.
- Optionally, run the testsuite:
```sh
arch -$ARCH meson test -C $BUILDDIR --num-processes=$(sysctl -n hw.perflevel0.physicalcpu)
```
where `--num-processes` specifies the number of parallel processes to use for the testsuite (here set to the number of performance cores on your mac).
### Optional: pass the full PATH to MATLAB to run system commands
If you start MATLAB from a terminal, you will get the PATH inherited from the shell.
However, when you click on the application icon in macOS, you are not running at the terminal level:
the program is run by launcher, which does not go through a shell login session.
In other words, you get the system default PATH which includes `/usr/bin:/bin:/usr/sbin:/sbin`, but not `/usr/local/bin` or `$HOME/.local/bin`.
So if you want to use system commands like `pdflatex` or `x13as` you should either call them by their full path (e.g `/Library/TeX/texbin/pdflatex`) or append the PATH in MATLAB by running `setenv('PATH', [getenv('PATH') ':/usr/local/bin:$HOME/.local/bin:/Library/TeX/texbin']);`.
Alternatively, you can create a `startup.m` file or change the system default PATH in the `/etc/paths` file.
So if you want to use system commands like `pdflatex`, `latexmk` or `x13as` you should either call them by their full path (e.g `/Library/TeX/texbin/pdflatex`)
or append the PATH by running `setenv('PATH', [getenv('PATH') ':/usr/local/bin:$HOME/.local/bin:/Library/TeX/texbin']);` in your MATLAB command line once,
e.g. by adding this to your mod file. Alternatively, you can create a `startup.m` file or change the system default PATH in the `/etc/paths` file.
Last tested on:
- macOS Ventura 13.3.1 (MacBook Air M1, MacBook Pro M2 MAX, M2 Virtual Machine using Parallels, Intel Virtual Machine using Quickemu)
## Docker
We offer a variety of pre-configured Docker containers for Dynare, pre-configured with Octave and MATLAB including all recommended toolboxes.
These are readily available for your convenience on [Docker Hub](https://hub.docker.com/r/dynare/dynare).
The `scripts/docker` folder contains [information and instructions](scripts/docker/README.md) to interact, built and customize the containers.

View File

@ -1 +0,0 @@
@PACKAGE_VERSION@

View File

@ -1,125 +0,0 @@
dnl Process this file with autoconf to produce a configure script.
dnl Copyright © 2009-2023 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
dnl Dynare is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl Dynare is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Dynare. If not, see <https://www.gnu.org/licenses/>.
AC_PREREQ([2.62])
AC_INIT([dynare], [6-unstable])
AC_CONFIG_SRCDIR([preprocessor/src/DynareMain.cc])
AM_INIT_AUTOMAKE([1.11 -Wall -Wno-portability foreign no-dist-gzip dist-xz tar-pax])
AC_CONFIG_SUBDIRS([preprocessor])
# For setting EXEEXT, needed by top-level Makefile.am
AC_PROG_CC
AX_PROG_LN_S
AC_PROG_MKDIR_P
# Define optional components and their corresponding flags and Automake conditionals
AC_ARG_ENABLE([doc], AS_HELP_STRING([--disable-doc], [disable compilation of documentation]), [], [enable_doc=yes])
AM_CONDITIONAL([ENABLE_DOC], [test "$enable_doc" = yes])
AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab], [disable compilation of MEX files for MATLAB]), [], [enable_matlab=yes])
AM_CONDITIONAL([ENABLE_MATLAB], [test "$enable_matlab" = yes])
AC_ARG_ENABLE([octave], AS_HELP_STRING([--disable-octave], [disable compilation of MEX files for Octave]), [], [enable_octave=yes])
AM_CONDITIONAL([ENABLE_OCTAVE], [test "$enable_octave" = yes])
AC_ARG_ENABLE([org-export], AS_HELP_STRING([--enable-org-export], [enable exporting of Org files (requires Emacs, org-mode and other external programs)]))
AM_CONDITIONAL([ENABLE_ORG_EXPORT], [test -n "$enable_org_export"])
# Check utilities needed for documentation
if test "$enable_doc" = yes; then
AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex], [no])
test "$PDFLATEX" = no && AC_MSG_ERROR([pdflatex cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])
AC_CHECK_PROG([BIBTEX], [bibtex], [bibtex], [no])
test "$BIBTEX" = no && AC_MSG_ERROR([bibtex cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])
AC_CHECK_PROG([SPHINXBUILD], [sphinx-build], [sphinx-build], [no])
test "$SPHINXBUILD" = no && AC_MSG_ERROR([sphinx-build cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])
AX_LATEX_CLASS([beamer], [ax_latex_have_beamer], [], [AC_MSG_ERROR([beamer cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])])
fi
# Check for MATLAB
if test "$enable_matlab" = yes; then
AC_CONFIG_SUBDIRS([mex/build/matlab])
AX_MATLAB
AX_MATLAB_BATCH_OPTIONS
test "$ax_enable_matlab" != yes && AC_MSG_ERROR([MATLAB cannot be found. If you want to compile Dynare without MATLAB support, pass the --disable-matlab flag.])
fi
# Check for Octave
if test "$enable_octave" = yes; then
AC_CONFIG_SUBDIRS([mex/build/octave])
AX_OCTAVE
test "$ax_enable_octave" != yes && AC_MSG_ERROR([Octave cannot be found. If you want to compile Dynare without Octave support, pass the --disable-octave flag.])
fi
# Construct final output message
if test "$enable_doc" = yes; then
BUILD_DOC="yes"
else
BUILD_DOC="no"
fi
if test -n "$enable_org_export"; then
BUILD_INTERNAL_DOC="yes"
else
BUILD_INTERNAL_DOC="no"
fi
if test "$enable_matlab" = yes; then
TESTSUITE_MATLAB="yes"
else
TESTSUITE_MATLAB="no"
fi
if test "$enable_octave" = yes; then
TESTSUITE_OCTAVE="yes"
else
TESTSUITE_OCTAVE="no"
fi
AC_MSG_NOTICE([
Dynare is now configured for building the following components...
Documentation (with "make html pdf"):
Manual and other documents $BUILD_DOC
Dynare internal doc: $BUILD_INTERNAL_DOC
Testsuites (run with "make check"):
Dynare for MATLAB: $TESTSUITE_MATLAB
Dynare for Octave: $TESTSUITE_OCTAVE
])
AC_CONFIG_FILES([Makefile
VERSION
doc/Makefile
doc/manual/Makefile
doc/manual/utils/version.py
doc/parallel/Makefile
doc/internals/Makefile
doc/gsa/Makefile
doc/dseries-and-reporting/Makefile
tests/Makefile
matlab/dynare_version.m
mex/sources/Makefile
])
AC_OUTPUT

@ -1 +0,0 @@
Subproject commit 5a58fafdca239e61be4d7b2270307b2445bb571a

@ -1 +1 @@
Subproject commit f1d0fd61ea6d9c4f8694b373780d6c372e344f6e
Subproject commit 391689d9f1bea4bd68ef6641dc2dc4a1bd867850

@ -1 +1 @@
Subproject commit 216abedb9ab4df5dd4dca07c721f7c07392801e9
Subproject commit ac6d0ae1b69cda26aa9486188d54c8c010f115c4

View File

@ -1,34 +0,0 @@
SUBDIRS = parallel internals gsa dseries-and-reporting
if ENABLE_DOC
SUBDIRS += manual
pdf-local: guide.pdf bvar-a-la-sims.pdf dr.pdf sylvester.pdf tl.pdf
endif
EXTRA_DIST = guide.tex guide.bbl bibmad.sty bvar-a-la-sims.tex dr.tex dr.bib dynare.plots
guide.pdf: guide.tex guide.bbl bibmad.sty
$(PDFLATEX) guide
$(PDFLATEX) guide
bvar-a-la-sims.pdf: bvar-a-la-sims.tex
$(PDFLATEX) bvar-a-la-sims
$(PDFLATEX) bvar-a-la-sims
dr.pdf: dr.tex
$(PDFLATEX) dr
$(BIBTEX) dr
$(PDFLATEX) dr
$(PDFLATEX) dr
sylvester.pdf: sylvester.tex
$(PDFLATEX) sylvester
$(PDFLATEX) sylvester
tl.pdf: tl.tex
$(PDFLATEX) tl
$(PDFLATEX) tl
clean-local:
# Do not delete guide.bbl which is not autogenerated
rm -f *~ *.pdf *.log *.aux *.out *.blg dr.bbl

View File

@ -1,105 +0,0 @@
\message{harvard bibliography,}
\def\@hiteml[#1]#2#3#4{\item[]\if@filesw%
{ \def\protect##1{\string ##1\space}\immediate%
\write\@auxout{\string\harvardcite{#4}{#2}{#1}{#3}}}\fi%
\protect\hspace*{-\labelwidth}\protect\hspace*{-\labelsep}\ignorespaces}
\def\@hitem#1#2#3{\item[]\if@filesw%
{ \def\protect##1{\string ##1\space}\immediate%
\write\@auxout{\string\harvardcite{#3}{#1}{#1}{#2}}}\fi%
\protect\hspace*{-\labelwidth}\protect\hspace*{-\labelsep}\ignorespaces}
\def\harvarditem{\@ifnextchar [{\@hiteml}{\@hitem}}
\def\harvardcite#1#2#3#4{
\global\@namedef{bhf@#1}{#2}
\global\@namedef{bha@#1}{#3}
\global\@namedef{bhy@#1}{#4}\global\@namedef{b@#1}{\csname bhf@#1\endcsname}
}
\def\citeasnoun{\@ifnextchar [{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}}
\def\cite{\@ifnextchar [{\@tempswatrue\@citexasnoun}
{\@tempswafalse\@citexasnoun[]}
}
\def\citeyear{\@ifnextchar [{\@tempswatrue\@citexyear}
{\@tempswafalse\@citexyear[]}
}
\def\citename{\@ifnextchar [{\@tempswatrue\@citexname}
{\@tempswafalse\@citexname[]}
}
% \def\@enamedef#1{\expandafter\edef\csname #1\endcsname}
% Previous line should be replaced by the following to prevent
% problems with the NFSS. Solution by Bernd Raichle.
\def\@enamedef#1{\expandafter\def\csname #1\expandafter\endcsname\expandafter}
\def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
\def\@citea{}\@cite{\@for\@citeb:=#2\do
{\@citea\def\@citea{\@hisep\penalty\@m\ }\@ifundefined
{b@\@citeb}{{\bf ?}\@warning
{Citation `\@citeb' on page \thepage \space undefined}}%
{{\csname b@\@citeb\endcsname\@hysep\csname bhy@\@citeb\endcsname}%
\global\@enamedef{b@\@citeb}{\csname bha@\@citeb\endcsname}}%
}}{#1}}
\def\@citexasnoun[#1]#2{%
\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi%
\@citeasnoun{{\@ifundefined%
{b@#2}%
{[{\bf ?}\@warning{Citation `#2' on page \thepage \space undefined}}%
{{\csname b@#2\endcsname\ [\csname bhy@#2\endcsname}%
\global\@namedef{b@#2}{\csname bha@#2\endcsname}}%
}}{#1}}
\def\@citexname[#1]#2{%
\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi%
\@citename{{\@ifundefined%
{b@#2}%
{{\bf ?}\@warning{Citation `#2' on page \thepage \space undefined}}%
{{\csname bhf@#2\endcsname}}%
}}{#1}}
\def\@citexyear[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
\def\@citeayear{}\@cite{\@for\@citebyear:=#2\do
{\@citeayear\def\@citeayear{\@hisep\penalty\@m\ }\@ifundefined
{b@\@citebyear}{{\bf ?}\@warning
{Citation `\@citebyear' on page \thepage \space undefined}}%
{{\csname bhy@\@citebyear\endcsname}%
}%
}}{#1}}
\gdef\hysep@agsm{\ }\gdef\hisep@agsm{,}%
\gdef\hysep@dcu{, }\gdef\hisep@dcu{;}%
\let\@hysep\hysep@agsm \let\@hisep\hisep@agsm
\def\citationstyle#1{%
\global\@namedef{@hysep}{\csname hysep@#1\endcsname}%
\global\@namedef{@hisep}{\csname hisep@#1\endcsname}}
%DEFAULT DEFINITIONS
\def\@cite#1#2{({#1\if@tempswa , #2\fi})}
\def\@citeasnoun#1#2{{#1\if@tempswa , #2\fi]}}
\def\@citename#1#2{{#1\if@tempswa \ (#2)\fi}}
% CHANGE \end{document} - to handle double definitions
\def\enddocument{\@checkend{document}\clearpage\begingroup
\if@filesw \immediate\closeout\@mainaux
\def\global\@namedef##1##2{}\def\newlabel{\@testdef r}%
\def\bibcite{\@testdef b}%
\def\harvardcite{\@testbibh}\@tempswafalse \makeatletter\input \jobname.aux
\if@tempswa \@warning{Label(s) may have changed. Rerun to get
cross-references right}\fi\fi\endgroup\deadcycles\z@\@@end}
\def\@testbibh #1#2#3{
\def\@tempa{#2}\expandafter
\ifx \csname bhf@#1\endcsname \@tempa
\def\@tempa{#3}\expandafter
\ifx \csname bha@#1\endcsname \@tempa
\else \@tempswatrue
\fi
\else
\@tempswatrue
\fi
}
%

View File

@ -1,14 +0,0 @@
if ENABLE_DOC
pdf-local: dseriesReporting.pdf
endif
SRC = dseriesReporting.tex
EXTRA_DIST = $(SRC)
dseriesReporting.pdf: $(SRC)
$(PDFLATEX) dseriesReporting
$(PDFLATEX) dseriesReporting
clean-local:
rm -f dseriesReporting.pdf *.toc *.aux *.log *.nav *.snm *.vrb *.out *~

View File

@ -1,16 +0,0 @@
if ENABLE_DOC
pdf-local: gsa.pdf
endif
SRC = gsa.tex marco.bib
EXTRA_DIST = $(SRC)
gsa.pdf: $(SRC)
$(PDFLATEX) gsa
$(BIBTEX) gsa
$(PDFLATEX) gsa
$(PDFLATEX) gsa
clean-local:
rm -f *.pdf *.log *.aux *.toc *.lof *.blg *.bbl *.out *~

View File

@ -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.

View File

@ -1,16 +0,0 @@
\ifx\undefined\bysame
\newcommand{\bysame}{\leavevmode\hbox to\leftmargin{\hrulefill\,\,}}
\fi
\begin{thebibliography}{xx}
\harvarditem[Collard and Juillard]{Collard and Juillard}{2001}{COLL/JUIL/01a}
{ Collard, F. and M.~Juillard}, Accuracy of stochastic perturbation methods:
The case of asset pricing models, {\it Journal of Economic Dynamics and
Control}, 2001, {\it 25}, 979--999.
\harvarditem[Schmitt-Grohe and Uribe]{Schmitt-Grohe and Uribe}{2002}{SGU/02}
{ Schmitt-Grohe, S. and M.~Uribe}, {\it Solving Dynamic General Equilibrium
Models Using a Second-Order Approximation to the Policy Function}, technical
working paper, Rutgers Univsersity 2002.
\end{thebibliography}

View File

@ -1,9 +0,0 @@
EXTRA_DIST = dynare-internals.org
if ENABLE_ORG_EXPORT
html-local:
emacs --batch --visit=dynare-internals.org --funcall org-html-export-to-html
endif
clean-local:
rm -rf *.html ltxpng

View File

@ -2,7 +2,6 @@ function build_internal_documentation()
% The name of the function should be explicit...
datafiles = [];
datafiles = [ datafiles ; {'../../matlab/utilities/dataset'}, {'initialize_dataset'}];
datafiles = [ datafiles ; {'../../matlab/utilities/dataset'}, {'descriptive_statistics'}];
datafiles = [ datafiles ; {'../../matlab/utilities/dataset'}, {'compute_stdv'}];
datafiles = [ datafiles ; {'../../matlab/utilities/dataset'}, {'compute_cova'}];
@ -81,4 +80,4 @@ if rows(miscfiles)
fprintf(fid,'\n\n\n');
end
end
fclose(fid);
fclose(fid);

View File

@ -1,19 +0,0 @@
EXTRA_DIST = source \
utils/dynare_dom.py \
utils/dynare_lex.py
SRC = $(wildcard source/*.rst)
html-local: build/html/index.html
build/html/index.html: $(SRC) source/conf.py
$(SPHINXBUILD) -M html source build
pdf-local: build/latex/dynare-manual.pdf
build/latex/dynare-manual.pdf: $(SRC) source/conf.py
$(SPHINXBUILD) -M latexpdf source build
clean-local:
rm -rf build
rm -rf utils/__pycache__

View File

@ -1 +0,0 @@
/usr/share/javascript/mathjax/

View File

@ -13,20 +13,23 @@ Bibliography
* Andrews, Donald W.K (1991): “Heteroskedasticity and autocorrelation consistent covariance matrix estimation”, *Econometrica*, 59(3), 817858.
* Backus, David K., Patrick J. Kehoe, and Finn E. Kydland (1992): “International Real Business Cycles,” *Journal of Political Economy*, 100(4), 745775.
* 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), 575593.
* Bini, Dario A., Guy Latouche, and Beatrice Meini (2002): “Solving matrix polynomial equations arising in queueing problems,” *Linear Algebra and its Applications*, 340, 225244.
* 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, 711734.
* 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. 434455.
* 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, 1938.
* Christiano, Lawrence J., Martin Eichenbaum and Charles L. Evans (2005): “Nominal Rigidities and the Dynamic Effects of a Shock to Monetary Policy,” *Journal of Political Economy*, 113(1), 145.
* Christiano, Lawrence J., Mathias Trabandt, and Karl Walentin (2010): “DSGE Models for Monetary Policy Analysis,” In: *Handbook of Monetary Economics 3*, 285367.
* Christiano, Lawrence J., Mathias Trabandt and Karl Walentin (2011): “Introducing financial frictions and unemployment into a small open economy model,” *Journal of Economic Dynamics and Control*, 35(12), 19992041.
* Christoffel, Kai, Günter Coenen and Anders Warne (2010): “Forecasting with DSGE models,” *ECB Working Paper Series*, 1185.
* Collard, Fabrice (2001): “Stochastic simulations with Dynare: A practical guide”.
* Collard, Fabrice and Michel Juillard (2001a): “Accuracy of stochastic perturbation methods: The case of asset pricing models,” *Journal of Economic Dynamics and Control*, 25, 979999.
* 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, 125139.
* 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), 262280.
* 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), 643673.
* Dennis, Richard (2007): “Optimal Policy In Rational Expectations Models: New Solution Algorithms”, *Macroeconomic Dynamics*, 11(1), 3155.
* Duffie, Darrel and Kenneth J. Singleton (1993): “Simulated Moments Estimation of Markov Models of Asset Prices”, *Econometrica*, 61(4), 929-952.
@ -46,6 +49,7 @@ Bibliography
* Hansen, Lars P. (1982): “Large sample properties of generalized method of moments estimators,” Econometrica, 50(4), 10291054.
* 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, 282291.
* Harvey, Andrew C. and Garry D.A. Phillips (1979): “Maximum likelihood estimation of regression models with autoregressive-moving average disturbances,” *Biometrika*, 66(1), 4958.
* 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), 693705.
* Ireland, Peter (2004): “A Method for Taking Models to the Data,” *Journal of Economic Dynamics and Control*, 28, 120526.
* Iskrev, Nikolay (2010): “Local identification in DSGE models,” *Journal of Monetary Economics*, 57(2), 189202.

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright © 2018-2022 Dynare Team
# Copyright © 2018-2024 Dynare Team
#
# This file is part of Dynare.
#
@ -31,20 +31,14 @@ templates_path = ['_templates']
html_static_path = ['_static']
mathjax_path = 'mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
master_doc = 'index'
project = u'Dynare'
copyright = u'19962022 Dynare Team'
copyright = u'19962024 Dynare Team'
author = u'Dynare Team'
add_function_parentheses = False
# See ../utils/version.py, which is generated by autoconf
from version import version
from version import release
language = 'en'
exclude_patterns = []
@ -77,12 +71,11 @@ 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
}
latex_documents = [
(master_doc, 'dynare-manual.tex', u'Dynare Reference Manual',
u'Dynare team', 'manual'),
u'Dynare Team', 'manual'),
]
man_pages = [

View File

@ -8,6 +8,20 @@
Dynare misc commands
####################
.. 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 ;
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 ;
Puts the IRFs stored in ``oo_.irfs`` into vectors with the same name into the base workspace.
.. command:: prior_function(OPTIONS);
Executes a user-defined function on parameter draws from the prior
@ -53,8 +67,9 @@ Dynare misc commands
.. command:: generate_trace_plots(CHAIN_NUMBER);
Generates trace plots of the MCMC draws for all estimated
parameters and the posterior density in the specified Markov Chain
``CHAIN_NUMBER``.
parameters and the posterior density for the specified Markov Chain(s)
``CHAIN_NUMBER``. If ``CHAIN_NUMBER`` is a vector of integers, the trace plots
will plot contains separate lines for each chain.
|br|
@ -154,7 +169,7 @@ Dynare misc commands
|br|
.. matcomm:: prior [OPTIONS[, ...]];
.. matcomm:: prior [OPTIONS[ ...]];
Prints information about the prior distribution given the provided
options. If no options are provided, the command returns the list of
@ -215,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.

View File

@ -5,13 +5,13 @@ Currently the development team of Dynare is composed of:
* Stéphane Adjemian (Le Mans Université, Gains)
* Michel Juillard (Banque de France)
* Sumudu Kankanamge (Toulouse School of Economics and CEPREMAP)
* Sumudu Kankanamge (Le Mans Université and CEPREMAP)
* Frédéric Karamé (Le Mans Université, Gains and CEPREMAP)
* Junior Maih (Norges Bank)
* 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-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 Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.

View File

@ -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 (12
“Monterey”), and FreeBSD. Dynare should work on other systems, but some
GNU/Linux distributions (Debian, Ubuntu, Linux Mint, Arch Linux), macOS (13
Ventura), 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 8.3 (R2014a) to 9.14 (R2023a);
* GNU Octave, any version ranging from 6.2.0 to 8.2.0, with the statistics package
* 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
from `Octave-Forge`_. Note however that the Dynare installer for Windows
requires a more specific version of Octave, as indicated on the download
page.
@ -26,8 +26,8 @@ extra features, but are in no way required:
* If under MATLAB: the Optimization Toolbox, the Statistics Toolbox,
the Control System Toolbox;
* If under Octave, the following `Octave-Forge`_ packages: ``optim, io,
control``.
* If under Octave, the following `Octave-Forge`_ packages: ``optim``, ``io``,
``control``.
Installation of Dynare
@ -95,29 +95,23 @@ With MATLAB
^^^^^^^^^^^
To install Dynare for use with MATLAB, execute the automated installer called
``dynare-x.y.pkg`` (where *x.y* is the version number), and follow the
instructions. The default installation directory is
``/Applications/Dynare/x.y``. After installation, this directory will contain
several sub-directories, among which are ``matlab``, ``mex``, and ``doc``.
``dynare-x.y-arch.pkg`` (where *x.y* is the version number and *arch* is either arm64 for Apple Silicon or x86_64 for Intel architectures),
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::
Note that several versions of Dynare can coexist (by default in
``/Applications/Dynare``), as long as you correctly adjust your path
settings (see :ref:`words-warning`).
sudo chown -R "$USER":staff /Applications/Dynare
By default, the installer installs a version of GCC (for use with :opt:`use_dll`)
in the installation directory, under the ``.brew`` folder. To do so, it also
installs a version of Homebrew_ in the same folder and
Xcode Command Line Tools (this is an Apple product) in a system folder.
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`).
All of this requires a bit of time and hard disk space. The amount of time it
takes will depend on your computing power and internet connection. To reduce
the time the Dynare installer takes, you can install Xcode Command Line Tools
yourself (see :ref:`prerequisites-macos`). Dynare, Homebrew, and GCC use
about 600 MB of disk space while the Xcode Command Line Tools require about 400
MB.
If you do not use the :opt:`use_dll` option, you have the choice to forgo the
installation of GCC and hence Dynare will only take about 50 MB of disk space.
It is recommended to install the Xcode Command Line Tools (this is an Apple product)
and GCC via Homebrew_ (see :ref:`prerequisites-macos`).
With Octave
^^^^^^^^^^^
@ -192,8 +186,26 @@ Dynare now ships a compilation environment that can be used with the
:opt:`use_dll` option. To install this environment correctly, the Dynare
installer ensures that the Xcode Command Line Tools (an Apple product) have
been installed on a system folder. To install the Xcode Command Line Tools
yourself, simply type ``xcode-select --install`` into the Terminal
yourself, simply type ``xcode-select --install`` into the terminal
(``/Applications/Utilities/Terminal.app``) prompt.
Additionally, to make MATLAB aware that you agree to the terms of Xcode, run the following two commands in the Terminal prompt::
CLT_VERSION=$(pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version | awk '{print $2}' | cut -d'.' -f1-2)
defaults write com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense "${CLT_VERSION}"
defaults read com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense
Otherwise you will see a warning that Xcode is installed, but its license has not been accepted.
You can check this e.g. by running the following command in the MATLAB command window::
mex -setup
Moreover, we recommend making use of optimized compilation flags when using :opt:`use_dll` and for this you need to install GCC via Homebrew_::
brew install gcc
If you already have installed GCC, Dynare will automatically prefer it for :opt:`use_dll`
if the binaries are either in ``/opt/homebrew/bin`` on Apple Silicon (arm64) or in ``/usr/local/bin`` on Intel (x86_64) systems.
Otherwise, it will fall back to Clang in ``/usr/bin/clang``, which works both on arm64 and x86_64 systems.
With Octave
^^^^^^^^^^^

View 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:

View File

@ -204,7 +204,7 @@ by the ``dynare`` command.
.. option:: params_derivs_order=0|1|2
When :comm:`identification`, :comm:`dynare_sensitivity` (with
identification), or :ref:`estimation_cmd <estim-comm>` are
identification), or :ref:`estimation <estim-comm>` are
present, this option is used to limit the order of the
derivatives with respect to the parameters that are calculated
by the preprocessor. 0 means no derivatives, 1 means first
@ -409,9 +409,11 @@ by the ``dynare`` command.
.. option:: fast
Only useful with model option :opt:`use_dll`. Dont recompile the
MEX files when running again the same model file and the lists
of variables and the equations havent changed. We use a 32
Dont rewrite the output files otherwise written to the disk by the preprocessor
when re-running the same model file while the lists of variables and the equations
havent changed. Note that the whole model still needs to be preprocessed. This option
is most useful with model option :opt:`use_dll`, because
the time-consuming compilation of the MEX files will be skipped. We use a 32
bit checksum, stored in ``<model filename>/checksum``. There
is a very small probability that the preprocessor misses a
change in the model. In case of doubt, re-run without the fast
@ -552,7 +554,7 @@ by the ``dynare`` command.
executing the ``dynare`` command will leave variables containing
results in the workspace available for further processing. More
details are given under the relevant computing tasks. The
``M_``,``oo_``, and ``options_`` structures are saved in a file
``M_``, ``oo_``, and ``options_`` structures are saved in a file
called ``FILENAME_results.mat`` located in the ``MODFILENAME/Output`` folder.
If they exist, ``estim_params_``,
``bayestopt_``, ``dataset_``, ``oo_recursive_`` and

View File

@ -15,11 +15,16 @@ related to the model (and hence not placed in the model file). At the
moment, it is only used when using Dynare to run parallel
computations.
On Linux and macOS, the default location of the configuration file is
``$HOME/.dynare``, while on Windows it is ``%APPDATA%\dynare.ini``
(typically ``c:\Users\USERNAME\AppData\dynare.ini``). You
can specify a non standard location using the ``conffile`` option of
the ``dynare`` command (see :ref:`dyn-invoc`).
On Linux and macOS, the configuration file is 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 searched by default in
``%APPDATA%\dynare\dynare.ini`` (typically
``c:\Users\USERNAME\AppData\Roaming\dynare\dynare.ini``). You can specify a non
standard location using the ``conffile`` option of the ``dynare`` command (see
:ref:`dyn-invoc`).
The parsing of the configuration file is case-sensitive and it should
take the following form, with each option/choice pair placed on a
@ -54,7 +59,7 @@ conventions such as ``USER_NAME`` have been excluded for concision):
``PATH_AND_FILE``
Indicates a valid path to a file in the underlying operating
system (e.g. ``/usr/local/MATLAB/R2010b/bin/matlab``).
system (e.g. ``/usr/local/MATLAB/R2023b/bin/matlab``).
``BOOLEAN``
@ -76,8 +81,15 @@ processing. Currently, there is only one option available.
.. option:: GlobalInitFile = PATH_AND_FILE
The location of the global initialization file to be run at
the end of ``global_initialization.m``.
The location of a global initialization file that can be used to
customize some Dynare internals (typically default option values). This
is a MATLAB/Octave script.
If this option is not specified, Dynare will look for a
``global_init.m`` file in its 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).
*Example*
@ -270,20 +282,42 @@ lines starting with a hashtag (#).
.. option:: MatlabOctavePath = PATH_AND_FILE
The path to the MATLAB or Octave executable. The default value
is ``matlab`` as MATLAB's executable is typically in the %PATH% environment
is ``matlab`` as MATLABs executable is typically in the %PATH% environment
variable. When using full paths on Windows, you may need to enclose the path
in quoted strings, e.g. ``MatlabOctavePath="C:\Program Files\MATLAB\R2023a\bin\matlab.exe"``
in quoted strings, e.g. ``MatlabOctavePath="C:\Program Files\MATLAB\R2023b\bin\matlab.exe"``
.. option:: NumberOfThreadsPerJob = INTEGER
For Windows nodes, sets the number of threads assigned to each
remote MATLAB/Octave run. The default value is 1.
This option controls the distribution of jobs (e.g. MCMC chains) across additional MATLAB instances that are run in parallel.
Needs to be an exact divisor of the number of cores.
The formula :opt:`CPUnbr <CPUnbr = INTEGER | [INTEGER:INTEGER]>` divided by :opt:`NumberOfThreadsPerJob <NumberOfThreadsPerJob = INTEGER>`
calculates the number of MATLAB/Octave instances that will be launched in parallel,
where each instance will then execute a certain number of jobs sequentially.
For example, if you run a MCMC estimation with 24 chains on a 12 core machine, setting ``CPUnbr = 12`` and ``NumberOfThreadsPerJob = 4``
will launch 3 MATLAB instances in parallel, each of which will compute 8 chains sequentially.
Note that this option does not dictate the number of maximum threads utilized by each MATLAB/Octave instance,
see related option :opt:`SingleCompThread <SingleCompThread = BOOLEAN>` for this.
Particularly for very large models, setting this option to 2 might distribute the workload in a
more efficient manner, depending on your hardware and task specifics.
Its advisable to experiment with different values to achieve optimal performance.
The default value is ``1``.
.. option:: SingleCompThread = BOOLEAN
Whether or not to disable MATLABs native multithreading. The
default value is ``false``. Option meaningless under Octave.
This option allows you to enable or disable MATLABs native multithreading capability. When set to ``true``,
the additional MATLAB instances are initiated in single thread mode utilizing the ``-singleCompThread`` startup option,
thereby disabling MATLABs native multithreading. When set to ``false``, MATLABs native multithreading
is enabled, e.g. the actual number of threads utilized by each MATLAB instance is usually determined by the number of CPU cores
(you can check this by running ``maxNumCompThreads`` in MATLABs command window).
Note: While MATLAB aims to accelerate calculations by distributing them across your computers threads,
certain tasks, like MCMC estimations, may exhibit slowdowns with MATLABs multitasking especially when Dynares parallel computing is turned on
as we do not use MATLABs parallel toolbox.
So in many cases it is advisable to set this setting to ``true``.
If you want to have more control, you can manually add the MATLAB command `maxNumCompThreads(N)` at the beginning of `fParallel.m`.
The default value is ``false``. This option is ineffective under Octave.
.. option:: OperatingSystem = OPERATING_SYSTEM
The operating system associated with a node. Only necessary

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,8 @@ Dates
=====
.. highlight:: matlab
.. _dates in a mod file:
Dates in a mod file
-------------------
@ -2598,8 +2600,10 @@ The dseries class
.. dseriesmethod:: C = remove (A, B)
remove_ (A, B)
|br| Alias for the ``pop`` method with two arguments. Removes
variable ``B`` from ``dseries`` object ``A``.
|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``.
*Example*

View File

@ -1,6 +1,6 @@
# -*- 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

View File

@ -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,

View File

@ -1,2 +0,0 @@
version = u'@PACKAGE_VERSION@'
release = u'@PACKAGE_VERSION@'

View File

@ -1,29 +0,0 @@
if ENABLE_DOC
pdf-local: parallel.pdf
endif
SRC = AvenueParadigm.pdf iVaNo_gain.pdf iVaNo_time_comp.pdf marco.bib \
netbook_complete_comp.pdf netbook_complete_openclose.pdf \
netbook_partial_comp.pdf netbook_partial_openclose.pdf parallel.tex \
quest_complete_comp.pdf quest_complete_openclose.pdf quest_partial_comp.pdf \
quest_partial_openclose.pdf RWMH_quest1_PriorsAndPosteriors1Comp.pdf \
RWMH_quest1_PriorsAndPosteriors2Comp.pdf \
RWMH_quest1_PriorsAndPosteriors3Comp.pdf \
RWMH_quest1_PriorsAndPosteriors4Comp.pdf \
RWMH_quest1_PriorsAndPosteriors5Comp.pdf \
RWMH_quest1_PriorsAndPosteriors6Comp.pdf \
RWMH_quest1_PriorsAndPosteriors7Comp.pdf waitbars1.pdf waitbars2.pdf \
waitbarsP.pdf
EXTRA_DIST = $(SRC)
parallel.pdf: $(SRC)
$(PDFLATEX) parallel
$(BIBTEX) parallel
$(PDFLATEX) parallel
$(PDFLATEX) parallel
$(PDFLATEX) parallel
clean-local:
rm -f *.log *.aux *.toc *.blg *.bbl *.out
rm -f parallel.pdf

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@
*/
/*
* Copyright © 2021 Dynare Team
* Copyright © 2021-2023 Dynare Team
*
* This file is part of Dynare.
*
@ -147,13 +147,13 @@ end;
varobs yhat;
% Run prior function to get prior slope of the PC based on independent priors
hh=figure('Name','Slope of the Phillips Curve');
hh_fig=figure('Name','Slope of the Phillips Curve');
prior_function(function='Gali_2015_PC_slope');
PC_slope_vec=cell2mat(oo_.prior_function_results(:,1));
optimal_bandwidth = mh_optimal_bandwidth(PC_slope_vec,length(PC_slope_vec),0,'gaussian');
[density(:,1),density(:,2)] = kernel_density_estimate(PC_slope_vec,512,length(PC_slope_vec),optimal_bandwidth,'gaussian');
figure(hh)
figure(hh_fig)
subplot(3,1,1)
plot(density(:,1),density(:,2));
title('Prior')
@ -165,7 +165,7 @@ posterior_function(function='Gali_2015_PC_slope');
PC_slope_vec=cell2mat(oo_.posterior_function_results(:,1));
optimal_bandwidth = mh_optimal_bandwidth(PC_slope_vec,length(PC_slope_vec),0,'gaussian');
[density(:,1),density(:,2)] = kernel_density_estimate(PC_slope_vec,512,length(PC_slope_vec),optimal_bandwidth,'gaussian');
figure(hh)
figure(hh_fig)
subplot(3,1,2)
plot(density(:,1),density(:,2));
title('Updated Prior')
@ -178,7 +178,7 @@ posterior_function(function='Gali_2015_PC_slope');
PC_slope_vec=cell2mat(oo_.posterior_function_results(:,1));
optimal_bandwidth = mh_optimal_bandwidth(PC_slope_vec,length(PC_slope_vec),0,'gaussian');
[density(:,1),density(:,2)] = kernel_density_estimate(PC_slope_vec,512,length(PC_slope_vec),optimal_bandwidth,'gaussian');
figure(hh)
figure(hh_fig)
subplot(3,1,3)
plot(density(:,1),density(:,2));
title('Posterior')

View File

@ -1,12 +1,12 @@
function log_prior_val=Gali_2015_prior_restrictions(M_, oo_, options_, dataset_, dataset_info);
% function prior_val=Gali_2015_prior_restrictions(M_, oo_, options_, dataset_, dataset_info);
function log_prior_val=Gali_2015_prior_restrictions(M_, dr, endo_steady_state, exo_steady_state, exo_det_steady_state, options_, dataset_, dataset_info);
% function prior_val=Gali_2015_prior_restrictions(M_, dr, endo_steady_state, exo_steady_state, exo_det_steady_state, options_, dataset_, dataset_info);
% Example of a _prior_restrictions-file automatically called during
% estimation
% It imposes a prior of the slope of the New Keynesian Phillips Curve of
% 0.03. As the slope is a composite of other parameters with independent
% priors, a separate function is required to do this.
% Copyright © 2021 Dynare Team
% Copyright © 2021-2023 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -26,13 +26,17 @@
* The model is written in the beginning of period stock notation. To make the model
* conform with Dynares end of period stock notation, we use the
* predetermined_variables-command.
*
*
* The model has been implemented in detrended form, i.e. the \mu_{i,t} are actually
* the the growth rates of the original \mu_{i,t}^{orig} in the paper, i.e.
* log(\mu_{i,t})=log(\mu_{i,t}^{orig}/\mu_{i,t-1}^{orig})
*
* Please note that the following copyright notice only applies to this Dynare
* implementation of the model.
*/
/*
* Copyright © 2013-2020 Dynare Team
* Copyright © 2013-2023 Dynare Team
*
* This file is part of Dynare.
*
@ -151,12 +155,12 @@ gammmaPI =1.29;
PIbar = 1.01;
rhod = 0.12;
rhophi = 0.93;
sigma_A = -3.97;
sigma_d = -1.51;
sigma_A = exp(-3.97);
sigma_d = exp(-1.51);
sigma_phi =-2.36;
sigma_mu =-5.43;
sigma_m =-5.85;
sigma_phi =exp(-2.36);
sigma_mu =exp(-5.43);
sigma_m =exp(-5.85);
Lambdamu=3.4e-3;
LambdaA = 2.8e-3;
@ -214,7 +218,7 @@ mc=(1/(1-alppha))^(1-alppha)*(1/alppha)^alppha*w^(1-alppha)*r^alppha;
1=thetap*(PI(-1)^chi/PI)^(1-epsilon)+(1-thetap)*PIstar^(1-epsilon);
[name='Taylor Rule']
R/Rbar=(R(-1)/Rbar)^gammmaR*((PI/PIbar)^gammmaPI*((yd/yd(-1)*mu_z)/exp(LambdaYd))^gammmay)^(1-gammmaR)*exp(epsm);
R/Rbar=(R(-1)/Rbar)^gammmaR*((PI/PIbar)^gammmaPI*((yd/yd(-1)*mu_z)/exp(LambdaYd))^gammmay)^(1-gammmaR)*exp(sigma_m*epsm);
[name='Resource constraint']
yd=c+x+mu_z^(-1)*mu_I^(-1)*(gammma1*(u-1)+gammma2/2*(u-1)^2)*k;
@ -235,24 +239,24 @@ PIstarw=wstar/w;
//exogenous processes
[name='Preference Shock']
log(d)=rhod*log(d(-1))+epsd;
log(d)=rhod*log(d(-1))+sigma_d*epsd;
[name='Labor disutility Shock']
log(phi)=rhophi*log(phi(-1))+epsphi;
log(phi)=rhophi*log(phi(-1))+sigma_phi*epsphi;
[name='Investment specific technology']
log(mu_I)=Lambdamu+epsmu_I;
log(mu_I)=Lambdamu+sigma_mu*epsmu_I;
[name='Neutral technology']
log(mu_A)=LambdaA+epsA;
log(mu_A)=LambdaA+sigma_A*epsA;
[name='Defininition composite technology']
mu_z=mu_A^(1/(1-alppha))*mu_I^(alppha/(1-alppha));
end;
shocks;
var epsd; stderr exp(sigma_d);
var epsphi; stderr exp(sigma_phi);
var epsmu_I; stderr exp(sigma_mu);
var epsA; stderr exp(sigma_A);
var epsm; stderr exp(sigma_m);
var epsd; stderr 1;
var epsphi; stderr 1;
var epsmu_I; stderr 1;
var epsA; stderr 1;
var epsm; stderr 1;
end;
steady;

View File

@ -1,6 +0,0 @@
Assuming that the dynare++ binary is in your PATH, you can run the example by using the following command
in a Command Prompt Window:
... > dynare++ example1.mod
Please, read the manual (doc\dynare++\dynare++-tutorial.pdf) for a description of the generated output.

View File

@ -1,45 +0,0 @@
/*
* This Dynare++ mod-file implements the RBC model with time-to-build
* described in Kamenik (2011): "DSGE Models with Dynare++. A Tutorial."
* Note that Dynare++ uses the same stock-at-the-end-of-period timing convention
* as the regular Dynare
*/
var Y, C, K, A, H, B;
varexo EPS, NU;
parameters beta, rho, alpha, delta, theta, psi, tau;
alpha = 0.36;
rho = 0.95;
tau = 0.025;
beta = 1/(1.03^0.25);
delta = 0.025;
psi = 0;
theta = 2.95;
model;
C*theta*H^(1+psi) = (1-alpha)*Y;
beta*exp(B)*C/exp(B(1))/C(1)*
(exp(B(1))*alpha*Y(1)/K(1)+1-delta) = 1;
Y = exp(A)*K^alpha*H^(1-alpha);
K = exp(B(-1))*(Y(-1)-C(-1)) + (1-delta)*K(-1);
A = rho*A(-1) + tau*B(-1) + EPS;
B = tau*A(-1) + rho*B(-1) + NU;
end;
initval;
A = 0;
B = 0;
H = ((1-alpha)/(theta*(1-(delta*alpha)/(1/beta-1+delta))))^(1/(1+psi));
Y = (alpha/(1/beta-1+delta))^(alpha/(1-alpha))*H;
K = alpha/(1/beta-1+delta)*Y;
C = Y - delta*K;
end;
vcov = [0.0002 0.00005;
0.00005 0.0001
];
order = 7;

View File

@ -1,22 +1,22 @@
/*
* This file replicates the estimation of the cash in advance model (termed M1
* in the paper) described in Frank Schorfheide (2000): "Loss function-based
* This file replicates the estimation of the cash in advance model (termed M1
* in the paper) described in Frank Schorfheide (2000): "Loss function-based
* evaluation of DSGE models", Journal of Applied Econometrics, 15(6), 645-670.
*
* The data are in file "fsdat_simul.m", and have been artificially generated.
* They are therefore different from the original dataset used by Schorfheide.
* The data are taken from the replication package at
* http://dx.doi.org/10.15456/jae.2022314.0708799949
*
* The prior distribution follows the one originally specified in Schorfheide's
* paper, except for parameter rho. In the paper, the elicited beta prior for rho
* paper. Note that the elicited beta prior for rho in the paper
* implies an asymptote and corresponding prior mode at 0. It is generally
* recommended to avoid this extreme type of prior. Some optimizers, for instance
* mode_compute=12 (Mathworks' particleswarm algorithm) may find a posterior mode
* with rho equal to zero. We lowered the value of the prior standard deviation
* (changing .223 to .100) to remove the asymptote.
* recommended to avoid this extreme type of prior.
*
* Because the data are already logged and we use the loglinear option to conduct
* a full log-linearization, we need to use the logdata option.
*
* The equations are taken from J. Nason and T. Cogley (1994): "Testing the
* implications of long-run neutrality for monetary business cycle models",
* Journal of Applied Econometrics, 9, S37-S70.
* Journal of Applied Econometrics, 9, S37-S70, NC in the following.
* Note that there is an initial minus sign missing in equation (A1), p. S63.
*
* This implementation was originally written by Michel Juillard. Please note that the
@ -25,7 +25,7 @@
*/
/*
* Copyright © 2004-2017 Dynare Team
* Copyright © 2004-2023 Dynare Team
*
* This file is part of Dynare.
*
@ -43,33 +43,71 @@
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
*/
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
var m ${m}$ (long_name='money growth')
P ${P}$ (long_name='Price level')
c ${c}$ (long_name='consumption')
e ${e}$ (long_name='capital stock')
W ${W}$ (long_name='Wage rate')
R ${R}$ (long_name='interest rate')
k ${k}$ (long_name='capital stock')
d ${d}$ (long_name='dividends')
n ${n}$ (long_name='labor')
l ${l}$ (long_name='loans')
gy_obs ${\Delta \ln GDP}$ (long_name='detrended capital stock')
gp_obs ${\Delta \ln P}$ (long_name='detrended capital stock')
y ${y}$ (long_name='detrended output')
dA ${\Delta A}$ (long_name='TFP growth')
;
varexo e_a ${\epsilon_A}$ (long_name='TFP shock')
e_m ${\epsilon_M}$ (long_name='Money growth shock')
;
parameters alp bet gam mst rho psi del;
parameters alp ${\alpha}$ (long_name='capital share')
bet ${\beta}$ (long_name='discount factor')
gam ${\gamma}$ (long_name='long-run TFP growth')
logmst ${\log(m^*)}$ (long_name='long-run money growth')
rho ${\rho}$ (long_name='autocorrelation money growth')
phi ${\phi}$ (long_name='labor weight in consumption')
del ${\delta}$ (long_name='depreciation rate')
;
% roughly picked values to allow simulating the model before estimation
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
logmst = log(1.011);
rho = 0.7;
psi = 0.787;
phi = 0.787;
del = 0.02;
model;
[name='NC before eq. (1), TFP growth equation']
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
[name='NC eq. (2), money growth rate']
log(m) = (1-rho)*logmst + rho*log(m(-1))+e_m;
[name='NC eq. (A1), Euler equation']
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
[name='NC below eq. (A1), firm borrowing constraint']
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
[name='NC eq. (A2), intratemporal labour market condition']
-(phi/(1-phi))*(c*P/(1-n))+l/n = 0;
[name='NC below eq. (A2), credit market clearing']
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
[name='NC eq. (A3), credit market optimality']
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
[name='NC eq. (18), aggregate resource constraint']
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
[name='NC eq. (19), money market condition']
P*c = m;
[name='NC eq. (20), credit market equilibrium condition']
m-1+d = l;
[name='Definition TFP shock']
e = exp(e_a);
[name='Implied by NC eq. (18), production function']
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
[name='Observation equation GDP growth']
gy_obs = dA*y/y(-1);
[name='Observation equation price level']
gp_obs = (P/P(-1))*m(-1)/dA;
end;
@ -81,40 +119,41 @@ end;
steady_state_model;
dA = exp(gam);
gst = 1/dA;
m = mst;
m = exp(logmst);
khst = ( (1-gst*bet*(1-del)) / (alp*gst^alp*bet) )^(1/(alp-1));
xist = ( ((khst*gst)^alp - (1-gst*(1-del))*khst)/mst )^(-1);
nust = psi*mst^2/( (1-alp)*(1-psi)*bet*gst^alp*khst^alp );
xist = ( ((khst*gst)^alp - (1-gst*(1-del))*khst)/m )^(-1);
nust = phi*m^2/( (1-alp)*(1-phi)*bet*gst^alp*khst^alp );
n = xist/(nust+xist);
P = xist + nust;
k = khst*n;
l = psi*mst*n/( (1-psi)*(1-n) );
c = mst/P;
d = l - mst + 1;
l = phi*m*n/( (1-phi)*(1-n) );
c = m/P;
d = l - m + 1;
y = k^alp*n^(1-alp)*gst^alp;
R = mst/bet;
R = m/bet;
W = l/n;
ist = y-c;
q = 1 - d;
e = 1;
gp_obs = m/dA;
gy_obs = dA;
end;
steady;
steady;
check;
% Table 1 of Schorfheide (2000)
estimated_params;
alp, beta_pdf, 0.356, 0.02;
bet, beta_pdf, 0.993, 0.002;
gam, normal_pdf, 0.0085, 0.003;
mst, normal_pdf, 1.0002, 0.007;
rho, beta_pdf, 0.129, 0.100;
psi, beta_pdf, 0.65, 0.05;
logmst, normal_pdf, 0.0002, 0.007;
rho, beta_pdf, 0.129, 0.223;
phi, beta_pdf, 0.65, 0.05;
del, beta_pdf, 0.01, 0.005;
stderr e_a, inv_gamma_pdf, 0.035449, inf;
stderr e_m, inv_gamma_pdf, 0.008862, inf;
@ -122,14 +161,8 @@ end;
varobs gp_obs gy_obs;
estimation(order=1, datafile=fsdat_simul, nobs=192, loglinear, mh_replic=2000, mh_nblocks=2, mh_jscale=0.8, mode_check);
estimation(order=1, datafile=fs2000_data, loglinear,logdata, mode_compute=4, mh_replic=20000, nodiagnostic, mh_nblocks=2, mh_jscale=0.8, mode_check);
/*
* The following lines were used to generate the data file. If you want to
* generate another random data file, comment the "estimation" line and uncomment
* the following lines.
*/
//stoch_simul(periods=200, order=1);
//datatomfile('fsdat_simul', {'gy_obs', 'gp_obs'});
%uncomment the following lines to generate LaTeX-code of the model equations
%write_latex_original_model(write_equation_tags);
%collect_latex_files;

215
examples/fs2000_data.m Normal file
View File

@ -0,0 +1,215 @@
%This file is a direct Matlab implementation of the loaddata.g and data.prn files
%of Schorfheide, Frank (2000): Loss function-based evaluation of DSGE models
%(replication data). Version: 1. Journal of Applied Econometrics. Dataset.
%http://dx.doi.org/10.15456/jae.2022314.0708799949
% Copyright: 2000-2022 Frank Schorfheide
% Copyright: 2023 Dynare Team
% License: CC BY 4.0
% (https://creativecommons.org/licenses/by/4.0/legalcode)
% Time series, extracted 05/04/00
% columms are quarterly data from 1949:IV to 1997:IV
% 1: GDPD = GROSS DOMESTIC PRODUCT:IMPLICIT PRICE DEFLATOR (INDEX,92=100)(T7.1)
% 2: GDPQ = GROSS DOMESTIC PRODUCT
% 3: GPOP = POPULATION, NIPA basis (THOUS.,NSA)
data_q=[18.02 1474.5 150.2
17.94 1538.2 150.9
18.01 1584.5 151.4
18.42 1644.1 152
18.73 1678.6 152.7
19.46 1693.1 153.3
19.55 1724 153.9
19.56 1758.2 154.7
19.79 1760.6 155.4
19.77 1779.2 156
19.82 1778.8 156.6
20.03 1790.9 157.3
20.12 1846 158
20.1 1882.6 158.6
20.14 1897.3 159.2
20.22 1887.4 160
20.27 1858.2 160.7
20.34 1849.9 161.4
20.39 1848.5 162
20.42 1868.9 162.8
20.47 1905.6 163.6
20.56 1959.6 164.3
20.62 1994.4 164.9
20.78 2020.1 165.7
21 2030.5 166.5
21.2 2023.6 167.2
21.33 2037.7 167.9
21.62 2033.4 168.7
21.71 2066.2 169.5
22.01 2077.5 170.2
22.15 2071.9 170.9
22.27 2094 171.7
22.29 2070.8 172.5
22.56 2012.6 173.1
22.64 2024.7 173.8
22.77 2072.3 174.5
22.88 2120.6 175.3
22.92 2165 176.045
22.91 2223.3 176.727
22.94 2221.4 177.481
23.03 2230.95 178.268
23.13 2279.22 179.694
23.22 2265.48 180.335
23.32 2268.29 181.094
23.4 2238.57 181.915
23.45 2251.68 182.634
23.51 2292.02 183.337
23.56 2332.61 184.103
23.63 2381.01 184.894
23.75 2422.59 185.553
23.81 2448.01 186.203
23.87 2471.86 186.926
23.94 2476.67 187.68
24 2508.7 188.299
24.07 2538.05 188.906
24.12 2586.26 189.631
24.29 2604.62 190.362
24.35 2666.69 190.954
24.41 2697.54 191.56
24.52 2729.63 192.256
24.64 2739.75 192.938
24.77 2808.88 193.467
24.88 2846.34 193.994
25.01 2898.79 194.647
25.17 2970.48 195.279
25.32 3042.35 195.763
25.53 3055.53 196.277
25.79 3076.51 196.877
26.02 3102.36 197.481
26.14 3127.15 197.967
26.31 3129.53 198.455
26.6 3154.19 199.012
26.9 3177.98 199.572
27.21 3236.18 199.995
27.49 3292.07 200.452
27.75 3316.11 200.997
28.12 3331.22 201.538
28.39 3381.86 201.955
28.73 3390.23 202.419
29.14 3409.65 202.986
29.51 3392.6 203.584
29.94 3386.49 204.086
30.36 3391.61 204.721
30.61 3422.95 205.419
31.02 3389.36 206.13
31.5 3481.4 206.763
31.93 3500.95 207.362
32.27 3523.8 208
32.54 3533.79 208.642
33.02 3604.73 209.142
33.2 3687.9 209.637
33.49 3726.18 210.181
33.95 3790.44 210.737
34.36 3892.22 211.192
34.94 3919.01 211.663
35.61 3907.08 212.191
36.29 3947.11 212.708
37.01 3908.15 213.144
37.79 3922.57 213.602
38.96 3879.98 214.147
40.13 3854.13 214.7
41.05 3800.93 215.135
41.66 3835.21 215.652
42.41 3907.02 216.289
43.19 3952.48 216.848
43.69 4044.59 217.314
44.15 4072.19 217.776
44.77 4088.49 218.338
45.57 4126.39 218.917
46.32 4176.28 219.427
47.07 4260.08 219.956
47.66 4329.46 220.573
48.63 4328.33 221.201
49.42 4345.51 221.719
50.41 4510.73 222.281
51.27 4552.14 222.933
52.35 4603.65 223.583
53.51 4605.65 224.152
54.65 4615.64 224.737
55.82 4644.93 225.418
56.92 4656.23 226.117
58.18 4678.96 226.754
59.55 4566.62 227.389
61.01 4562.25 228.07
62.59 4651.86 228.689
64.15 4739.16 229.155
65.37 4696.82 229.674
66.65 4753.02 230.301
67.87 4693.76 230.903
68.86 4615.89 231.395
69.72 4634.88 231.906
70.66 4612.08 232.498
71.44 4618.26 233.074
72.08 4662.97 233.546
72.83 4763.57 234.028
73.48 4849 234.603
74.19 4939.23 235.153
75.02 5053.56 235.605
75.58 5132.87 236.082
76.25 5170.34 236.657
76.81 5203.68 237.232
77.63 5257.26 237.673
78.25 5283.73 238.176
78.76 5359.6 238.789
79.45 5393.57 239.387
79.81 5460.83 239.861
80.22 5466.95 240.368
80.84 5496.29 240.962
81.45 5526.77 241.539
82.09 5561.8 242.009
82.68 5618 242.52
83.33 5667.39 243.12
84.09 5750.57 243.721
84.67 5785.29 244.208
85.56 5844.05 244.716
86.66 5878.7 245.354
87.44 5952.83 245.966
88.45 6010.96 246.46
89.39 6055.61 247.017
90.13 6087.96 247.698
90.88 6093.51 248.374
92 6152.59 248.928
93.18 6171.57 249.564
94.14 6142.1 250.299
95.11 6078.96 251.031
96.27 6047.49 251.65
97 6074.66 252.295
97.7 6090.14 253.033
98.31 6105.25 253.743
99.13 6175.69 254.338
99.79 6214.22 255.032
100.17 6260.74 255.815
100.88 6327.12 256.543
101.84 6327.93 257.151
102.35 6359.9 257.785
102.83 6393.5 258.516
103.51 6476.86 259.191
104.13 6524.5 259.738
104.71 6600.31 260.351
105.39 6629.47 261.04
106.09 6688.61 261.692
106.75 6717.46 262.236
107.24 6724.2 262.847
107.75 6779.53 263.527
108.29 6825.8 264.169
108.91 6882 264.681
109.24 6983.91 265.258
109.74 7020 265.887
110.23 7093.12 266.491
111 7166.68 266.987
111.43 7236.5 267.545
111.76 7311.24 268.171
112.08 7364.63 268.815];
%Compute growth rates: from 1950:I to 1997:IV
gy_obs=1000*data_q(:,2)./data_q(:,3); %real GDP per capita
gy_obs=diff(log(gy_obs));
gp_obs = diff(log(data_q(:,1))); %GDP deflator inflation

101
examples/pacmodel.mod Normal file
View File

@ -0,0 +1,101 @@
// --+ 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)

View File

@ -1,6 +1,6 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Dynare
Upstream-Contact: Dynare Team, whose members in 2023 are:
Upstream-Contact: Dynare Team, whose members in 2024 are:
- Stéphane Adjemian <stephane.adjemian@univ-lemans.fr>
- Michel Juillard <michel.juillard@mjui.fr>
- Frédéric Karamé <frederic.karame@univ-lemans.fr>
@ -23,7 +23,7 @@ Upstream-Contact: Dynare Team, whose members in 2023 are:
Source: https://www.dynare.org
Files: *
Copyright: 1996-2023 Dynare Team
Copyright: 1996-2024 Dynare Team
License: GPL-3+
Files: matlab/+occbin/IVF_core.m
@ -86,13 +86,13 @@ License: public-domain-aim
Journal of Economic Dynamics and Control, 2010, vol. 34, issue 3,
pages 472-489
Files: matlab/optimization/bfgsi1.m matlab/csolve.m matlab/optimization/csminit1.m matlab/optimization/numgrad2.m
Files: matlab/optimization/bfgsi1.m matlab/optimization/csolve.m matlab/optimization/csminit1.m matlab/optimization/numgrad2.m
matlab/optimization/numgrad3.m matlab/optimization/numgrad3_.m matlab/optimization/numgrad5.m
matlab/optimization/numgrad5_.m matlab/optimization/csminwel1.m matlab/bvar_density.m
matlab/bvar_toolbox.m matlab/partial_information/PI_gensys.m matlab/partial_information/qzswitch.m
matlab/optimization/numgrad5_.m matlab/optimization/csminwel1.m matlab/+bvar/density.m
matlab/+bvar/toolbox.m matlab/partial_information/PI_gensys.m matlab/partial_information/qzswitch.m
matlab/partial_information/qzdiv.m
Copyright: 1993-2009 Christopher Sims
2006-2017 Dynare Team
2006-2023 Dynare Team
License: GPL-3+
Files: matlab/optimization/cmaes.m
@ -113,7 +113,7 @@ Copyright: 1995 E.G.Tsionas
2015-2017 Dynare Team
License: GPL-3+
Files: matlab/endogenous_prior.m
Files: matlab/estimation/endogenous_prior.m
Copyright: 2011 Lawrence J. Christiano, Mathias Trabandt and Karl Walentin
2013-2017 Dynare Team
License: GPL-3+
@ -123,17 +123,22 @@ Copyright: 2010-2015 Alexander Meyer-Gohde
2015-2017 Dynare Team
License: GPL-3+
Files: matlab/collapse_figures_in_tabgroup.m
Copyright: 2023 Eduard Benet Cerda
2024 Dynare Team
License: GPL-3+
Files: matlab/convergence_diagnostics/raftery_lewis.m
Copyright: 2016 Benjamin Born and Johannes Pfeifer
2016-2017 Dynare Team
License: GPL-3+
Files: matlab/commutation.m matlab/duplication.m
Files: matlab/+pruned_SS/commutation.m matlab/+pruned_SS/duplication.m
Copyright: 1997 Tom Minka <minka@microsoft.com>
2019-2020 Dynare Team
License: GPL-3+
Files: matlab/allVL1.m
Files: matlab/+pruned_SS/allVL1.m
Copyright: 2007-2010 Bruno Luong <brunoluong@yahoo.com>
2020 Dynare Team
License: GPL-3+
@ -141,7 +146,7 @@ Comment: The original author gave authorization to change
the license from BSD-2-clause to GPL-3+ and redistribute
it under GPL-3+ with Dynare.
Files: matlab/uperm.m
Files: matlab/+pruned_SS/uperm.m
Copyright: 2014 Bruno Luong <brunoluong@yahoo.com>
2020 Dynare Team
License: GPL-3+
@ -149,9 +154,9 @@ Comment: The original author gave authorization to change
the license from BSD-2-clause to GPL-3+ and redistribute
it under GPL-3+ with Dynare.
Files: matlab/prodmom.m matlab/bivmom.m
Files: matlab/+pruned_SS/prodmom.m matlab/+pruned_SS/bivmom.m
Copyright: 2008-2015 Raymond Kan <kan@chass.utoronto.ca>
2019-2020 Dynare Team
2019-2023 Dynare Team
License: GPL-3+
Comment: The author gave authorization to redistribute
these functions under GPL-3+ with Dynare and would
@ -161,57 +166,37 @@ Comment: The author gave authorization to redistribute
Journal of Multivariate Analysis, 2008, vol. 99, issue 3,
pages 542-554.
Files: matlab/gsa/Morris_Measure_Groups.m
matlab/gsa/Sampling_Function_2.m
Files: matlab/+gsa/Morris_Measure_Groups.m
matlab/+gsa/Sampling_Function_2.m
Copyright: 2005 European Commission
2012-2017 Dynare Team
2012-2013 Dynare Team
License: GPL-3+
Comment: Written by Jessica Cariboni and Francesca Campolongo
Joint Research Centre, The European Commission,
Files: matlab/gsa/cumplot.m
matlab/gsa/filt_mc_.m
matlab/gsa/gsa_plotmatrix.m
matlab/gsa/gsa_skewness.m
matlab/gsa/gsa_speed.m
matlab/gsa/log_trans_.m
matlab/gsa/map_calibration.m
matlab/gsa/map_ident_.m
matlab/gsa/mcf_analysis.m
matlab/gsa/myboxplot.m
matlab/gsa/myprctilecol.m
matlab/gsa/prior_draw_gsa.m
matlab/gsa/read_data.m
matlab/gsa/redform_map.m
matlab/gsa/redform_screen.m
matlab/gsa/scatter_mcf.m
matlab/gsa/smirnov.m
matlab/gsa/stab_map_.m
matlab/gsa/stab_map_1.m
matlab/gsa/stab_map_2.m
matlab/gsa/stand_.m
matlab/gsa/tcrit.m
matlab/gsa/teff.m
matlab/gsa/trank.m
Files: matlab/+gsa/cumplot.m
matlab/+gsa/monte_carlo_filtering.m
matlab/+gsa/skewness.m
matlab/+gsa/log_transform.m
matlab/+gsa/map_calibration.m
matlab/+gsa/map_identification.m
matlab/+gsa/monte_carlo_filtering_analysis.m
matlab/+gsa/boxplot.m
matlab/+gsa/prior_draw.m
matlab/+gsa/reduced_form_mapping.m
matlab/+gsa/reduced_form_screening.m
matlab/+gsa/scatter_mcf.m
matlab/+gsa/smirnov_test.m
matlab/+gsa/stability_mapping.m
matlab/+gsa/stability_mapping_univariate.m
matlab/+gsa/stability_mapping_bivariate.m
matlab/+gsa/standardize_columns.m
matlab/+gsa/tcrit.m
matlab/+gsa/teff.m
Copyright: 2011-2018 European Commission
2011-2018 Dynare Team
2011-2023 Dynare Team
License: GPL-3+
Files: matlab/gsa/pick.m
Copyright: none
License: public-domain-jrc
This software has been developed at the Joint Research Centre of European Commission
by officers in the course of their official duties. This software is not subject to copyright
protection and is in the public domain. It is an experimental system. The Joint Research Centre
of European Commission assumes no responsibility whatsoever for its use by other parties
and makes no guarantees, expressed or implied, about its quality, reliability, or any other
characteristic. We would appreciate acknowledgement if the software is used.
Comment: This file is part of GLUEWIN.
The program has been developed by M. Ratto, European Commission, Joint Research Centre,
Institute for the Protection and Security of The Citizen, Technological and Economic Risk Management,
Applied Statistics, as a deliverable of the IMPACT project
(EC Fifth Framework Programme, SCA Project, IST-1999-11313, DG-INFSO).
Files: matlab/optimization/simpsa.m matlab/optimization/simpsaget.m matlab/optimization/simpsaset.m
Copyright: 2005 Henning Schmidt, FCC, henning@fcc.chalmers.se
2006 Brecht Donckels, BIOMATH, brecht.donckels@ugent.be
@ -262,9 +247,14 @@ License: BSD-2-clause
Files: matlab/utilities/graphics/colorspace.m
Copyright: 2005-2010 Pascal Getreuer
2017 Dynare Team
2017-2023 Dynare Team
License: BSD-2-clause
Files: examples/fs2000_data.m
Copyright: 2000-2022 Frank Schorfheide
2023 Dynare Team
License: CC-BY-SA-4.0
Files: doc/*.rst doc/*.tex doc/*.svg doc/*.pdf doc/*.bib
Copyright: 1996-2022 Dynare Team
License: GFDL-NIV-1.3+
@ -282,20 +272,6 @@ Files: doc/sylvester.tex doc/tl.tex
Copyright: 2004-2011 Ondra Kamenik
License: GPL-3+
Files: m4/ax_compare_version.m4
Copyright: 2008 Tim Toolan <toolan@ele.uri.edu>
License: FSFAP
Files: m4/ax_latex_class.m4 m4/ax_latex_test.m4
Copyright: 2008 Boretti Mathieu <boretti@eig.unige.ch>
2009 Dynare Team
License: LGPL-2.1+
Files: m4/ax_matlab_arch.m4 m4/ax_matlab.m4 m4/ax_mexext.m4
Copyright: 2002-2003 Ralph Schleicher
2009-2021 Dynare Team
License: GPL-2+ with Autoconf exception
Files: scripts/dynare.el
Copyright: 2010 Yannick Kalantzis
2019-2023 Dynare Team
@ -313,22 +289,6 @@ Copyright: 2004-2009 John Burkardt
2023 Dynare Team
License: LGPL-3+
Files: macOS/brewfiles/*
Copyright: 2009-2019 Homebrew contributors
2019-2021 Dynare Team
License: BSD-2-clause
Files: preprocessor/m4/ax_boost_base.m4
Copyright: 2008-2009 Thomas Porschberg <thomas@randspringer.de>
2009 Peter Adolphs
License: FSFAP
Files: preprocessor/m4/ax_latex_class.m4
preprocessor/m4/ax_latex_test.m4
Copyright: 2008 Boretti Mathieu <boretti@eig.unige.ch>
2009 Dynare Team
License: LGPL-2.1+
Files: preprocessor/doc/macroprocessor/*
Copyright: 2008-2021 Dynare Team
License: CC-BY-SA-4.0
@ -337,28 +297,6 @@ Files: preprocessor/doc/preprocessor/*
Copyright: 2007-2019 Dynare Team
License: CC-BY-SA-4.0
Files: contrib/jsonlab/*
Copyright: 2011-2020 Qianqian Fang <q.fang at neu.edu>
2016 Bastian Bechtold
License: GPL-3+ or BSD-3-clause
Files: contrib/jsonlab/base64decode.m
contrib/jsonlab/base64encode.m
contrib/jsonlab/gzipdecode.m
contrib/jsonlab/gzipencode.m
contrib/jsonlab/zlibdecode.m
contrib/jsonlab/zlibencode.m
Copyright: 2012 Kota Yamaguchi
2011-2020 Qianqian Fang <q.fang at neu.edu>
License: GPL-3+ or BSD-2-clause
Files: contrib/jsonlab/loadjson.m
Copyright: 2011-2020 Qianqian Fang
2009 Nedialko Krouchev
2009 François Glineur
2008 Joel Feenstra
License: GPL-3+ or BSD-2-clause or BSD-3-clause
Files: contrib/ms-sbvar/utilities_dw/*
Copyright: 1996-2011 Daniel Waggoner
License: GPL-3+
@ -465,32 +403,6 @@ License: BSD-2-clause
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
License: BSD-3-clause
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
.
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
.
* Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License: GFDL-NIV-1.3+
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@ -499,26 +411,6 @@ License: GFDL-NIV-1.3+
.
A copy of the license can be found at <https://www.gnu.org/licenses/fdl.txt>
License: GPL-2+ with Autoconf exception
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2,
or (at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License along
with this program. If not, see <https://www.gnu.org/licenses/>.
.
As a special exception to the GNU General Public License, if
you distribute this file as part of a program that contains a
configuration script generated by GNU Autoconf, you may include
it under the same distribution terms that you use for the rest
of that program.
License: GPL-3+
Dynare is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -533,47 +425,6 @@ License: GPL-3+
You should have received a copy of the GNU General Public License
along with Dynare. If not, see <https://www.gnu.org/licenses/>.
License: GPL-3+ with Autoconf exception
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
.
You should have received a copy of the GNU General Public License along
with this program. If not, see <https://www.gnu.org/licenses/>.
.
As a special exception, the respective Autoconf Macro's copyright owner
gives unlimited permission to copy, distribute and modify the configure
scripts that are the output of Autoconf when processing the Macro. You
need not follow the terms of the GNU General Public License when using
or distributing such scripts, even though portions of the text of the
Macro appear in them. The GNU General Public License (GPL) does govern
all other use of the material that constitutes the Autoconf Macro.
.
This special exception to the GPL applies to versions of the Autoconf
Macro released by the Autoconf Archive. When you make and distribute a
modified version of the Autoconf Macro, you may extend this special
exception to the GPL to apply to your modified version as well.
License: LGPL-2.1+
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public License
along with this library. If not, see <https://www.gnu.org/licenses/>.
License: LGPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@ -1014,9 +865,3 @@ License: CC-BY-SA-4.0
licenses.
.
Creative Commons may be contacted at creativecommons.org.
License: FSFAP
Copying and distribution of this file, with or without modification, are
permitted in any medium without royalty provided the copyright notice
and this notice are preserved. This file is offered as-is, without any
warranty.

View File

@ -1,177 +0,0 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_compare_version.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
#
# DESCRIPTION
#
# This macro compares two version strings. Due to the various number of
# minor-version numbers that can exist, and the fact that string
# comparisons are not compatible with numeric comparisons, this is not
# necessarily trivial to do in a autoconf script. This macro makes doing
# these comparisons easy.
#
# The six basic comparisons are available, as well as checking equality
# limited to a certain number of minor-version levels.
#
# The operator OP determines what type of comparison to do, and can be one
# of:
#
# eq - equal (test A == B)
# ne - not equal (test A != B)
# le - less than or equal (test A <= B)
# ge - greater than or equal (test A >= B)
# lt - less than (test A < B)
# gt - greater than (test A > B)
#
# Additionally, the eq and ne operator can have a number after it to limit
# the test to that number of minor versions.
#
# eq0 - equal up to the length of the shorter version
# ne0 - not equal up to the length of the shorter version
# eqN - equal up to N sub-version levels
# neN - not equal up to N sub-version levels
#
# When the condition is true, shell commands ACTION-IF-TRUE are run,
# otherwise shell commands ACTION-IF-FALSE are run. The environment
# variable 'ax_compare_version' is always set to either 'true' or 'false'
# as well.
#
# Examples:
#
# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
# AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
#
# would both be true.
#
# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
# AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
#
# would both be false.
#
# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
#
# would be true because it is only comparing two minor versions.
#
# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
#
# would be true because it is only comparing the lesser number of minor
# versions of the two values.
#
# Note: The characters that separate the version numbers do not matter. An
# empty string is the same as version 0. OP is evaluated by autoconf, not
# configure, so must be a string, not a variable.
#
# The author would like to acknowledge Guido Draheim whose advice about
# the m4_case and m4_ifvaln functions make this macro only include the
# portions necessary to perform the specific comparison specified by the
# OP argument in the final configure script.
#
# LICENSE
#
# Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 13
dnl #########################################################################
AC_DEFUN([AX_COMPARE_VERSION], [
AC_REQUIRE([AC_PROG_AWK])
# Used to indicate true or false condition
ax_compare_version=false
# Convert the two version strings to be compared into a format that
# allows a simple string comparison. The end result is that a version
# string of the form 1.12.5-r617 will be converted to the form
# 0001001200050617. In other words, each number is zero padded to four
# digits, and non digits are removed.
AS_VAR_PUSHDEF([A],[ax_compare_version_A])
A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/[[^0-9]]//g'`
AS_VAR_PUSHDEF([B],[ax_compare_version_B])
B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/[[^0-9]]//g'`
dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
dnl # then the first line is used to determine if the condition is true.
dnl # The sed right after the echo is to remove any indented white space.
m4_case(m4_tolower($2),
[lt],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
],
[gt],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
],
[le],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
],
[ge],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
],[
dnl Split the operator from the subversion count if present.
m4_bmatch(m4_substr($2,2),
[0],[
# A count of zero means use the length of the shorter version.
# Determine the number of characters in A and B.
ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
# Set A to no more than B's length and B to no more than A's length.
A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
],
[[0-9]+],[
# A count greater than zero means use only that many subversions
A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
],
[.+],[
AC_WARNING(
[invalid OP numeric parameter: $2])
],[])
# Pad zeros at end of numbers to make same length.
ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
B="$B`echo $A | sed 's/./0/g'`"
A="$ax_compare_version_tmp_A"
# Check for equality or inequality as necessary.
m4_case(m4_tolower(m4_substr($2,0,2)),
[eq],[
test "x$A" = "x$B" && ax_compare_version=true
],
[ne],[
test "x$A" != "x$B" && ax_compare_version=true
],[
AC_WARNING([invalid OP parameter: $2])
])
])
AS_VAR_POPDEF([A])dnl
AS_VAR_POPDEF([B])dnl
dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
if test "$ax_compare_version" = "true" ; then
m4_ifvaln([$4],[$4],[:])dnl
m4_ifvaln([$5],[else $5])dnl
fi
]) dnl AX_COMPARE_VERSION

View File

@ -1,66 +0,0 @@
dnl Detect GSL.
dnl We don't use the official M4 macro since it relies on the script gsl-config,
dnl which does not work when cross-compiling.
dnl
dnl Copyright © 2010-2021 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
dnl Dynare is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl Dynare is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Dynare. If not, see <https://www.gnu.org/licenses/>.
AC_DEFUN([AX_GSL],
[
AC_ARG_WITH(gsl, AS_HELP_STRING([--with-gsl=DIR], [prefix to GSL installation]),
gsl_prefix="$withval", gsl_prefix="")
has_gsl=yes
if test -n "$gsl_prefix"; then
GSL_CPPFLAGS="-I$withval/include"
GSL_LDFLAGS="-L$withval/lib"
else
GSL_CPPFLAGS=""
GSL_LDFLAGS=""
fi
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_LDFLAGS="$LDFLAGS"
ac_save_LIBS="$LIBS"
LIBS=""
CPPFLAGS="$CPPFLAGS $GSL_CPPFLAGS"
LDFLAGS="$LDFLAGS $GSL_LDFLAGS"
AC_LANG_PUSH(C)
AC_CHECK_HEADER([gsl/gsl_cdf.h], [], [has_gsl=no])
AC_LANG_POP(C)
AC_CHECK_LIB([m], [cos])
AC_CHECK_LIB([gslcblas], [cblas_dgemm], [LIBS="-lgslcblas $LIBS"], [has_gsl=no])
AC_CHECK_LIB([gsl], [gsl_cdf_ugaussian_P], [LIBS="-lgsl $LIBS"], [has_gsl=no])
if test "$has_gsl" = yes; then
GSL_LIBS="$LIBS"
else
GSL_LIBS=""
fi
CPPFLAGS="$ac_save_CPPFLAGS"
LDFLAGS="$ac_save_LDFLAGS"
LIBS="$ac_save_LIBS"
AC_SUBST(GSL_CPPFLAGS)
AC_SUBST(GSL_LDFLAGS)
AC_SUBST(GSL_LIBS)
])

View File

@ -1,68 +0,0 @@
# ===========================================================================
# http://www.nongnu.org/autoconf-archive/ax_latex_class.html
# ===========================================================================
#
# OBSOLETE MACRO
#
# Deprecated because of licensing issues. The Lesser GPL imposes licensing
# restrictions on the generated configure script unless it is augmented
# with an Autoconf Exception clause.
#
# SYNOPSIS
#
# AX_LATEX_CLASS(CLASSNAME,VARIABLETOSET[,ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macros test is class CLASSNAME exists and work and set
# VARIABLETOSET to yes or no If ACTION-IF-FOUND (and ACTION-IF-NOT-FOUND)
# are set, do the correct action
#
# LICENSE
#
# Copyright © 2008 Boretti Mathieu <boretti@eig.unige.ch>
# Copyright © 2009 Dynare Team
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or (at
# your option) any later version.
#
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library. If not, see <https://www.gnu.org/licenses/>.
AC_DEFUN([AX_LATEX_CLASS],[
AC_CACHE_CHECK([for usability of class $1],[ac_cv_latex_class_]translit($1,[-],[_]),[
AX_LATEX_TEST([\documentclass{$1}
\begin{document}
\end{document}],[ac_cv_latex_class_]translit($1,[-],[_]))
])
$2=$[ac_cv_latex_class_]translit($1,[-],[_]) ; export $2;
AC_SUBST($2)
ifelse($#,2,[],$#,3,[
if test "[$]$2" = "yes" ;
then
$3
fi
],$#,4,[
ifelse($3,[],[
if test "[$]$2" = "no" ;
then
$4
fi
],[
if test "[$]$2" = "yes" ;
then
$3
else
$4
fi
])
])
])

View File

@ -1,56 +0,0 @@
# ===========================================================================
# http://www.nongnu.org/autoconf-archive/ax_latex_test.html
# ===========================================================================
#
# OBSOLETE MACRO
#
# Deprecated because of licensing issues. The Lesser GPL imposes licensing
# restrictions on the generated configure script unless it is augmented
# with an Autoconf Exception clause.
#
# SYNOPSIS
#
# AX_LATEX_TEST(FILEDATA,VARIABLETOSET,[NOCLEAN])
#
# DESCRIPTION
#
# This macros execute the latex application with FILEDATA as input and set
# VARIABLETOSET the yes or no depending of the result if NOCLEAN is set,
# the folder used for the test is not delete after testing.
#
# The macro assumes that the variable PDFLATEX is set.
#
# LICENSE
#
# Copyright © 2008 Boretti Mathieu <boretti@eig.unige.ch>
# Copyright © 2009 Dynare Team
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or (at
# your option) any later version.
#
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library. If not, see <https://www.gnu.org/licenses/>.
AC_DEFUN([AX_LATEX_TEST],[
rm -rf conftest.dir/.acltx
AS_MKDIR_P([conftest.dir/.acltx])
cd conftest.dir/.acltx
m4_ifval([$2],[$2="no"; export $2;])
cat > conftest.tex << ACLEOF
$1
ACLEOF
cat conftest.tex | $PDFLATEX 2>&1 1>output m4_ifval([$2],[&& $2=yes])
cd ..
cd ..
sed 's/^/| /' conftest.dir/.acltx/conftest.tex >&5
echo "$as_me:$LINENO: executing cat conftest.tex | $PDFLATEX" >&5
sed 's/^/| /' conftest.dir/.acltx/output >&5
m4_ifval([$3],,[rm -rf conftest.dir/.acltx])
])

View File

@ -1,69 +0,0 @@
dnl Detect the MATIO Library.
dnl
dnl Copyright © 2012-2023 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
dnl Dynare is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl Dynare is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Dynare. If not, see <https://www.gnu.org/licenses/>.
AC_DEFUN([AX_MATIO],
[
AC_ARG_WITH(matio, AS_HELP_STRING([--with-matio=DIR], [prefix to MATIO installation]),
matio_prefix="$withval", matio_prefix="")
AC_REQUIRE([AC_CANONICAL_HOST])
has_matio=yes
if test -n "$matio_prefix"; then
CPPFLAGS_MATIO="-I$withval/include"
LDFLAGS_MATIO="-L$withval/lib"
else
CPPFLAGS_MATIO=""
LDFLAGS_MATIO=""
fi
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_LDFLAGS="$LDFLAGS"
ac_save_LIBS="$LIBS"
LIBADD_MATIO=""
CPPFLAGS="$CPPFLAGS_MATIO $CPPFLAGS"
LDFLAGS="$LDFLAGS_MATIO $LDFLAGS"
dnl Under Windows and macOS, add hdf5 and its dependencies since we are linking statically
case ${host_os} in
*mingw32*)
dnl Partly inspired by /mingw64/lib/pkgconfig/{hdf5,libcurl}.pc (in particular for the system libraries)
LIBS="-lhdf5 -lcurl -lnghttp2 -lidn2 -lssh2 -lpsl -lunistring -liconv -lbcrypt -ladvapi32 -lcrypt32 -lbcrypt -lgdi32 -lwldap32 -lzstd -lbrotlidec -lbrotlicommon -lssl -lcrypto -lws2_32 -lz -lsz"
;;
*darwin*)
LIBS="-lhdf5 -lz -lsz"
;;
*)
LIBS=""
;;
esac
AC_CHECK_HEADER([matio.h], [], [has_matio=no])
AC_CHECK_LIB([matio], [Mat_Open], [LIBADD_MATIO="-lmatio $LIBS"], [has_matio=no])
CPPFLAGS="$ac_save_CPPFLAGS"
LDFLAGS="$ac_save_LDFLAGS"
LIBS="$ac_save_LIBS"
AC_SUBST(CPPFLAGS_MATIO)
AC_SUBST(LIBADD_MATIO)
AC_SUBST(LDFLAGS_MATIO)
])

View File

@ -1,126 +0,0 @@
dnl ax_matlab.m4 --- check for MATLAB.
dnl
dnl Copyright © 2000-2003 Ralph Schleicher
dnl Copyright © 2009-2021 Dynare Team
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License as
dnl published by the Free Software Foundation; either version 2,
dnl or (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License along
dnl with this program. If not, see <https://www.gnu.org/licenses/>.
dnl
dnl As a special exception to the GNU General Public License, if
dnl you distribute this file as part of a program that contains a
dnl configuration script generated by GNU Autoconf, you may include
dnl it under the same distribution terms that you use for the rest
dnl of that program.
dnl
dnl Code:
# AX_MATLAB
# ---------
# Check for MATLAB.
AC_DEFUN([AX_MATLAB],
[dnl
AC_PREREQ([2.50])
ax_enable_matlab=
AC_ARG_WITH([matlab], AS_HELP_STRING([--with-matlab=ARG], [check for MATLAB [[yes]]]),
[case $withval in
yes | no)
# Explicitly enable or disable MATLAB but determine
# MATLAB prefix automatically.
ax_enable_matlab=$withval
;;
*)
# Enable MATLAB and use ARG as the MATLAB prefix.
# ARG must be an existing directory.
ax_enable_matlab=yes
MATLAB=$(cd "${withval-/}" > /dev/null 2>&1 && pwd)
if test -z "$MATLAB" ; then
AC_MSG_ERROR([invalid value '$withval' for --with-matlab])
fi
;;
esac])
AC_CACHE_CHECK([for MATLAB prefix], [ax_cv_matlab],
[if test "${MATLAB+set}" = set ; then
ax_cv_matlab=$(cd "${MATLAB-/}" > /dev/null 2>&1 && pwd)
else
ax_cv_matlab=
IFS=${IFS= } ; ax_ifs=$IFS ; IFS=:
for ax_dir in ${PATH-/opt/bin:/usr/local/bin:/usr/bin:/bin} ; do
if test -z "$ax_dir" ; then
ax_dir=.
fi
if test -x "$ax_dir/matlab" ; then
ax_dir=$(echo "$ax_dir" | sed 's,/bin$,,')
# Directory sanity check.
ax_cv_matlab=$(cd "${ax_dir-/}" > /dev/null 2>&1 && pwd)
if test -n "$ax_cv_matlab" ; then
break
fi
fi
done
IFS=$ax_ifs
fi
if test -z "$ax_cv_matlab" ; then
ax_cv_matlab="not found"
fi])
if test "$ax_cv_matlab" = "not found" ; then
unset MATLAB
else
# Strip trailing dashes.
MATLAB=$(echo "$ax_cv_matlab" | sed 's,/*$,,')
fi
AC_MSG_CHECKING([whether to enable MATLAB support])
if test "$ax_enable_matlab" != no; then
if test "${MATLAB+set}" = set && test -d "$MATLAB/extern/include" ; then
ax_enable_matlab=yes
elif test -z "$ax_enable_matlab"; then
ax_enable_matlab=no
else
# Fail if MATLAB was explicitly enabled.
AC_MSG_RESULT([failure])
AC_MSG_ERROR([check your MATLAB setup])
fi
fi
AC_MSG_RESULT([$ax_enable_matlab])
if test "$ax_enable_matlab" = yes; then
AC_DEFINE([HAVE_MATLAB], [1], [Define if you have MATLAB.])
fi
AC_SUBST([MATLAB])
])
# AX_REQUIRE_MATLAB
# -----------------
# Like AX_MATLAB but fail if MATLAB support is disabled.
AC_DEFUN([AX_REQUIRE_MATLAB],
[dnl
AC_PREREQ([2.50])
AC_REQUIRE([AX_MATLAB])
if test "$ax_enable_matlab" = no; then
AC_MSG_ERROR([can not enable MATLAB support])
fi
])
# AX_MATLAB_CONDITIONAL
# ---------------------
# Define MATLAB conditional for GNU Automake.
AC_DEFUN([AX_MATLAB_CONDITIONAL],
[dnl
AC_PREREQ([2.50])
AC_REQUIRE([AX_MATLAB])
AM_CONDITIONAL([MATLAB], [test "$ax_enable_matlab" = yes])
])
dnl ax_matlab.m4 ends here
dnl Local variables:
dnl tab-width: 8
dnl End:

View File

@ -1,76 +0,0 @@
dnl matlabarch.m4 --- check for MATLAB machine architecture.
dnl
dnl Copyright © 2002, 2003 Ralph Schleicher
dnl Copyright © 2009-2023 Dynare Team
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License as
dnl published by the Free Software Foundation; either version 2,
dnl or (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License along
dnl with this program. If not, see <https://www.gnu.org/licenses/>.
dnl
dnl As a special exception to the GNU General Public License, if
dnl you distribute this file as part of a program that contains a
dnl configuration script generated by GNU Autoconf, you may include
dnl it under the same distribution terms that you use for the rest
dnl of that program.
dnl
dnl Code:
# AX_MATLAB_ARCH
# --------------
# Check for MATLAB machine architecture.
AC_DEFUN([AX_MATLAB_ARCH],
[dnl
AC_PREREQ([2.50])
AC_REQUIRE([AX_MEXEXT])
AC_CACHE_CHECK([for MATLAB machine architecture], [ax_cv_matlab_arch],
[if test "${MATLAB_ARCH+set}" = set ; then
ax_cv_matlab_arch="$MATLAB_ARCH"
else
case $MEXEXT in
*dll | *mexw32)
ax_cv_matlab_arch=win32
;;
*mexw64)
ax_cv_matlab_arch=win64
;;
*mexglx)
ax_cv_matlab_arch=glnx86
;;
*mexa64)
ax_cv_matlab_arch=glnxa64
;;
*mexs64)
ax_cv_matlab_arch=sol64
;;
*mexmaci)
ax_cv_matlab_arch=maci
;;
*mexmaci64)
ax_cv_matlab_arch=maci64
;;
*mexmaca64)
ax_cv_matlab_arch=maca64
;;
*)
ax_cv_matlab_arch=unknown
;;
esac
fi])
MATLAB_ARCH="$ax_cv_matlab_arch"
AC_SUBST([MATLAB_ARCH])
])
dnl matlabarch.m4 ends here
dnl Local variables:
dnl tab-width: 8
dnl End:

View File

@ -1,41 +0,0 @@
dnl Copyright © 2019 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
dnl Dynare is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl Dynare is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Dynare. If not, see <https://www.gnu.org/licenses/>.
AC_DEFUN([AX_MATLAB_BATCH_OPTIONS],
[dnl
AC_REQUIRE([AX_MATLAB])
AC_REQUIRE([AX_MATLAB_ARCH])
AC_REQUIRE([AX_MATLAB_VERSION])
AX_COMPARE_VERSION([$MATLAB_VERSION], [ge], [9.6],
[
if test "${MATLAB_ARCH}" = win32 -o "${MATLAB_ARCH}" = win64; then
MATLAB_BATCH_OPTIONS='-noFigureWindows -batch'
else
MATLAB_BATCH_OPTIONS='-nodisplay -batch'
fi
],
[
if test "${MATLAB_ARCH}" = win32 -o "${MATLAB_ARCH}" = win64; then
MATLAB_BATCH_OPTIONS='-nosplash -automation -wait -sd "$(CURDIR)" -r'
else
MATLAB_BATCH_OPTIONS='-nosplash -nodisplay -r'
fi
])
AC_SUBST([MATLAB_BATCH_OPTIONS])
])

View File

@ -1,176 +0,0 @@
dnl Copyright © 2009-2023 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
dnl Dynare is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl Dynare is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Dynare. If not, see <https://www.gnu.org/licenses/>.
AC_DEFUN([AX_MATLAB_VERSION],
[dnl
AC_REQUIRE([AX_MATLAB])
AC_MSG_CHECKING([for MATLAB version])
if test -n "$MATLAB"; then
dnl Try to autodetect MATLAB version
if test -f "${MATLAB}/VersionInfo.xml"; then
dnl The VersionInfo.xml file is present on all versions since R2017a, on all platforms.
dnl Extract the version number as x.y, since it is our preferred form, and is
dnl more robust to future versions.
dnl NB: brackets in regular expressions are enclosed in other brackets, because this is m4
MATLAB_VERSION=$(sed -En '/<version>/s/.*>([[0-9]]+\.[[0-9]]+).*/\1/p' "${MATLAB}/VersionInfo.xml")
elif test -f "${MATLAB}/bin/util/mex/version.txt"; then
dnl The bin/util/mex/version.txt file is present on Windows and macOS, at least
dnl since R2009b. It contains the release number (Rnnnnx).
MATLAB_VERSION=$(cat "${MATLAB}/bin/util/mex/version.txt")
elif test -f "${MATLAB}/bin/mex" || test -f "${MATLAB}/bin/mexsh"; then
dnl Works on Linux and macOS until R2018a included. Returns the release number (Rnnnnx).
dnl Older MATLABs have the version in bin/mex, more recent in bin/mexsh
dnl NB: brackets in regular expressions are enclosed in other brackets, because this is m4
MATLAB_VERSION=$(sed -En "/^.*full_ver=/s/^.*full_ver='(R[[^']]+)'.*/\1/p" "${MATLAB}"/bin/mex*)
fi
fi
if test -n "$MATLAB_VERSION"; then
dnl Convert a release number (Rnnnnx) into a version number (x.y)
case $MATLAB_VERSION in
*2023a | *2023A)
MATLAB_VERSION="9.14"
;;
*2022b | *2022B)
MATLAB_VERSION="9.13"
;;
*2022a | *2022A)
MATLAB_VERSION="9.12"
;;
*2021b | *2021B)
MATLAB_VERSION="9.11"
;;
*2021a | *2021A)
MATLAB_VERSION="9.10"
;;
*2020b | *2020B)
MATLAB_VERSION="9.9"
;;
*2020a | *2020A)
MATLAB_VERSION="9.8"
;;
*2019b | *2019B)
MATLAB_VERSION="9.7"
;;
*2019a | *2019A)
MATLAB_VERSION="9.6"
;;
*2018b | *2018B)
MATLAB_VERSION="9.5"
;;
*2018a | *2018A)
MATLAB_VERSION="9.4"
;;
*2017b | *2017B)
MATLAB_VERSION="9.3"
;;
*2017a | *2017A)
MATLAB_VERSION="9.2"
;;
*2016b | *2016B)
MATLAB_VERSION="9.1"
;;
*2016a | *2016A)
MATLAB_VERSION="9.0"
;;
*2015b | *2015B)
MATLAB_VERSION="8.6"
;;
*2015a | *2015A)
MATLAB_VERSION="8.5"
;;
*2014b | *2014B)
MATLAB_VERSION="8.4"
;;
*2014a | *2014A)
MATLAB_VERSION="8.3"
;;
*2013b | *2013B)
MATLAB_VERSION="8.2"
;;
*2013a | *2013A)
MATLAB_VERSION="8.1"
;;
*2012b | *2012B)
MATLAB_VERSION="8.0"
;;
*2012a | *2012A)
MATLAB_VERSION="7.14"
;;
*2011b | *2011B)
MATLAB_VERSION="7.13"
;;
*2011a | *2011A)
MATLAB_VERSION="7.12"
;;
*2010b | *2010B)
MATLAB_VERSION="7.11"
;;
*2010a | *2010A)
MATLAB_VERSION="7.10"
;;
*2009b | *2009B)
MATLAB_VERSION="7.9"
;;
*2009a | *2009A)
MATLAB_VERSION="7.8"
;;
*2008b | *2008B)
MATLAB_VERSION="7.7"
;;
*2008a | *2008A)
MATLAB_VERSION="7.6"
;;
*2007b | *2007B)
MATLAB_VERSION="7.5"
;;
*2007a | *2007A)
MATLAB_VERSION="7.4"
;;
*2006b | *2006B)
MATLAB_VERSION="7.3"
;;
*2006a | *2006A)
MATLAB_VERSION="7.2"
;;
*14SP3 | *14sp3)
MATLAB_VERSION="7.1"
;;
*14SP2 | *14sp2)
MATLAB_VERSION="7.0.4"
;;
*14SP1 | *14sp1)
MATLAB_VERSION="7.0.1"
;;
R14 | r14)
MATLAB_VERSION="7.0.0"
;;
esac
dnl Check that we have an x.y version number
if ! echo "${MATLAB_VERSION}" | grep -qE '^[[0-9.]]+$'; then
AC_MSG_ERROR([unknown MATLAB version ${MATLAB_VERSION}])
fi
AC_MSG_RESULT([${MATLAB_VERSION}])
ax_matlab_version_ok="yes"
else
AC_MSG_RESULT([unknown])
ax_matlab_version_ok="no"
fi
AC_SUBST([MATLAB_VERSION])
])

View File

@ -1,75 +0,0 @@
dnl ax_mexext.m4 --- check for MEX-file suffix.
dnl
dnl Copyright © 2000-2003 Ralph Schleicher
dnl Copyright © 2009-2019 Dynare Team
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License as
dnl published by the Free Software Foundation; either version 2,
dnl or (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License along
dnl with this program. If not, see <https://www.gnu.org/licenses/>.
dnl
dnl As a special exception to the GNU General Public License, if
dnl you distribute this file as part of a program that contains a
dnl configuration script generated by GNU Autoconf, you may include
dnl it under the same distribution terms that you use for the rest
dnl of that program.
dnl
dnl Code:
# AX_MEXEXT
# ---------
# Check for MEX-file suffix.
AC_DEFUN([AX_MEXEXT],
[dnl
AC_PREREQ([2.50])
AC_REQUIRE([AX_MATLAB])
AC_REQUIRE([AC_CANONICAL_BUILD])
AC_CACHE_CHECK([for MEX-file suffix], [ax_cv_mexext],
[if test "${MEXEXT+set}" = set ; then
ax_cv_mexext="$MEXEXT"
else
case $build_os in
*cygwin*|*mingw*)
ax_cv_mexext=$("$MATLAB"/bin/mexext.bat | sed 's/\r//')
;;
*)
ax_cv_mexext=$("$MATLAB"/bin/mexext)
;;
esac
fi])
MEXEXT="$ax_cv_mexext"
AC_SUBST([MEXEXT])
])
# AX_DOT_MEXEXT
# -------------
# Check for MEX-file suffix with leading dot.
AC_DEFUN([AX_DOT_MEXEXT],
[dnl
AC_REQUIRE([AX_MEXEXT])
case $MEXEXT in
.*)
;;
*)
if test -n "$MEXEXT" ; then
MEXEXT=.$MEXEXT
AC_MSG_RESULT([setting MEX-file suffix to $MEXEXT])
AC_SUBST([MEXEXT])
fi
;;
esac
])
dnl ax_mexext.m4 ends here
dnl Local variables:
dnl tab-width: 8
dnl End:

View File

@ -1,139 +0,0 @@
dnl Copyright © 2009-2023 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
dnl Dynare is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl Dynare is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Dynare. If not, see <https://www.gnu.org/licenses/>.
AC_DEFUN([AX_MEXOPTS],
[dnl
AC_REQUIRE([AX_MEXEXT])
AC_REQUIRE([AX_MATLAB_ARCH])
AC_REQUIRE([AX_MATLAB_VERSION])
AC_REQUIRE([AC_PROG_SED])
AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [8.3], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to 8.3 (R2014a) at least.])])
AC_MSG_CHECKING([for options to compile MEX for MATLAB])
MATLAB_CPPFLAGS="-I$MATLAB/extern/include"
case ${MATLAB_ARCH} in
glnxa64)
MATLAB_DEFS="-D_GNU_SOURCE -DNDEBUG"
MATLAB_CFLAGS="-fexceptions -fPIC -pthread"
MATLAB_CXXFLAGS="-fPIC -pthread"
MATLAB_FCFLAGS="-fPIC -fexceptions"
MATLAB_LDFLAGS_NOMAP="-shared -Wl,--no-undefined -Wl,-rpath-link,$MATLAB/bin/glnxa64 -L$MATLAB/bin/glnxa64"
MATLAB_LDFLAGS="$MATLAB_LDFLAGS_NOMAP -Wl,--version-script,$MATLAB/extern/lib/glnxa64/mexFunction.map"
MATLAB_LIBS="-lmx -lmex -lmat -lm -lmwlapack -lmwblas"
FORTRAN_LIBS_FOR_CXXLINK="-lgfortran -lquadmath"
ax_mexopts_ok="yes"
;;
win64)
MATLAB_CFLAGS="-fexceptions"
MATLAB_CXXFLAGS=""
MATLAB_FCFLAGS="-fexceptions -fno-underscoring"
MATLAB_DEFS="-DNDEBUG"
# The hack for libquadmath is needed because -static-libgfortran
# unfortunately does not imply the static linking of the former.
# The last part about winpthread is a hack to avoid dynamically linking
# against libwinpthread DLL (which is pulled in by libstdc++, even without
# using threads, since we are using the POSIX threads version of MinGW)
MATLAB_LDFLAGS_NOMAP="-static-libgcc -static-libstdc++ -static-libgfortran -Wl,-Bstatic,--whole-archive -lquadmath -Wl,-Bdynamic,--no-whole-archive -shared -L$MATLAB/bin/win64 -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,-Bdynamic,--no-whole-archive"
MATLAB_LDFLAGS="$MATLAB_LDFLAGS_NOMAP \$(abs_top_srcdir)/mex.def"
# Hack for libssp, which is pulled in by -fstack-protector
# (curiously only on some MEX files), see windows/build.sh.
# Note that the link against libssp should not happen with compilers
# from MSYS2, see:
# https://www.msys2.org/news/#2022-10-10-libssp-is-no-longer-required
# But it happens with Debians cross compilers (as of Debian “bookworm” 12).
# Also note that the -lssp must come by the end of the link command
# (otherwise it will have to be enclosed within --whole-archive).
MATLAB_LIBS="-lmex -lmx -lmat -lmwlapack -lmwblas -Wl,-Bstatic -lssp -Wl,-Bdynamic"
# Hack for static linking of libgomp, needed for OpenMP.
# Should come by the end of the link command
# (otherwise it will have to be enclosed within --whole-archive).
OPENMP_LIBS="-Wl,-Bstatic -lgomp -Wl,-Bdynamic"
FORTRAN_LIBS_FOR_CXXLINK="-Wl,-Bstatic -lgfortran -Wl,-Bdynamic" # libquadmath is already in MATLAB_LDFLAGS_NOMAP
ax_mexopts_ok="yes"
;;
mac[[ai]]64)
MATLAB_DEFS="-DNDEBUG"
MATLAB_CFLAGS="-fno-common -fexceptions"
MATLAB_CXXFLAGS="-fno-common -fexceptions"
MATLAB_FCFLAGS="-fexceptions -fbackslash"
MATLAB_LDFLAGS_NOMAP="-Wl,-twolevel_namespace -undefined error -bundle"
MATLAB_LDFLAGS="$MATLAB_LDFLAGS_NOMAP -Wl,-exported_symbols_list,\$(abs_top_srcdir)/mexFunction-MacOSX.map"
# This -L flag is put here, hence later on the linker command line, so as
# to avoid linking against the HDF5 shipped by MATLAB (which would
# otherwise override the HDF5 from Homebrew)
MATLAB_LIBS="-L$MATLAB/bin/${MATLAB_ARCH} -lmx -lmex -lmat -lmwlapack -lmwblas"
FORTRAN_LIBS_FOR_CXXLINK="-lgfortran -lquadmath"
ax_mexopts_ok="yes"
;;
*)
ax_mexopts_ok="no"
;;
esac
# Converts the MATLAB version number into comparable integers with only major and minor version numbers
# For example, 7.4.2 will become 0704
ax_matlab_ver=$(echo "$MATLAB_VERSION" | $SED -e 's/\([[0-9]]*\)\.\([[0-9]]*\).*/Z\1ZZ\2Z/' \
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
-e 's/[[^0-9]]//g')
MATLAB_DEFS="$MATLAB_DEFS -DMATLAB_VERSION=0x${ax_matlab_ver}"
if test "$ax_mexopts_ok" = "yes"; then
AC_MSG_RESULT([ok])
else
AC_MSG_RESULT([unknown])
fi
# Allow user to override default Matlab compilation flags
# Github ticket #1121
if test -n "$MATLAB_MEX_CPPFLAGS"; then
MATLAB_CPPFLAGS="$MATLAB_CPPFLAGS $MATLAB_MEX_CPPFLAGS"
fi
if test -n "$MATLAB_MEX_DEFS"; then
MATLAB_DEFS="$MATLAB_DEFS $MATLAB_MEX_DEFS"
fi
if test -n "$MATLAB_MEX_CFLAGS"; then
MATLAB_CFLAGS="$MATLAB_CFLAGS $MATLAB_MEX_CFLAGS"
fi
if test -n "$MATLAB_MEX_CXXFLAGS"; then
MATLAB_CXXFLAGS="$MATLAB_CXXFLAGS $MATLAB_MEX_CXXFLAGS"
fi
if test -n "$MATLAB_MEX_LDFLAGS"; then
MATLAB_LDFLAGS="$MATLAB_LDFLAGS $MATLAB_MEX_LDFLAGS"
fi
if test -n "$MATLAB_MEX_LIBS"; then
MATLAB_LIBS="$MATLAB_LIBS $MATLAB_MEX_LIBS"
fi
AC_SUBST([MATLAB_CPPFLAGS])
AC_SUBST([MATLAB_DEFS])
AC_SUBST([MATLAB_CFLAGS])
AC_SUBST([MATLAB_CXXFLAGS])
AC_SUBST([MATLAB_FCFLAGS])
AC_SUBST([MATLAB_LDFLAGS])
AC_SUBST([MATLAB_LIBS])
AC_SUBST([OPENMP_LIBS])
AC_SUBST([FORTRAN_LIBS_FOR_CXXLINK])
])

View File

@ -1,56 +0,0 @@
dnl ax_octave.m4 --- check for Octave
dnl
dnl Copyright © 2020-2021 Dynare Team
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License as
dnl published by the Free Software Foundation; either version 2,
dnl or (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License along
dnl with this program. If not, see <https://www.gnu.org/licenses/>.
dnl
dnl As a special exception to the GNU General Public License, if
dnl you distribute this file as part of a program that contains a
dnl configuration script generated by GNU Autoconf, you may include
dnl it under the same distribution terms that you use for the rest
dnl of that program.
# AX_OCTAVE
# ---------
# Checks for Octave.
# Search in the argument given to --with-octave if any.
# Otherwise, search in PATH.
# Sets OCTAVE and MKOCTFILE variables and calls AC_SUBST on them.
# Sets ax_enable_octave=yes if successful, ax_enable_octave=no otherwise
AC_DEFUN([AX_OCTAVE],
[dnl
AC_ARG_WITH([octave], AS_HELP_STRING([--with-octave=PATH], [Path to search for Octave installation]),
[
if test -n "$withval"; then
if test -x "$withval/bin/octave" && test -x "$withval/bin/mkoctfile"; then
OCTAVE="$withval/bin/octave"
MKOCTFILE="$withval/bin/mkoctfile"
else
AC_MSG_ERROR([invalid value '$withval' for --with-octave])
fi
fi
])
AC_CHECK_PROG([OCTAVE], [octave], [octave])
AC_CHECK_PROG([MKOCTFILE], [mkoctfile], [mkoctfile])
if test -n "$OCTAVE" && test -n "$MKOCTFILE"; then
ax_enable_octave=yes
else
ax_enable_octave=no
fi
AC_SUBST([OCTAVE])
AC_SUBST([MKOCTFILE])
])

View File

@ -1,27 +0,0 @@
dnl Copyright © 2009-2010 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
dnl Dynare is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl Dynare is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Dynare. If not, see <https://www.gnu.org/licenses/>.
AC_DEFUN([AX_PROG_LN_S],
[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_PROG_LN_S])
case ${host_os} in
*cygwin*|*mingw32*)
LN_S="cp -p" # Symbolic links are not understood by MATLAB under Windows
;;
esac
])

View File

@ -1,68 +0,0 @@
dnl Detect the SLICOT Library.
dnl Called with an argument of either 'matlab' or 'octave', depending
dnl on the configure script from which we're calling it
dnl
dnl AX_SLICOT([matlab])
dnl AX_SLICOT([octave])
dnl
dnl Copyright © 2012-2021 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
dnl Dynare is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl Dynare is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Dynare. If not, see <https://www.gnu.org/licenses/>.
AC_DEFUN([AX_SLICOT],
[
if test "$1" != matlab && test "$1" != octave; then
AC_MSG_ERROR([Argument to autoconf slicot macro must be either 'matlab' or 'octave'])
fi
AC_ARG_WITH(slicot, AS_HELP_STRING([--with-slicot=DIR], [prefix to SLICOT installation]),
slicot_prefix="$withval", slicot_prefix="")
has_slicot=yes
if test -n "$slicot_prefix"; then
LDFLAGS_SLICOT="-L$withval/lib"
else
LDFLAGS_SLICOT=""
fi
my_save_LDFLAGS=$LDFLAGS
# At this point we should add MATLAB_FCFLAGS to FCFLAGS for Windows (which has -fno-underscoring),
# but that does not work. The actual underscore test seems to happen at the very beginning of the
# macro. Hence the modification of FCFLAGS was moved higher (in mex/build/matlab/configure.ac).
AC_FC_FUNC(sb02od)
if test "$1" = matlab; then
LDFLAGS="$LDFLAGS $MATLAB_LDFLAGS_NOMAP $LDFLAGS_SLICOT"
# Add MATLAB_CFLAGS to get the -fPIC on Linux/x86_64 (otherwise linking fails)
my_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $MATLAB_CFLAGS"
AC_CHECK_LIB([slicot64_pic], [$sb02od], [LIBADD_SLICOT="-lslicot64_pic"], [has_slicot=no], [$MATLAB_LIBS])
CFLAGS=$my_save_CFLAGS
else
LDFLAGS="$LDFLAGS $LDFLAGS_SLICOT"
# Fallback on libslicot_pic if dynamic libslicot not found
AC_CHECK_LIB([slicot], [$sb02od], [LIBADD_SLICOT="-lslicot"],
[
AC_CHECK_LIB([slicot_pic], [$sb02od], [LIBADD_SLICOT="-lslicot_pic"], [has_slicot=no], [$($MKOCTFILE -p BLAS_LIBS) $($MKOCTFILE -p LAPACK_LIBS)])
],
[$($MKOCTFILE -p BLAS_LIBS) $($MKOCTFILE -p LAPACK_LIBS)])
fi
LDFLAGS=$my_save_LDFLAGS
AC_SUBST(LDFLAGS_SLICOT)
AC_SUBST(LIBADD_SLICOT)
])

View File

@ -15,22 +15,28 @@
# You should have received a copy of the GNU General Public License
# along with Dynare. If not, see <https://www.gnu.org/licenses/>.
.PHONY: all deps clean-deps clean clean-all build
ARCHS = arm64 x86_64
BUILDS = $(addprefix build-, $(ARCHS))
DEPS = $(addprefix deps-, $(ARCHS))
CLEAN_DEPS = $(addprefix clean-deps-, $(ARCHS))
CLEAN_ALL = $(addprefix clean-all-, $(ARCHS))
NTHREADS=$(shell sysctl -n hw.ncpu)
.PHONY: all $(BUILDS) $(DEPS) clean-pkg $(CLEAN_DEPS) $(CLEAN_ALL) clean-all
all: build
all: $(BUILDS)
deps:
make -C deps -j$(NTHREADS)
$(BUILDS): build-%: deps-%
./build.sh $*
clean-deps:
make -C deps clean-all
$(DEPS): deps-%:
make -C deps DEPS_ARCH=$*
clean:
$(CLEAN_DEPS): clean-deps-%:
make -C deps clean-all DEPS_ARCH=$*
clean-pkg:
rm -rf pkg
clean-all: clean-deps clean
$(CLEAN_ALL): clean-all-%: clean-deps-% clean-pkg
build: deps
./build.sh
clean-all: $(CLEAN_ALL)

View File

@ -1,279 +0,0 @@
class Gcc < Formula
desc "GNU compiler collection"
homepage "https://gcc.gnu.org/"
license "GPL-3.0-or-later" => { with: "GCC-exception-3.1" }
head "https://gcc.gnu.org/git/gcc.git", branch: "master"
stable do
url "https://ftp.gnu.org/gnu/gcc/gcc-13.1.0/gcc-13.1.0.tar.xz"
mirror "https://ftpmirror.gnu.org/gcc/gcc-13.1.0/gcc-13.1.0.tar.xz"
sha256 "61d684f0aa5e76ac6585ad8898a2427aade8979ed5e7f85492286c4dfc13ee86"
# Branch from the Darwin maintainer of GCC, with a few generic fixes and
# Apple Silicon support, located at https://github.com/iains/gcc-13-branch
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/5c206c47/gcc/gcc-13.1.0.diff"
sha256 "cb4e8a89387f748a744da0273025d0dc2e3c76780cc390b18ada704676afea11"
end
end
livecheck do
url :stable
regex(%r{href=["']?gcc[._-]v?(\d+(?:\.\d+)+)(?:/?["' >]|\.t)}i)
end
bottle do
sha256 cellar: :any, arm64_ventura: "d2b21a257c73e9b8f9c6bc03e6330ea8ba9fb3e7cdb9eb945d7ff7d96ba9708c"
sha256 cellar: :any, arm64_monterey: "5405f3b1ecdabb68e161308f35d72af907af21694a0e2b67f10edb25b2dd8f90"
sha256 cellar: :any, arm64_big_sur: "cc92fced3516bc72b69e31b0495fe416f206b540be02f1c817db96afbcc38f28"
sha256 cellar: :any, ventura: "3abd8c2c88a8e74b5df5c44f9c151ff7e760cf705307ecf3c95762492e777f1e"
sha256 cellar: :any, monterey: "f9cbc7eb14781df9228518a2d02590941206947e7dc419c0b232d523f39b1475"
sha256 cellar: :any, big_sur: "2eb458ed309ea4fa9451ab547fa3d797bd523ba4f50f01d5c997212109b74e5e"
sha256 cellar: :any_skip_relocation, x86_64_linux: "cca77a5d6625d3bb711ce40551751974d4cb5c74306329fc2fc8cdcade2ef564"
end
# The bottles are built on systems with the CLT installed, and do not work
# out of the box on Xcode-only systems due to an incorrect sysroot.
pour_bottle? only_if: :clt_installed
depends_on "gmp"
depends_on "isl"
depends_on "libmpc"
depends_on "mpfr"
depends_on "zstd"
uses_from_macos "zlib"
on_linux do
depends_on "binutils"
end
# GCC bootstraps itself, so it is OK to have an incompatible C++ stdlib
cxxstdlib_check :skip
def version_suffix
if build.head?
"HEAD"
else
version.major.to_s
end
end
def install
# GCC will suffer build errors if forced to use a particular linker.
ENV.delete "LD"
# We avoiding building:
# - Ada and D, which require a pre-existing GCC to bootstrap
# - Go, currently not supported on macOS
# - BRIG
languages = %w[c c++ objc obj-c++ fortran]
pkgversion = "Homebrew GCC #{pkg_version} #{build.used_options*" "}".strip
# Use `lib/gcc/current` to provide a path that doesn't change with GCC's version.
args = %W[
--prefix=#{opt_prefix}
--libdir=#{opt_lib}/gcc/current
--disable-nls
--enable-checking=release
--with-gcc-major-version-only
--enable-languages=#{languages.join(",")}
--program-suffix=-#{version_suffix}
--with-gmp=#{Formula["gmp"].opt_prefix}
--with-mpfr=#{Formula["mpfr"].opt_prefix}
--with-mpc=#{Formula["libmpc"].opt_prefix}
--with-isl=#{Formula["isl"].opt_prefix}
--with-zstd=#{Formula["zstd"].opt_prefix}
--with-pkgversion=#{pkgversion}
--with-bugurl=#{tap.issues_url}
--with-system-zlib
]
if OS.mac?
cpu = Hardware::CPU.arm? ? "aarch64" : "x86_64"
args << "--build=#{cpu}-apple-darwin#{OS.kernel_version.major}"
# System headers may not be in /usr/include
sdk = MacOS.sdk_path_if_needed
args << "--with-sysroot=#{sdk}" if sdk
else
# Fix cc1: error while loading shared libraries: libisl.so.15
args << "--with-boot-ldflags=-static-libstdc++ -static-libgcc #{ENV.ldflags}"
# Fix Linux error: gnu/stubs-32.h: No such file or directory.
args << "--disable-multilib"
# Enable to PIE by default to match what the host GCC uses
args << "--enable-default-pie"
# Change the default directory name for 64-bit libraries to `lib`
# https://stackoverflow.com/a/54038769
inreplace "gcc/config/i386/t-linux64", "m64=../lib64", "m64="
end
mkdir "build" do
system "../configure", *args
system "make"
# Do not strip the binaries on macOS, it makes them unsuitable
# for loading plugins
install_target = OS.mac? ? "install" : "install-strip"
# To make sure GCC does not record cellar paths, we configure it with
# opt_prefix as the prefix. Then we use DESTDIR to install into a
# temporary location, then move into the cellar path.
system "make", install_target, "DESTDIR=#{Pathname.pwd}/../instdir"
mv Dir[Pathname.pwd/"../instdir/#{opt_prefix}/*"], prefix
end
bin.install_symlink bin/"gfortran-#{version_suffix}" => "gfortran"
# Provide a `lib/gcc/xy` directory to align with the versioned GCC formulae.
# We need to create `lib/gcc/xy` as a directory and not a symlink to avoid `brew link` conflicts.
(lib/"gcc"/version_suffix).install_symlink (lib/"gcc/current").children
# Only the newest brewed gcc should install gfortan libs as we can only have one.
lib.install_symlink lib.glob("gcc/current/libgfortran.*") if OS.linux?
# Handle conflicts between GCC formulae and avoid interfering
# with system compilers.
# Rename man7.
man7.glob("*.7") { |file| add_suffix file, version_suffix }
# Even when we disable building info pages some are still installed.
info.rmtree
# Work around GCC install bug
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105664
rm_rf bin.glob("*-gcc-tmp")
end
def add_suffix(file, suffix)
dir = File.dirname(file)
ext = File.extname(file)
base = File.basename(file, ext)
File.rename file, "#{dir}/#{base}-#{suffix}#{ext}"
end
def post_install
if OS.linux?
gcc = bin/"gcc-#{version_suffix}"
libgcc = Pathname.new(Utils.safe_popen_read(gcc, "-print-libgcc-file-name")).parent
raise "command failed: #{gcc} -print-libgcc-file-name" if $CHILD_STATUS.exitstatus.nonzero?
glibc = Formula["glibc"]
glibc_installed = glibc.any_version_installed?
# Symlink system crt1.o and friends where gcc can find it.
crtdir = if glibc_installed
glibc.opt_lib
else
Pathname.new(Utils.safe_popen_read("/usr/bin/cc", "-print-file-name=crti.o")).parent
end
ln_sf Dir[crtdir/"*crt?.o"], libgcc
# Create the GCC specs file
# See https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html
# Locate the specs file
specs = libgcc/"specs"
ohai "Creating the GCC specs file: #{specs}"
specs_orig = Pathname.new("#{specs}.orig")
rm_f [specs_orig, specs]
system_header_dirs = ["#{HOMEBREW_PREFIX}/include"]
if glibc_installed
# https://github.com/Linuxbrew/brew/issues/724
system_header_dirs << glibc.opt_include
else
# Locate the native system header dirs if user uses system glibc
target = Utils.safe_popen_read(gcc, "-print-multiarch").chomp
raise "command failed: #{gcc} -print-multiarch" if $CHILD_STATUS.exitstatus.nonzero?
system_header_dirs += ["/usr/include/#{target}", "/usr/include"]
end
# Save a backup of the default specs file
specs_string = Utils.safe_popen_read(gcc, "-dumpspecs")
raise "command failed: #{gcc} -dumpspecs" if $CHILD_STATUS.exitstatus.nonzero?
specs_orig.write specs_string
# Set the library search path
# For include path:
# * `-isysroot #{HOMEBREW_PREFIX}/nonexistent` prevents gcc searching built-in
# system header files.
# * `-idirafter <dir>` instructs gcc to search system header
# files after gcc internal header files.
# For libraries:
# * `-nostdlib -L#{libgcc} -L#{glibc.opt_lib}` instructs gcc to use
# brewed glibc if applied.
# * `-L#{libdir}` instructs gcc to find the corresponding gcc
# libraries. It is essential if there are multiple brewed gcc
# with different versions installed.
# Noted that it should only be passed for the `gcc@*` formulae.
# * `-L#{HOMEBREW_PREFIX}/lib` instructs gcc to find the rest
# brew libraries.
# Note: *link will silently add #{libdir} first to the RPATH
libdir = HOMEBREW_PREFIX/"lib/gcc/current"
specs.write specs_string + <<~EOS
*cpp_unique_options:
+ -isysroot #{HOMEBREW_PREFIX}/nonexistent #{system_header_dirs.map { |p| "-idirafter #{p}" }.join(" ")}
*link_libgcc:
#{glibc_installed ? "-nostdlib -L#{libgcc} -L#{glibc.opt_lib}" : "+"} -L#{libdir} -L#{HOMEBREW_PREFIX}/lib
*link:
+ --dynamic-linker #{HOMEBREW_PREFIX}/lib/ld.so -rpath #{libdir}
*homebrew_rpath:
-rpath #{HOMEBREW_PREFIX}/lib
EOS
inreplace(specs, " %o ", "\\0%(homebrew_rpath) ")
end
end
test do
(testpath/"hello-c.c").write <<~EOS
#include <stdio.h>
int main()
{
puts("Hello, world!");
return 0;
}
EOS
system "#{bin}/gcc-#{version_suffix}", "-o", "hello-c", "hello-c.c"
assert_equal "Hello, world!\n", shell_output("./hello-c")
(testpath/"hello-cc.cc").write <<~EOS
#include <iostream>
struct exception { };
int main()
{
std::cout << "Hello, world!" << std::endl;
try { throw exception{}; }
catch (exception) { }
catch (...) { }
return 0;
}
EOS
system "#{bin}/g++-#{version_suffix}", "-o", "hello-cc", "hello-cc.cc"
assert_equal "Hello, world!\n", shell_output("./hello-cc")
(testpath/"test.f90").write <<~EOS
integer,parameter::m=10000
real::a(m), b(m)
real::fact=0.5
do concurrent (i=1:m)
a(i) = a(i) + fact*b(i)
end do
write(*,"(A)") "Done"
end
EOS
system "#{bin}/gfortran", "-o", "test", "test.f90"
assert_equal "Done\n", shell_output("./test")
end
end

View File

@ -1,102 +0,0 @@
class Gmp < Formula
desc "GNU multiple precision arithmetic library"
homepage "https://gmplib.org/"
license any_of: ["LGPL-3.0-or-later", "GPL-2.0-or-later"]
revision 1
stable do
url "https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz"
mirror "https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz"
sha256 "fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2"
# Fix -flat_namespace being used on Big Sur and later.
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/03cf8088210822aa2c1ab544ed58ea04c897d9c4/libtool/configure-big_sur.diff"
sha256 "35acd6aebc19843f1a2b3a63e880baceb0f5278ab1ace661e57a502d9d78c93c"
end
end
livecheck do
url "https://gmplib.org/download/gmp/"
regex(/href=.*?gmp[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any, arm64_ventura: "2436cd120e5678d67c24020a50cbbf7c0220e7ecaac63981335872b9d666bcad"
sha256 cellar: :any, arm64_monterey: "a43a2ae4c44d90626b835a968a32327c8b8bbf754ec1d2590f8ac656c71dace9"
sha256 cellar: :any, arm64_big_sur: "491220f1ff2c662b96295d931a80702523eeaee681d7305fb02b561e527dcbb8"
sha256 cellar: :any, ventura: "4c6488dfd53b8287702827a4e6d50569926417f2cd08613d37720de54b6afe0c"
sha256 cellar: :any, monterey: "dddc6d8c871c92f6e5fb1249c28768aa2b4b47c38836a69cf787a639cf5eee73"
sha256 cellar: :any, big_sur: "e566452815d2ff5dc66da160bd1cd3d9cf02a17a07284cf0bac46496133383ae"
sha256 cellar: :any, catalina: "5ee7a460668864c28e541db15420e1480c3d31c5f216797a453a5310106fbc97"
sha256 cellar: :any, mojave: "b9d7d36c8d263be0e02e17d435350546f9f7008eb21b6e86bf42f719efcba85e"
sha256 cellar: :any_skip_relocation, x86_64_linux: "786ae29f0c0b06ea86e42bd9c6ac2c49bd5757da037dead7053e8bd612c4cf8c"
end
head do
url "https://gmplib.org/repo/gmp/", using: :hg
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
uses_from_macos "m4" => :build
# Prevent crash on macOS 12 betas with release gmp 6.2.1, can be removed after the next gmp release.
patch do
url "https://gmplib.org/repo/gmp/raw-rev/5f32dbc41afc"
sha256 "a44ef57903b240df6fde6c9d2fe40063f785995c43b6bfc7a237c571f53613e0"
end
def install
system "./.bootstrap" if build.head?
args = std_configure_args
args << "--enable-cxx"
# Enable --with-pic to avoid linking issues with the static library
args << "--with-pic"
cpu = Hardware::CPU.arm? ? "aarch64" : Hardware.oldest_cpu
if OS.mac?
args << "--build=#{cpu}-apple-darwin#{OS.kernel_version.major}"
else
args << "--build=#{cpu}-linux-gnu"
args << "ABI=32" if Hardware::CPU.is_32_bit?
end
system "./configure", *args
system "make"
system "make", "check"
system "make", "install"
# Prevent brew from trying to install metafiles that
# are actually symlinks to files in autotools kegs
buildpath.children.select(&:symlink?).map(&:unlink) if build.head?
end
test do
(testpath/"test.c").write <<~EOS
#include <gmp.h>
#include <stdlib.h>
int main() {
mpz_t i, j, k;
mpz_init_set_str (i, "1a", 16);
mpz_init (j);
mpz_init (k);
mpz_sqrtrem (j, k, i);
if (mpz_get_si (j) != 5 || mpz_get_si (k) != 1) abort();
return 0;
}
EOS
system ENV.cc, "test.c", "-L#{lib}", "-lgmp", "-o", "test"
system "./test"
# Test the static library to catch potential linking issues
system ENV.cc, "test.c", "#{lib}/libgmp.a", "-o", "test"
system "./test"
end
end

View File

@ -1,65 +0,0 @@
class Isl < Formula
# NOTE: Always use tarball instead of git tag for stable version.
#
# Currently isl detects its version using source code directory name
# and update isl_version() function accordingly. All other names will
# result in isl_version() function returning "UNKNOWN" and hence break
# package detection.
desc "Integer Set Library for the polyhedral model"
homepage "https://libisl.sourceforge.io/"
url "https://libisl.sourceforge.io/isl-0.26.tar.xz"
sha256 "a0b5cb06d24f9fa9e77b55fabbe9a3c94a336190345c2555f9915bb38e976504"
license "MIT"
livecheck do
url :homepage
regex(/href=.*?isl[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any, arm64_ventura: "1814fe867c61b34cd5c763cf2ebda99d7883db78348c8b663f98cc95a1348d16"
sha256 cellar: :any, arm64_monterey: "0a3e83c458420e4b469ad7464d16d6c9cd26a888059358eb5f1f9d3cff54bbd7"
sha256 cellar: :any, arm64_big_sur: "a68a647249ad644cd8d1e1057bac65e5b4e1e08f9adaf15a07121853b0ed40cc"
sha256 cellar: :any, ventura: "0301489db7b26967657be0f6c89f11ea7e1e5fb50631686f86c597b01c00dc85"
sha256 cellar: :any, monterey: "0dcc555fd2517c6c93bca8999c741029bbdd821bfeb397505ec1f98deb79c551"
sha256 cellar: :any, big_sur: "91965ce2f54c7d1b16747ed05de989a3a122f5dbee67546bbf9bf065873b13c5"
sha256 cellar: :any_skip_relocation, x86_64_linux: "db14ba1e4ea23ab41e06930dcf25ae9023c5e395c88602da2a9b6a98d54c92d3"
end
head do
url "https://repo.or.cz/isl.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "gmp"
def install
system "./autogen.sh" if build.head?
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--with-gmp=system",
"--with-gmp-prefix=#{Formula["gmp"].opt_prefix}"
system "make"
system "make", "install"
(share/"gdb/auto-load").install Dir["#{lib}/*-gdb.py"]
end
test do
(testpath/"test.c").write <<~EOS
#include <isl/ctx.h>
int main()
{
isl_ctx* ctx = isl_ctx_alloc();
isl_ctx_free(ctx);
return 0;
}
EOS
system ENV.cc, "test.c", "-L#{lib}", "-lisl", "-o", "test"
system "./test"
end
end

View File

@ -1,60 +0,0 @@
class Libmpc < Formula
desc "C library for the arithmetic of high precision complex numbers"
homepage "http://www.multiprecision.org/mpc/"
url "https://ftp.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz"
mirror "https://ftpmirror.gnu.org/mpc/mpc-1.3.1.tar.gz"
sha256 "ab642492f5cf882b74aa0cb730cd410a81edcdbec895183ce930e706c1c759b8"
license "LGPL-3.0-or-later"
bottle do
sha256 cellar: :any, arm64_ventura: "da4ff781bc469c82af17f98f0bdbf20932e222d0520ab784cd1b322b789ad7a5"
sha256 cellar: :any, arm64_monterey: "dd3994160b3625b1f14e34abf632b90bf49e71db1cc85c12e9ab529d4cae2a87"
sha256 cellar: :any, arm64_big_sur: "43bbe994c7bbb40f7172ef7a750bc6d2687275a76a25f67fc2d53ef00728d912"
sha256 cellar: :any, ventura: "aa4ddb0e50ace93746e6af2e6185493698b501e9359cf73ce41cfbb70369db09"
sha256 cellar: :any, monterey: "c32f2c3fe7ab06e308e6fa74874e1d4d92ff6eb3598da6e0f8e6fa7a333350f5"
sha256 cellar: :any, big_sur: "47b50c3df6a35ea3c876397eac4a7dc157b5f4109247671a16599a9a41b9c035"
sha256 cellar: :any_skip_relocation, x86_64_linux: "f6542ae5bcf643ca0c980c7000cde1585922e76be080b3cc3422dac0d4a50904"
end
head do
url "https://gitlab.inria.fr/mpc/mpc.git", branch: "master"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "gmp"
depends_on "mpfr"
def install
system "autoreconf", "--force", "--install", "--verbose" if build.head?
system "./configure", *std_configure_args,
"--with-gmp=#{Formula["gmp"].opt_prefix}",
"--with-mpfr=#{Formula["mpfr"].opt_prefix}"
system "make"
system "make", "check"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <mpc.h>
#include <assert.h>
#include <math.h>
int main() {
mpc_t x;
mpc_init2 (x, 256);
mpc_set_d_d (x, 1., INFINITY, MPC_RNDNN);
mpc_tanh (x, x, MPC_RNDNN);
assert (mpfr_nan_p (mpc_realref (x)) && mpfr_nan_p (mpc_imagref (x)));
mpc_clear (x);
return 0;
}
EOS
system ENV.cc, "test.c", "-L#{lib}", "-L#{Formula["mpfr"].opt_lib}",
"-L#{Formula["gmp"].opt_lib}", "-lmpc", "-lmpfr",
"-lgmp", "-o", "test"
system "./test"
end
end

View File

@ -1,101 +0,0 @@
class Mpfr < Formula
desc "C library for multiple-precision floating-point computations"
homepage "https://www.mpfr.org/"
license "LGPL-3.0-or-later"
stable do
url "https://ftp.gnu.org/gnu/mpfr/mpfr-4.2.0.tar.xz"
mirror "https://ftpmirror.gnu.org/mpfr/mpfr-4.2.0.tar.xz"
sha256 "06a378df13501248c1b2db5aa977a2c8126ae849a9d9b7be2546fb4a9c26d993"
version "4.2.0-p9"
# Upstream patches, list at https://www.mpfr.org/mpfr-current/#fixed
%w[
01 2e465c31689e780a93b24bf2959917443fb882da85b7f1ef23ae53d3de614aa4
02 e1ef3d4dab999f4e0ad5ee046c3a2823d3a9395fb8092c3dcb85d3fe29994b52
03 a906f9ed8e4a7230980322a0154702664164690614e5ff55ae7049c3fae55584
04 ece14ee57596dc2e4f67d2e857c5c6b23d76b20183a50a8b6759b640df001b78
05 c4144564097a1be89c9cc2e7ee255c9fe59eb1b94a17c9d4a08169223e705ac1
06 70456748a8072265ba103d93ba94e9f93ae64565e6a5742194c56030086540fa
07 472386aa5f8c51fbdf60154c19268ce2212be03e1c2f9004c1673b6c270508f6
08 6ecd3bd2edf178f4ede4be612964d1b2d0a0bb10ad6f8c51d1a8011fff87d5ea
09 3e9aed5bcea95d34d0bd179a61cd7acb712c89c9a745535f18f0ef619833ba3b
].each_slice(2) do |p, checksum|
patch do
url "https://www.mpfr.org/mpfr-4.2.0/patch#{p}"
sha256 checksum
end
end
end
livecheck do
url "https://www.mpfr.org/mpfr-current/"
regex(/href=.*?mpfr[._-]v?(\d+(?:\.\d+)+)\.t/i)
strategy :page_match do |page, regex|
version = page.scan(regex).map { |match| Version.new(match[0]) }.max&.to_s
next if version.blank?
patch = page.scan(%r{href=["']?/?patch(\d+)["' >]}i)
.map { |match| Version.new(match[0]) }
.max
&.to_s
next version if patch.blank?
"#{version}-p#{patch.to_i}"
end
end
bottle do
sha256 cellar: :any, arm64_ventura: "176114984411aeb1187a50fd9ffc39d7dfe0bf5dc29ab13b0ecc95307d619ff9"
sha256 cellar: :any, arm64_monterey: "77a979ab547618549fc85a12212abd57b085b1712c53299847966d76a4e261f9"
sha256 cellar: :any, arm64_big_sur: "f5776604dbb68288c8dfe371e46398a671b6c34329ad473ada5d4e1fa7562086"
sha256 cellar: :any, ventura: "781d9c4887b8b18ccb96653ce59bb9aa5ee49dd1fb6c7d804750f58ce8726a2f"
sha256 cellar: :any, monterey: "a8eb9e75c01527d80843daba945a7581942362e689e3f3b7c6c891daa2655e9e"
sha256 cellar: :any, big_sur: "22360e6d89681f3d3d326a5654ab0cfb22d5ac42241c40e9f8f91eb06bb1b77c"
sha256 cellar: :any_skip_relocation, x86_64_linux: "d0cafd93a5957220615ae6478033031b750ba5eb6a830cf86d4cbde5bffec8d5"
end
head do
url "https://gitlab.inria.fr/mpfr/mpfr.git", branch: "master"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "gmp"
def install
system "./autogen.sh" if build.head?
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}",
"--disable-silent-rules"
system "make"
system "make", "check"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <mpfr.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
int main() {
mpfr_t x, y;
mpfr_inits2 (256, x, y, NULL);
mpfr_set_ui (x, 2, MPFR_RNDN);
mpfr_rootn_ui (y, x, 2, MPFR_RNDN);
mpfr_pow_si (x, y, 4, MPFR_RNDN);
mpfr_add_si (y, x, -4, MPFR_RNDN);
mpfr_abs (y, y, MPFR_RNDN);
if (fabs(mpfr_get_d (y, MPFR_RNDN)) > 1.e-30) abort();
if (strcmp("#{version}", mpfr_get_version())) abort();
return 0;
}
EOS
system ENV.cc, "test.c", "-L#{lib}", "-L#{Formula["gmp"].opt_lib}",
"-lgmp", "-lmpfr", "-o", "test"
system "./test"
end
end

View File

@ -1,61 +0,0 @@
class Zstd < Formula
desc "Zstandard is a real-time compression algorithm"
homepage "https://facebook.github.io/zstd/"
url "https://github.com/facebook/zstd/archive/v1.5.5.tar.gz"
mirror "http://fresh-center.net/linux/misc/zstd-1.5.5.tar.gz"
mirror "http://fresh-center.net/linux/misc/legacy/zstd-1.5.5.tar.gz"
sha256 "98e9c3d949d1b924e28e01eccb7deed865eefebf25c2f21c702e5cd5b63b85e1"
license "BSD-3-Clause"
head "https://github.com/facebook/zstd.git", branch: "dev"
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
sha256 cellar: :any, arm64_ventura: "b709835f4cd5d339b97103f0dfa343489a02d2073f8e80ba7b04d682f1d29bd4"
sha256 cellar: :any, arm64_monterey: "e3cb579108afe4794143b33f24b6020648ca166f0104eb3d13cee56da62c949f"
sha256 cellar: :any, arm64_big_sur: "faf929cf92dad72eca2b16fb5aedb695f5d291aac18b496061b8b14003b2e224"
sha256 cellar: :any, ventura: "e4eb8cc0473c699ec424bfecc67fcfd30631f7fe5eacf26c727bfed73dcf7c12"
sha256 cellar: :any, monterey: "9c1cfe9158a48f6bd3eeb92608ed2799a048d1d27e70e7acef82d5eb4a7a1cea"
sha256 cellar: :any, big_sur: "73d78b5fef5ba31d3c37b8201310fe042f30c6000a97b8ba0d91208e1e1de231"
sha256 cellar: :any_skip_relocation, x86_64_linux: "68c8655224f058316c16462507b6cdd061bd546e161bf8419c68ca526d3a9a48"
end
depends_on "cmake" => :build
depends_on "lz4"
depends_on "xz"
uses_from_macos "zlib"
def install
# Legacy support is the default after
# https://github.com/facebook/zstd/commit/db104f6e839cbef94df4df8268b5fecb58471274
# Set it to `ON` to be explicit about the configuration.
system "cmake", "-S", "build/cmake", "-B", "builddir",
"-DZSTD_PROGRAMS_LINK_SHARED=ON", # link `zstd` to `libzstd`
"-DZSTD_BUILD_CONTRIB=ON",
"-DCMAKE_INSTALL_RPATH=#{rpath}",
"-DZSTD_LEGACY_SUPPORT=ON",
"-DZSTD_ZLIB_SUPPORT=ON",
"-DZSTD_LZMA_SUPPORT=ON",
"-DZSTD_LZ4_SUPPORT=ON",
"-DCMAKE_CXX_STANDARD=11",
*std_cmake_args
system "cmake", "--build", "builddir"
system "cmake", "--install", "builddir"
end
test do
[bin/"zstd", bin/"pzstd", "xz", "lz4", "gzip"].each do |prog|
data = "Hello, #{prog}"
assert_equal data, pipe_output("#{bin}/zstd -d", pipe_output(prog, data))
if prog.to_s.end_with?("zstd")
# `pzstd` can only decompress zstd-compressed data.
assert_equal data, pipe_output("#{bin}/pzstd -d", pipe_output(prog, data))
else
assert_equal data, pipe_output("#{prog} -d", pipe_output("#{bin}/zstd --format=#{prog}", data))
end
end
end
end

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Copyright © 2019-2023 Dynare Team
# Copyright © 2019-2024 Dynare Team
#
# This file is part of Dynare.
#
@ -18,39 +18,81 @@
# along with Dynare. If not, see <https://www.gnu.org/licenses/>.
set -ex
#exec > >(tee build-logfile.log) 2>&1 # uncomment for debugging
ROOTDIR=$(pwd)/..
##
## Set settings based on architecture
##
path_remove () { export "$1"="$(echo -n "${!1}" | awk -v RS=: -v ORS=: '$1 != "'"$2"'"' | sed 's/:$//')"; }
path_prepend () { path_remove "$1" "$2"; export "$1"="$2:${!1}"; }
PKG_ARCH=${1:-x86_64} # default to x86_64
if [[ "$PKG_ARCH" == arm64 ]]; then
BREWDIR=/opt/homebrew
# Make sure /opt/homebrew/bin is set first in PATH (as it might come last)
path_prepend PATH /opt/homebrew/bin
MATLAB_ARCH=maca64
else
BREWDIR=/usr/local
# Remove /opt/homebrew/bin from PATH, so it does not intervene with the x86_64 compilations
path_remove PATH /opt/homebrew/bin
MATLAB_ARCH=maci64
fi
MATLAB_PATH=/Applications/"$PKG_ARCH"/MATLAB_R2023b.app
# Set the GCC version
GCC_VERSION=13
# Set the compilers
CC=gcc-$GCC_VERSION
CXX=g++-$GCC_VERSION
# Set the number of threads
NTHREADS=$(sysctl -n hw.ncpu)
# Append texbin to PATH to access latexmk and friends
path_prepend PATH /Library/TeX/texbin
# Set dependency directory
LIB64="$ROOTDIR"/macOS/deps/lib64
LIB64="$ROOTDIR"/macOS/deps/"$PKG_ARCH"/lib64
## Hack for statically linking libquadmath, similar to the one used in
## deps/Makefile for several libraries (there is no -static-libquadmath flag,
## see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46539).
##
## NB: The hack done for Windows does not work for two reasons:
## - the macOS linker is different from GNU ld and does not have the equivalent of -Bstatic/-Bdynamic
## - libgfortran.spec does not include --as-needed on macOS, hence it will link the library anyways
## Also, it does not seem possible to override libgfortran.spec with the --specs option.
GCC_VERSION=$(sed -En "/^c[[:space:]]*=/s/c[[:space:]]*=[[:space:]]*'.*gcc-([0-9]+)'/\1/p" "$ROOTDIR"/macOS/homebrew-native-"$PKG_ARCH".ini)
QUADMATH_DIR=$(mktemp -d)
ln -s "$BREWDIR"/opt/gcc/lib/gcc/"$GCC_VERSION"/libquadmath.a "$QUADMATH_DIR"
##
## Find Dynare Version
## Compile Dynare
##
cd "$ROOTDIR"
# NB: the addition of -Wl,-ld_classic is a workaround for https://github.com/mesonbuild/meson/issues/12282 (see also the native file)
common_meson_opts=(-Dbuild_for=matlab -Dbuildtype=release -Dprefer_static=true -Dfortran_args="[ '-B', '$LIB64/Slicot/' ]" \
-Dc_link_args="[ '-Wl,-ld_classic', '-L$QUADMATH_DIR' ]" -Dcpp_link_args="[ '-Wl,-ld_classic', '-L$QUADMATH_DIR' ]" -Dfortran_link_args="[ '-Wl,-ld_classic', '-L$QUADMATH_DIR' ]" \
--native-file macOS/homebrew-native-$PKG_ARCH.ini)
# Build for MATLAB ⩾ R2018b (x86_64) and MATLAB ⩾ R2023b (arm64)
arch -"$PKG_ARCH" meson setup "${common_meson_opts[@]}" -Dmatlab_path="$MATLAB_PATH" build-matlab --wipe
arch -"$PKG_ARCH" meson compile -v -C build-matlab
# If not in CI, build the docs
if [[ -z $CI ]]; then
arch -"$PKG_ARCH" meson compile -v -C build-matlab doc
ln -s build-matlab build-doc
fi
##
## Create package
##
# Determine Dynare version if not passed by an environment variable as in the CI
if [[ -z $VERSION ]]; then
cd build-matlab
VERSION=$(meson introspect --projectinfo | sed -En 's/^.*"version": "([^"]*)".*$/\1/p')
cd ..
fi
# Other useful variables
DATE=$(date +%Y-%m-%d-%H%M)
DATELONG=$(date '+%d %B %Y')
if [[ -d ../.git/ ]]; then
SHA=$(git rev-parse HEAD)
SHASHORT=$(git rev-parse --short HEAD)
fi
if [[ -z $VERSION ]]; then
VERSION=$(grep '^AC_INIT(' ../configure.ac | sed 's/AC_INIT(\[dynare\], \[\(.*\)\])/\1/')
if [[ -d ../.git/ ]]; then
VERSION="$VERSION"-"$SHASHORT"
fi
fi
# Install location must not be too long for gcc.
# Otherwise, the headers of the compiled libraries cannot be modified
@ -63,146 +105,82 @@ else
# Get the first component, truncate it to 5 characters, and add the date
LOCATION=$(echo "$VERSION" | cut -f1 -d"-" | cut -c 1-5)-"$DATE"
fi
# Add architecture to LOCATION and VERSION
VERSION="$VERSION"-"$PKG_ARCH"
LOCATION="$LOCATION"-"$PKG_ARCH"
## Hack for statically linking libquadmath, similar to the one used in
## deps/Makefile for several libraries (there is no -static-libquadmath flag,
## see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46539).
##
## NB: The hack done for Windows (see m4/ax_mexopts.m4) does not work for two reasons:
## - the macOS linker is different from GNU ld and does not have the equivalent of -Bstatic/-Bdynamic
## - libgfortran.spec does not include --as-needed on macOS, hence it will link the library anyways
## Also, it does not seem possible to override libgfortran.spec with the --specs option.
QUADMATH_DIR=$(mktemp -d)
ln -s /usr/local/opt/gcc/lib/gcc/$GCC_VERSION/libquadmath.a $QUADMATH_DIR
##
## Compile Dynare doc, preprocessor, mex for MATLAB < 2018a
##
## NB: In Homebrew, -static-libgfortran is implied by -static-libgcc (see “gfortran -dumpspecs”)
## NB2: We use the hack for libquadmath in LDFLAGS
cd "$ROOTDIR"
[[ -f configure ]] || autoreconf -si
./configure \
PACKAGE_VERSION="$VERSION" \
PACKAGE_STRING="dynare $VERSION" \
CC=$CC \
CXX=$CXX \
CPPFLAGS=-I/usr/local/include \
LDFLAGS="-static-libgcc -L$QUADMATH_DIR" \
LEX=/usr/local/opt/flex/bin/flex \
YACC=/usr/local/opt/bison/bin/bison \
--with-gsl="$LIB64"/gsl \
--with-matio="$LIB64"/matio \
--with-slicot="$LIB64"/Slicot/with-underscore \
--disable-octave \
--with-matlab=/Applications/MATLAB_R2016b.app
if [[ -z $CI ]]; then
# If not in Gitlab CI, clean the source and build the doc
make clean
make -j"$NTHREADS" pdf html
fi
make -j"$NTHREADS"
##
## Create package
##
NAME=dynare-"$VERSION"
PKGFILES="$ROOTDIR"/macOS/pkg/"$NAME"
mkdir -p \
"$PKGFILES"/preprocessor \
"$PKGFILES"/mex/matlab/maci64-8.3-9.3 \
"$PKGFILES"/mex/matlab/maci64-9.4-9.14 \
"$PKGFILES"/doc \
"$PKGFILES"/scripts \
"$PKGFILES"/contrib/ms-sbvar/TZcode
if [[ "$PKG_ARCH" == x86_64 ]]; then
mkdir -p "$PKGFILES"/mex/matlab/"$MATLAB_ARCH"-9.5-23.2
else
mkdir -p "$PKGFILES"/mex/matlab/"$MATLAB_ARCH"-23.2
fi
if [[ $VERSION == *-unstable* ]]; then
echo "$SHA" > "$PKGFILES"/sha.txt
fi
cp -p "$ROOTDIR"/NEWS.md "$PKGFILES"
cp -p "$ROOTDIR"/COPYING "$PKGFILES"
cp -p "$ROOTDIR"/VERSION "$PKGFILES"
cp -p "$ROOTDIR"/license.txt "$PKGFILES"
cp -pr "$ROOTDIR"/matlab "$PKGFILES"
cp -p "$ROOTDIR"/build-matlab/dynare_version.m "$PKGFILES"/matlab
cp -pr "$ROOTDIR"/examples "$PKGFILES"
cp -p "$ROOTDIR"/preprocessor/src/dynare-preprocessor "$PKGFILES"/preprocessor
cp -p "$ROOTDIR"/build-matlab/preprocessor/src/dynare-preprocessor "$PKGFILES"/preprocessor
# Recreate backward-compatibility symlink
rm -f "$ROOTDIR"/matlab/preprocessor64/dynare_m
# Create backward-compatibility symlink
mkdir -p "$PKGFILES"/matlab/preprocessor64
ln -sf ../../preprocessor/dynare-preprocessor "$PKGFILES"/matlab/preprocessor64/dynare_m
cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES"/mex/matlab/maci64-8.3-9.3
if [[ "$PKG_ARCH" == x86_64 ]]; then
cp -L "$ROOTDIR"/build-matlab/*.mex"$MATLAB_ARCH" "$PKGFILES"/mex/matlab/"$MATLAB_ARCH"-9.5-23.2
else
cp -L "$ROOTDIR"/build-matlab/*.mex"$MATLAB_ARCH" "$PKGFILES"/mex/matlab/"$MATLAB_ARCH"-23.2
fi
cp -p "$ROOTDIR"/scripts/dynare.el "$PKGFILES"/scripts
cp -pr "$ROOTDIR"/contrib/ms-sbvar/TZcode/MatlabFiles "$PKGFILES"/contrib/ms-sbvar/TZcode
cp -pr "$ROOTDIR"/contrib/jsonlab "$PKGFILES"/contrib
cp "$ROOTDIR"/doc/*.pdf "$PKGFILES"/doc
cp "$ROOTDIR"/doc/gsa/gsa.pdf "$PKGFILES"/doc
cp "$ROOTDIR"/doc/parallel/parallel.pdf "$PKGFILES"/doc
cp "$ROOTDIR"/doc/dseries-and-reporting/dseriesReporting.pdf "$PKGFILES"/doc
cp "$ROOTDIR"/preprocessor/doc/preprocessor/preprocessor.pdf "$PKGFILES"/doc
cp "$ROOTDIR"/preprocessor/doc/macroprocessor/macroprocessor.pdf "$PKGFILES"/doc
cp "$ROOTDIR"/doc/manual/build/latex/dynare-manual.pdf "$PKGFILES"/doc
cp -r "$ROOTDIR"/doc/manual/build/html "$PKGFILES"/doc/dynare-manual.html
cp "$ROOTDIR"/build-doc/*.pdf "$PKGFILES"/doc
cp "$ROOTDIR"/build-doc/preprocessor/doc/*.pdf "$PKGFILES"/doc
cp -r "$ROOTDIR"/build-doc/dynare-manual.html "$PKGFILES"/doc
mkdir -p "$PKGFILES"/matlab/modules/dseries/externals/x13/macOS/64
cp -p "$ROOTDIR"/macOS/deps/lib64/x13as/x13as "$PKGFILES"/matlab/modules/dseries/externals/x13/macOS/64
mkdir -p "$PKGFILES"/matlab/dseries/externals/x13/macOS/64
cp -p "$ROOTDIR"/macOS/deps/"$PKG_ARCH"/lib64/x13as/x13as "$PKGFILES"/matlab/dseries/externals/x13/macOS/64
##
## Create mex for MATLAB ≥ 2018a
##
cd "$ROOTDIR"/mex/build/matlab
make clean
./configure \
PACKAGE_VERSION="$VERSION" \
PACKAGE_STRING="dynare $VERSION" \
CC=$CC \
CXX=$CXX \
CPPFLAGS=-I/usr/local/include \
LDFLAGS="-static-libgcc -L$QUADMATH_DIR" \
--with-gsl="$LIB64"/gsl \
--with-matio="$LIB64"/matio \
--with-slicot="$LIB64"/Slicot/with-underscore \
--with-matlab=/Applications/MATLAB_R2022b.app
make -j"$NTHREADS"
cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES"/mex/matlab/maci64-9.4-9.14
##
## Make package
##
cd "$ROOTDIR"/macOS/pkg
# Dynare option
pkgbuild --root "$PKGFILES" --identifier org.dynare --version "$VERSION" --install-location /Applications/Dynare/"$LOCATION" "$NAME".pkg
arch -"$PKG_ARCH" pkgbuild --root "$PKGFILES" --identifier org.dynare."$VERSION" --version "$VERSION" --install-location /Applications/Dynare/"$LOCATION" "$NAME".pkg
# GCC option
# Create dummy payload for GCC package; otherwise the size is displayed as 0 bytes in the installer
dd if=/dev/zero of="$ROOTDIR"/macOS/brewfiles/dummy bs=1m count=800
pkgbuild --root "$ROOTDIR"/macOS/brewfiles --identifier org.dynare.gcc --version "$VERSION" --scripts "$ROOTDIR"/macOS/scripts --install-location /Applications/Dynare/"$LOCATION" "$NAME"-gcc.pkg
# Create distribution.xml by replacing variables in distribution_template.xml
sed -e "s/VERSION_NO_SPACE/$VERSION/g" \
-e "s/LOCATION/$LOCATION/g" \
"$ROOTDIR"/macOS/distribution_template.xml > distribution.xml
# Replace variables in displayed files
sed "s/VERSION_READ/$VERSION/g" "$ROOTDIR"/macOS/distribution_template.xml > distribution_tmp.xml
sed "s/VERSION_NO_SPACE/$VERSION/g" distribution_tmp.xml > distribution.xml
sed "s/GCC_BINARY/$CC/g" "$ROOTDIR"/macOS/welcome_template.html > "$ROOTDIR"/macOS/welcome.html
sed "s/VERSION_NO_SPACE/$VERSION/g" "$ROOTDIR"/macOS/welcome.html > "$ROOTDIR"/macOS/welcome_tmp.html
sed "s/DATE/$DATELONG/g" "$ROOTDIR"/macOS/welcome_tmp.html > "$ROOTDIR"/macOS/welcome.html
# Create welcome.html by replacing variables in welcome_template.html
sed -e "s/VERSION_NO_SPACE/$VERSION/g" \
-e "s/DATE/$DATELONG/g" \
"$ROOTDIR"/macOS/welcome_template.html > "$ROOTDIR"/macOS/welcome.html
# Create conclusion.html by replacing variables in conclusion_template.html
sed -e "s/GCC_VERSION/$GCC_VERSION/g" \
"$ROOTDIR"/macOS/conclusion_template.html > "$ROOTDIR"/macOS/conclusion.html
# Create installer
productbuild --distribution distribution.xml --resources "$ROOTDIR"/macOS --package-path ./"$NAME".pkg "$NAME"-new.pkg
arch -"$PKG_ARCH" productbuild --distribution distribution.xml --resources "$ROOTDIR"/macOS --package-path ./"$NAME".pkg "$NAME"-productbuild.pkg
# cleanup
rm -f ./*.xml
# Cleanup
rm -f ./distribution.xml
rm -rf "$PKGFILES"
rm -f "$NAME"-gcc.pkg
rm -f "$ROOTDIR"/macOS/brewfiles/dummy
rm -f "$ROOTDIR"/macOS/welcome.html
rm -f "$ROOTDIR"/macOS/welcome_tmp.html
rm -f "$ROOTDIR"/macOS/conclusion.html
# Final pkg
mv "$NAME"-new.pkg "$NAME".pkg
mv "$NAME"-productbuild.pkg "$NAME".pkg

View File

@ -0,0 +1,45 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Recommendations</title>
<style>
.center-text {
text-align: center;
}
.bold-text {
font-weight: bold;
}
code {
font-family: "Courier New", Courier, monospace;
}
</style>
</head>
<body>
<header class="center-text">
<h1>Recommendations</h1>
</header>
<main>
<p class="bold-text">Xcode Command Line Tools</p>
<p>Dynare highly benefits from installing Xcode Command Line Tools (an Apple product). To install the Xcode Command Line Tools type the following into Terminal.app:</p>
<code>
xcode-select --install
</code>
<p class="bold-text">Compilation Environment for use_dll option</p>
<p>Dynare ships a compilation environment that can be used with the use_dll option. To install this environment correctly, the Xcode Command Line Tools are sufficient. Check this by running the following command in the MATLAB command window:</p>
<code>
mex -setup
</code>
<p>If you get a warning in MATLAB, that Xcode is installed, but its license has not been accepted, please refer to the <a href="https://www.dynare.org/manual/installation-and-configuration.html#prerequisites-on-macos" target="_blank" rel="noopener noreferrer">manual</a> for a workaround.</p>
<p>Moreover, we recommend making use of optimized compilation flags and for this you need to install GCC via Homebrew.
Follow <a href="https://brew.sh" target="_blank" rel="noopener noreferrer">https://brew.sh</a> to install Homebrew and then type the following into Terminal.app:</p>
<code>
brew install gcc@GCC_VERSION
</code>
<p>If you already have installed GCC, Dynare will automatically prefer it for use_dll if the binaries are either in /opt/homebrew/bin/gcc-GCC_VERSION (arm64) or in /usr/local/bin/gcc-GCC_VERSION (x86_64). Otherwise, it will fall back to Clang in /usr/bin/clang (for both arm64 and x86_64).</p>
</main>
</body>
</html>

View File

@ -1,4 +1,4 @@
# Copyright © 2019-2023 Dynare Team
# Copyright © 2019-2024 Dynare Team
#
# This file is part of Dynare.
#
@ -17,11 +17,19 @@
include versions.mk
GCC_VERSION = 13
# settings for different architectures
DEPS_ARCH ?= x86_64 # use x86_64 by default
BREWDIR := $(if $(filter arm64,$(DEPS_ARCH)),/opt/homebrew,/usr/local)
GCC_VERSION = $(shell sed -En "/^c[[:space:]]*=/s/c[[:space:]]*=[[:space:]]*'.*gcc-([0-9]+)'/\1/p" ../homebrew-native-$(DEPS_ARCH).ini)
ROOT_PATH = $(realpath .)
WGET_OPTIONS := --no-verbose --no-use-server-timestamps --retry-connrefused --retry-on-host-error
NTHREADS=$(shell sysctl -n hw.perflevel0.physicalcpu)
.PHONY: all build build-slicot build-x13as \
clean-lib clean-libslicot clean-x13as-bin \
clean-src clean-slicot-src clean-x13as-src \
@ -30,7 +38,7 @@ WGET_OPTIONS := --no-verbose --no-use-server-timestamps --retry-connrefused --re
all: build
build: build-slicot build-x13as ln-matio ln-gsl
build: build-slicot build-x13as
clean-lib: clean-libslicot clean-x13as-bin
@ -40,91 +48,35 @@ clean-tar: clean-slicot-tar clean-x13as-tar
clean-all: clean-lib clean-src clean-tar
#
# Matio & GSL
# (done to link only to static Matio and GSL libraries)
# Matio
lib64/matio/lib/libmatio.a: /usr/local/lib/libmatio.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/matio/lib/libhdf5.a: /usr/local/lib/libhdf5.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/matio/lib/libsz.a: /usr/local/lib/libsz.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/matio/include/matio.h: /usr/local/include/matio.h
mkdir -p $(dir $@) && cd $(dir $@).. && rm -rf include && ln -sf $(dir $<) .
ln-matio: lib64/matio/lib/libmatio.a \
lib64/matio/lib/libhdf5.a \
lib64/matio/lib/libsz.a \
lib64/matio/include/matio.h
clean-matio:
rm -rf lib64/matio
# GSL
lib64/gsl/lib/libgsl.a: /usr/local/lib/libgsl.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/gsl/lib/libgslcblas.a: /usr/local/lib/libgslcblas.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/gsl/include/gsl/gsl_blas.h: /usr/local/include/gsl/gsl_blas.h
mkdir -p $(dir $@) && cd $(dir $@).. && rm -rf gsl && ln -sf $(dir $<) .
ln-gsl: lib64/gsl/lib/libgsl.a \
lib64/gsl/lib/libgslcblas.a \
lib64/gsl/include/gsl/gsl_blas.h
clean-gsl:
rm -rf lib64/gsl
#
# Slicot
# slicot
#
tarballs/slicot-$(SLICOT_VERSION).tar.gz:
mkdir -p tarballs
wget $(WGET_OPTIONS) -O $@ https://deb.debian.org/debian/pool/main/s/slicot/slicot_$(SLICOT_VERSION).orig.tar.gz
wget $(WGET_OPTIONS) -O $@ https://deb.debian.org/debian/pool/main/s/slicot/slicot_$(SLICOT_VERSION).orig.tar.xz
sources64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz
rm -rf sources64/slicot-*-with-32bit-integer-and-underscore
$(DEPS_ARCH)/sources64/slicot-$(SLICOT_VERSION): tarballs/slicot-$(SLICOT_VERSION).tar.gz
rm -rf $(DEPS_ARCH)/sources64/slicot-*
mkdir -p $@
tar xf $< --directory $@ --strip-components=1
touch $@
sources64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz
rm -rf sources64/slicot-*-with-64bit-integer-and-underscore
mkdir -p $@
tar xf $< --directory $@ --strip-components=1
touch $@
lib64/Slicot/with-underscore/lib/libslicot_pic.a: sources64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore
make -C $< FORTRAN=gfortran LOADER=gfortran SLICOTLIB=../libslicot_pic.a OPTS="-O2 -g" lib
strip -S $</libslicot_pic.a
mkdir -p $(dir $@)
cp $</libslicot_pic.a $@
lib64/Slicot/with-underscore/lib/libslicot64_pic.a: sources64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore
make -C $< FORTRAN=gfortran LOADER=gfortran SLICOTLIB=../libslicot64_pic.a OPTS="-O2 -g -fdefault-integer-8" lib
$(DEPS_ARCH)/lib64/slicot/libslicot64_pic.a: $(DEPS_ARCH)/sources64/slicot-$(SLICOT_VERSION)
make -C $< -f makefile_Unix FORTRAN=$(BREWDIR)/bin/gfortran LOADER=$(BREWDIR)/bin/gfortran SLICOTLIB=../libslicot64_pic.a OPTS="-O3 -fdefault-integer-8" lib -j$(NTHREADS)
strip -S $</libslicot64_pic.a
mkdir -p $(dir $@)
cp $</libslicot64_pic.a $@
build-slicot: lib64/Slicot/with-underscore/lib/libslicot_pic.a \
lib64/Slicot/with-underscore/lib/libslicot64_pic.a
build-slicot: $(DEPS_ARCH)/lib64/slicot/libslicot64_pic.a
clean-slicot-tar:
rm -f tarballs/slicot-$(SLICOT_VERSION).tar.gz
clean-slicot-src:
rm -rf sources64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore
rm -rf $(DEPS_ARCH)/sources64/slicot-$(SLICOT_VERSION)
clean-libslicot:
rm -rf lib64/Slicot
rm -rf $(DEPS_ARCH)/lib64/slicot
clean-slicot-all: clean-slicot-src clean-slicot-tar clean-libslicot
@ -137,12 +89,12 @@ tarballs/x13as_asciisrc-v$(X13AS_VERSION).tar.gz:
mkdir -p tarballs
wget $(WGET_OPTIONS) -O $@ https://www2.census.gov/software/x-13arima-seats/x13as/unix-linux/program-archives/x13as_asciisrc-v$(X13AS_VERSION).tar.gz
sources64/x13as-$(X13AS_VERSION): tarballs/x13as_asciisrc-v$(X13AS_VERSION).tar.gz
rm -rf sources64/x13as-*
$(DEPS_ARCH)/sources64/x13as-$(X13AS_VERSION): tarballs/x13as_asciisrc-v$(X13AS_VERSION).tar.gz
rm -rf $(DEPS_ARCH)/sources64/x13as-*
mkdir -p $@
tar xf $< --directory $@
lib64/x13as/x13as: sources64/x13as-$(X13AS_VERSION)
$(DEPS_ARCH)/lib64/x13as/x13as: $(DEPS_ARCH)/sources64/x13as-$(X13AS_VERSION)
# Statically link x13as (see #1865).
# Using -static is not possible, it does not work under Darwin.
# Implement an ugly workaround in the absence of -static-libquadmath flag.
@ -153,20 +105,21 @@ lib64/x13as/x13as: sources64/x13as-$(X13AS_VERSION)
# gfortran as the linker with -static-libgfortran and
# -static-libquadmath flags, and drop the GCC_VERSION variable.
cd $< && sed -i '' 's/-static//g' makefile.gf
make -C $< -f makefile.gf FC=gfortran LINKER=gcc-$(GCC_VERSION) FFLAGS="-O2 -std=legacy" LDFLAGS=-static-libgcc LIBS="/usr/local/lib/gcc/current/libgfortran.a /usr/local/lib/gcc/current/libquadmath.a" PROGRAM=x13as
make -C $< -f makefile.gf FC=$(BREWDIR)/bin/gfortran LINKER=$(BREWDIR)/bin/gcc-$(GCC_VERSION) FFLAGS="-O3 -std=legacy" LDFLAGS=-static-libgcc LIBS="$(BREWDIR)/lib/gcc/$(GCC_VERSION)/libgfortran.a $(BREWDIR)/lib/gcc/$(GCC_VERSION)/libquadmath.a" PROGRAM=x13as -j$(NTHREADS)
strip $</x13as
mkdir -p $(dir $@)
cp $</x13as $@
build-x13as: lib64/x13as/x13as
build-x13as: $(DEPS_ARCH)/lib64/x13as/x13as
clean-x13as-tar:
rm -f tarballs/x13assrc_V$(X13AS_VERSION).tar.gz
rm -f tarballs/x13as_asciisrc-v$(X13AS_VERSION).tar.gz
clean-x13as-src:
rm -rf sources64/x13as-$(X13AS_VERSION)
rm -rf $(DEPS_ARCH)/sources64/x13as-$(X13AS_VERSION)
clean-x13as-bin:
rm -rf lib64/x13as
rm -rf $(DEPS_ARCH)/lib64/x13as
clean-x13as-all: clean-x13as-tar clean-x13as-src clean-x13as-bin

View File

@ -1,2 +1,2 @@
SLICOT_VERSION = 5.0+20101122
X13AS_VERSION = 1-1-b59
SLICOT_VERSION = 5.9~20240205.gita037f7e
X13AS_VERSION = 1-1-b60

View File

@ -1,22 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<installer-gui-script minSpecVersion="1">
<title>Dynare VERSION_READ</title>
<title>Dynare VERSION_NO_SPACE</title>
<background file="background.png" scaling="tofit" mime-type="image/png" alignment="topleft" />
<background-darkAqua file="background.png" scaling="tofit" mime-type="image/png" alignment="topleft" />
<welcome file="welcome.html" mime-type="text/html" />
<conclusion file="conclusion.html" mime-type="text/html" />
<license file="gpl-3.0-standalone.html" mime-type="text/html" />
<pkg-ref id="org.dynare" />
<options customize="allow" require-scripts="false" hostArchitectures="x86_64" />
<domains enable_anywhere="false" enable_currentUserHome="true" enable_localSystem="false"/> <!-- on enable_currentUserHome="true" does not require admin rights! enable_localSystem="true" or enable_anywhere="true" requires admin rights by default, even though this can be changed in the installer though under Change Installation. -->
<pkg-ref id="default" />
<options customize="allow" require-scripts="false" hostArchitectures="x86_64,arm64" />
<choices-outline>
<line choice="org.dynare" />
<line choice="org.dynare.gcc" />
<line choice="default" />
</choices-outline>
<choice id="org.dynare" title="Dynare" description="Dynare Required Files" start_enabled="false" enabled="false">
<pkg-ref id="org.dynare" />
</choice>
<choice id="org.dynare.gcc" title="GCC for `use_dll`" description="This is necessary for the use of Dynare with the `use_dll` option. NB: This takes a few minutes and requires an active internet connection.">
<pkg-ref id="org.dynare.gcc" />
</choice>
<pkg-ref id="org.dynare" version="VERSION_NO_SPACE">dynare-VERSION_NO_SPACE.pkg</pkg-ref>
<pkg-ref id="org.dynare.gcc" version="VERSION_NO_SPACE">dynare-VERSION_NO_SPACE-gcc.pkg</pkg-ref>
</installer-gui-script>
<choice id="default" title="Dynare" description="Dynare Required Files" start_enabled="false" enabled="false" customLocation="/Applications/Dynare/LOCATION">
<pkg-ref id="org.dynare.VERSION_NO_SPACE" />
</choice>
<pkg-ref id="org.dynare.VERSION_NO_SPACE" version="VERSION_NO_SPACE">dynare-VERSION_NO_SPACE.pkg</pkg-ref>
</installer-gui-script>

View File

@ -0,0 +1,15 @@
# Meson native file for compiling under Homebrew for arm64 architecture
[binaries]
cpp = '/opt/homebrew/bin/g++-13'
c = '/opt/homebrew/bin/gcc-13'
flex = '/opt/homebrew/opt/flex/bin/flex'
bison = '/opt/homebrew/opt/bison/bin/bison'
[built-in options]
cpp_args = [ '-I/opt/homebrew/include', '-B', '/opt/homebrew/lib' ]
# XCode 15 (on Ventura and Sonoma) has a linker issue, see https://github.com/mesonbuild/meson/issues/12282, workaround is to use ld_classic
cpp_link_args = [ '-Wl,-ld_classic' ]
c_link_args = [ '-Wl,-ld_classic' ]
fortran_link_args = [ '-Wl,-ld_classic' ]
#fortran_args = [ '-B', '/Users/sebastien/slicot' ]

View File

@ -0,0 +1,15 @@
# Meson native file for compiling under Homebrew for x86_64 architecture
[binaries]
cpp = '/usr/local/bin/g++-13'
c = '/usr/local/bin/gcc-13'
flex = '/usr/local/opt/flex/bin/flex'
bison = '/usr/local/opt/bison/bin/bison'
[built-in options]
cpp_args = [ '-I/usr/local/include', '-B', '/usr/local/lib' ]
# XCode 15 (on Ventura and Sonoma) has a linker issue, see https://github.com/mesonbuild/meson/issues/12282, workaround is to use ld_classic
cpp_link_args = [ '-Wl,-ld_classic' ]
c_link_args = [ '-Wl,-ld_classic' ]
fortran_link_args = [ '-Wl,-ld_classic' ]
#fortran_args = [ '-B', '/Users/sebastien/slicot' ]

View File

@ -1,96 +0,0 @@
#!/usr/bin/env bash
# Copyright © 2019-2021 Dynare Team
#
# This file is part of Dynare.
#
# Dynare is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Dynare is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Dynare. If not, see <https://www.gnu.org/licenses/>.
set -ex
set -o errexit
readonly LOG_FILE="$2"/install.log
sudo touch "$LOG_FILE"
exec 1>"$LOG_FILE"
exec 2>&1
# Remove dummy payload
rm -f "$2"/dummy
# Test for Internet connection
if ! curl -s -m 4 https://github.com >/dev/null; then
osascript -e 'display alert "Dynare Installation Error" message "Not able to connect to github.com. Either you are not connected to the internet or github.com is blocked where you are.\n\nAccess to GitHub is necessary to make Dynare work with the `use_dll` option on macOS.\n\nIf you cannot establish this connection or do not want to use the `use_dll` option of Dynare, please run the installer again and choose \"Customize\" from the \"Installation Type\" screen and uncheck the `GCC` option." as critical'
echo "No internet connection to github.com"
exit 1
fi
# Install Command Line Tools
# Checking that “xcode-select -print-path” returns a valid path is not enough, because
# the contents of that directory might have been removed (this is the official way of
# uninstalling CLT, see https://developer.apple.com/library/archive/technotes/tn2339/_index.html#//apple_ref/doc/uid/DTS40014588-CH1-HOW_CAN_I_UNINSTALL_THE_COMMAND_LINE_TOOLS_)
# Hence we also check that the directory contains the git binary.
if ! xcpath=$(/usr/bin/xcode-select -print-path) || [[ ! -x "$xcpath"/usr/bin/git ]]; then
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
SUC=$(softwareupdate -l |
grep "\*.*Command Line" |
grep -m1 "" |
awk -F"*" '{print $2}' |
sed -e 's/^ *//' |
tr -d '\n')
# On macOS 10.15 softwareupdate output is preceded by "Label: "
[[ $SUC == Label:* ]] && SUC=${SUC#"Label: "}
softwareupdate -i "$SUC" --verbose
rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
softwareupdate -l
fi
# If CLT installation didn't work, exit
if ! xcpath=$(/usr/bin/xcode-select -print-path) || [[ ! -x "$xcpath"/usr/bin/git ]]; then
osascript -e 'display alert "Dynare Installation Error" message "Not able to find Command Line Tools.\n\nCommand Line Tools is necessary to make Dynare work with the `use_dll` option on macOS.\n\nIf you cannot establish this connection or do not want to use the `use_dll` option of Dynare, please run the installer again and choose \"Customize\" from the \"Installation Type\" screen and uncheck the `GCC` option." as critical'
echo "Command Line Tools not installed"
exit 1
fi
# Ensure git is in the path
if ! which git >/dev/null; then
osascript -e 'display alert "Dynare Installation Error" message "Not able to find Git even though the Command Line Tools have already been installed. This is likely a problem with your PATH environment variable.\n\nGit is necessary to make Dynare work with the `use_dll` option on macOS.\n\nIf you cannot establish this connection or do not want to use the `use_dll` option of Dynare, please run the installer again and choose \"Customize\" from the \"Installation Type\" screen and uncheck the `GCC` option." as critical'
echo $PATH
echo "Git not found in PATH"
exit 1
fi
# Install Homebrew
BREWDIR="$2"/.brew
[ -d "$BREWDIR" ] || mkdir -p "$BREWDIR"
BREW_URL="https://github.com/Homebrew/brew"
BREW_BRANCH="master"
curl -\# -L "$BREW_URL"/tarball/"$BREW_BRANCH" | tar xz -m --strip 1 -C "$BREWDIR"
# Change ownership of Dynare directory
chown -R "$USER":staff "$2"
sudo -u "$USER" "$BREWDIR"/bin/brew tap homebrew/core
HOMEBREW_CACHE="$HOME"/Library/Caches/Homebrew-Dynare
HOMEBREW_NO_AUTO_UPDATE=1
[[ -z "${HOMEBREW_NO_ANALYTICS}" ]] && HOMEBREW_NO_ANALYTICS=1
# Move modified formulas to Homebrew Formula directory
mv "$2"/*.rb "$BREWDIR"/Library/Taps/homebrew/homebrew-core/Formula
# Install GCC & deps
sudo -u "$USER" "$BREWDIR"/bin/brew install gcc -v --force-bottle
exit 0

View File

@ -1,15 +1,37 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Dynare Installer</title>
<style>
.center-text {
text-align: center;
}
.bold-text {
font-weight: bold;
}
code {
font-family: "Courier New", Courier, monospace;
}
</style>
</head>
<body>
<h3 style="text-align: center;">Welcome to Dynare</h3>
<p style="text-align: center;">Version VERSION_NO_SPACE</p>
<p style="text-align: center;">DATE</p>
<header class="center-text">
<h1>Welcome to Dynare</h1>
<p>Version VERSION_NO_SPACE</p>
<p>DATE</p>
</header>
<p><b>Just a few things to note</b>. This installation can be customized as you can choose not to install the GNU Compiler Collection (GCC). Installing GCC is necessary if you want to use the <tt>use_dll</tt> option in Dynare, but otherwise unnecessary.</p>
<main>
<p>Thank you for choosing Dynare!</p>
<p>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'.</p>
<p>By default Dynare will be installed into /Applications/Dynare. To modify the installation path, click <strong>Customize</strong> after accepting the license. Then, under <strong>Location</strong>, select your desired folder.</p>
<p>Installing into /Applications/Dynare might fail if you have older versions of Dynare installed in /Applications/Dynare. To fix this, modify the ownership by executing the following command in Terminal.app:</p>
<code>
sudo chown -R "$USER":staff /Applications/Dynare
</code>
</main>
<p>To install GCC we run a script that first installs the XCode Command Line Tools (an Apple product). The script then installs Homebrew, a package manager for macOS and, finally, GCC itself. Both Homebrew and GCC will be installed in your Dynare installation folder. So, when you delete this folder, they too will be deleted.</p>
<p>Installing GCC will require an active internet connection with the ability to connect to the Apple servers and GitHub. The installation will take anywhere from a few minutes to a half an hour during the <i>Running package scripts</i> phase of Installation. The time it takes depends on your internet speed, the speed of your computer, and whether or not you already have XCode Command Line Tools installed. The progress bar will not advance during this phase. Please be patient.</p>
<p> You can choose not to install GCC by choosing <i>Customize</i> from the <i>Installation Type</i> screen and deselecting <i>GCC compiler</i>. If you already have <tt>GCC_BINARY</tt> installed under <tt>/usr/local</tt>, you can forgo the installation of GCC here as Dynare will find your system compiler when you use <tt>use_dll</tt>.</p>
</body>
</html>
</html>

View File

@ -1,5 +1,5 @@
function write(DynareModel)
function write(M_)
% write(M_)
% Writes the nonlinear problem to be solved for computing the growth
% rates and levels along the Balanced Growth Path. Note that for
% the variables growing along the BGP, the identified levels are
@ -7,7 +7,7 @@ function write(DynareModel)
% sharing the same trend(s) are relevant.
%
% INPUTS
% - DynareModel [struct] Dynare generated stucture describing the model (M_).
% - M_ [struct] Dynare generated stucture describing the model (M_).
%
% OUTPUTS
% None
@ -15,7 +15,7 @@ function write(DynareModel)
% REMARKS
% - The trends are assumed to be multiplicative.
% Copyright © 2019 Dynare Team
% Copyright © 2019-2023 Dynare Team
%
% This file is part of Dynare.
%
@ -32,18 +32,18 @@ function write(DynareModel)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
if DynareModel.maximum_lag && ~DynareModel.maximum_lead
i0 = transpose(DynareModel.lead_lag_incidence(1,:)); % Indices of the lagged variables.
i1 = transpose(DynareModel.lead_lag_incidence(2,:)); % Indices of the current variables.
if M_.maximum_lag && ~M_.maximum_lead
i0 = transpose(M_.lead_lag_incidence(1,:)); % Indices of the lagged variables.
i1 = transpose(M_.lead_lag_incidence(2,:)); % Indices of the current variables.
i2 = []; % Indices of the leaded variables.
elseif DynareModel.maximum_lag && DynareModel.maximum_lead
i0 = transpose(DynareModel.lead_lag_incidence(1,:)); % Indices of the lagged variables.
i1 = transpose(DynareModel.lead_lag_incidence(2,:)); % Indices of the current variables.
i2 = transpose(DynareModel.lead_lag_incidence(3,:)); % Indices of the leaded variables.
elseif ~DynareModel.maximum_lag && DynareModel.maximum_lead
elseif M_.maximum_lag && M_.maximum_lead
i0 = transpose(M_.lead_lag_incidence(1,:)); % Indices of the lagged variables.
i1 = transpose(M_.lead_lag_incidence(2,:)); % Indices of the current variables.
i2 = transpose(M_.lead_lag_incidence(3,:)); % Indices of the leaded variables.
elseif ~M_.maximum_lag && M_.maximum_lead
i0 = []; % Indices of the lagged variables.
i1 = transpose(DynareModel.lead_lag_incidence(1,:)); % Indices of the current variables.
i2 = transpose(DynareModel.lead_lag_incidence(2,:)); % Indices of the leaded variables.
i1 = transpose(M_.lead_lag_incidence(1,:)); % Indices of the current variables.
i2 = transpose(M_.lead_lag_incidence(2,:)); % Indices of the leaded variables.
else
error('The model is static. The BGP is trivial.')
end
@ -71,7 +71,7 @@ else
end
% Create function in mod namespace.
fid = fopen(sprintf('+%s/bgpfun.m', DynareModel.fname), 'w');
fid = fopen(sprintf('+%s/bgpfun.m', M_.fname), 'w');
% Write header.
fprintf(fid, 'function [F, JAC] = bgpfun(z)\n\n');
@ -80,8 +80,8 @@ fprintf(fid, '%% This file has been generated by dynare (%s).\n\n', datestr(now)
% The function admits a unique vector as input argument. The first
% half of the elements are for the levels of the endogenous
% variables, the second half for the growth factors.
fprintf(fid, 'y = z(1:%u);\n\n', DynareModel.endo_nbr);
fprintf(fid, 'g = z(%u:%u);\n', DynareModel.endo_nbr+1, 2*DynareModel.endo_nbr);
fprintf(fid, 'y = z(1:%u);\n\n', M_.endo_nbr);
fprintf(fid, 'g = z(%u:%u);\n', M_.endo_nbr+1, 2*M_.endo_nbr);
% Define the point where the dynamic model is to be evaluated.
fprintf(fid, 'Y = zeros(%u, 1);\n', 2*(n0+n1+n2));
@ -118,39 +118,39 @@ end
fprintf(fid, '\n');
% Define the vector of parameters.
fprintf(fid, 'p = zeros(%u, 1);\n', DynareModel.param_nbr);
for i = 1:DynareModel.param_nbr
fprintf(fid, 'p(%u) = %16.12f;\n', i, DynareModel.params(i));
fprintf(fid, 'p = zeros(%u, 1);\n', M_.param_nbr);
for i = 1:M_.param_nbr
fprintf(fid, 'p(%u) = %16.12f;\n', i, M_.params(i));
end
fprintf(fid, '\n');
% Initialize the vector holding the residuals over the two periods.
fprintf(fid, 'F = NaN(%u, 1);\n', 2*DynareModel.endo_nbr);
fprintf(fid, 'F = NaN(%u, 1);\n', 2*M_.endo_nbr);
% Set vector of exogenous variables to 0.
fprintf(fid, 'x = zeros(1, %u);\n\n', DynareModel.exo_nbr);
fprintf(fid, 'x = zeros(1, %u);\n\n', M_.exo_nbr);
% Evaluate the residuals and jacobian of the dynamic model in periods t and t+1.
fprintf(fid, 'if nargout>1\n');
fprintf(fid, ' J = zeros(%u, %u);\n', 2*DynareModel.endo_nbr, n0+n1+n2+DynareModel.endo_nbr);
fprintf(fid, ' [F(1:%u), tmp] = %s.dynamic(Y(1:%u), x, p, y, 1);\n', DynareModel.endo_nbr, DynareModel.fname, n0+n1+n2);
fprintf(fid, ' J(1:%u,1:%u) = tmp(:,1:%u);\n', DynareModel.endo_nbr, n0+n1+n2, n0+n1+n2);
fprintf(fid, ' [F(%u:%u), tmp] = %s.dynamic(Y(1+%u:%u), x, p, y, 1);\n', DynareModel.endo_nbr+1, 2*DynareModel.endo_nbr, DynareModel.fname, n0+n1+n2, 2*(n0+n1+n2));
fprintf(fid, ' J(%u:%u,1:%u) = tmp(:,1:%u);\n', DynareModel.endo_nbr+1, 2*DynareModel.endo_nbr, n0+n1+n2, n0+n1+n2);
fprintf(fid, ' J = zeros(%u, %u);\n', 2*M_.endo_nbr, n0+n1+n2+M_.endo_nbr);
fprintf(fid, ' [F(1:%u), tmp] = %s.dynamic(Y(1:%u), x, p, y, 1);\n', M_.endo_nbr, M_.fname, n0+n1+n2);
fprintf(fid, ' J(1:%u,1:%u) = tmp(:,1:%u);\n', M_.endo_nbr, n0+n1+n2, n0+n1+n2);
fprintf(fid, ' [F(%u:%u), tmp] = %s.dynamic(Y(1+%u:%u), x, p, y, 1);\n', M_.endo_nbr+1, 2*M_.endo_nbr, M_.fname, n0+n1+n2, 2*(n0+n1+n2));
fprintf(fid, ' J(%u:%u,1:%u) = tmp(:,1:%u);\n', M_.endo_nbr+1, 2*M_.endo_nbr, n0+n1+n2, n0+n1+n2);
fprintf(fid, 'else\n');
fprintf(fid, ' F(1:%u) = %s.dynamic(Y(1:%u), x, p, y, 1);\n', DynareModel.endo_nbr, DynareModel.fname, n0+n1+n2);
fprintf(fid, ' F(%u:%u) = %s.dynamic(Y(1+%u:%u), x, p, y, 1);\n', DynareModel.endo_nbr+1, 2*DynareModel.endo_nbr, DynareModel.fname, n0+n1+n2, 2*(n0+n1+n2));
fprintf(fid, ' F(1:%u) = %s.dynamic(Y(1:%u), x, p, y, 1);\n', M_.endo_nbr, M_.fname, n0+n1+n2);
fprintf(fid, ' F(%u:%u) = %s.dynamic(Y(1+%u:%u), x, p, y, 1);\n', M_.endo_nbr+1, 2*M_.endo_nbr, M_.fname, n0+n1+n2, 2*(n0+n1+n2));
fprintf(fid, 'end\n\n');
% Compute the jacobian if required.
fprintf(fid, 'if nargout>1\n');
fprintf(fid, ' JAC = zeros(%u,%u);\n', 2*DynareModel.endo_nbr, 2*DynareModel.endo_nbr);
fprintf(fid, ' JAC = zeros(%u,%u);\n', 2*M_.endo_nbr, 2*M_.endo_nbr);
% Compute the derivatives of the first block of equations (period t)
% with respect to the endogenous variables.
if purely_backward_model || purely_forward_model
for i=1:DynareModel.eq_nbr
for j=1:DynareModel.endo_nbr
for i=1:M_.eq_nbr
for j=1:M_.endo_nbr
if I1(j)
if I0(j)
fprintf(fid, ' JAC(%u,%u) = J(%u,%u)+J(%u,%u)*g(%u);\n', i, j, i, I0(j), i, I1(j), j);
@ -165,8 +165,8 @@ if purely_backward_model || purely_forward_model
end
end
else
for i=1:DynareModel.eq_nbr
for j=1:DynareModel.endo_nbr
for i=1:M_.eq_nbr
for j=1:M_.endo_nbr
if I2(j)
if I1(j)
if I0(j)
@ -201,8 +201,8 @@ end
% Compute the derivatives of the second block of equations (period t+1)
% with respect to the endogenous variables.
if purely_backward_model || purely_forward_model
for i=DynareModel.eq_nbr+1:2*DynareModel.eq_nbr
for j=1:DynareModel.endo_nbr
for i=M_.eq_nbr+1:2*M_.eq_nbr
for j=1:M_.endo_nbr
if I1(j)
if I0(j)
fprintf(fid, ' JAC(%u,%u) = J(%u,%u)*g(%u)+J(%u,%u)*g(%u)*g(%u);\n', i, j, i, I0(j), j, i, I1(j), j, j);
@ -217,8 +217,8 @@ if purely_backward_model || purely_forward_model
end
end
else
for i=DynareModel.eq_nbr+1:2*DynareModel.eq_nbr
for j=1:DynareModel.endo_nbr
for i=M_.eq_nbr+1:2*M_.eq_nbr
for j=1:M_.endo_nbr
if I2(j)
if I1(j)
if I0(j)
@ -253,16 +253,16 @@ end
% Compute the derivatives of the first block of equations (period t)
% with respect to the growth factors.
if purely_backward_model || purely_forward_model
for i=1:DynareModel.eq_nbr
for j=1:DynareModel.endo_nbr
for i=1:M_.eq_nbr
for j=1:M_.endo_nbr
if I1(j)
fprintf(fid, ' J(%u,%u) = J(%u,%u)*y(%u);\n', i, n0+n1+n2+j, i, I1(j), j);
end
end
end
else
for i=1:DynareModel.eq_nbr
for j=1:DynareModel.endo_nbr
for i=1:M_.eq_nbr
for j=1:M_.endo_nbr
if I2(j)
if I1(j)
fprintf(fid, ' J(%u,%u) = J(%u,%u)*y(%u)+J(%u,%u)*2*g(%u)*y(%u);\n', i, n0+n1+n2+j, i, I1(j), j, i, I2(j), j, j);
@ -281,8 +281,8 @@ end
% Compute the derivatives of the second block of equations (period t+1)
% with respect to the endogenous variables.
if purely_backward_model || purely_forward_model
for i=DynareModel.eq_nbr+1:2*DynareModel.eq_nbr
for j=1:DynareModel.endo_nbr
for i=M_.eq_nbr+1:2*M_.eq_nbr
for j=1:M_.endo_nbr
if I0(j)
fprintf(fid, ' J(%u,%u) = J(%u,%u)+J(%u,%u)*y(%u);\n', i, n0+n1+n2+j, i, n0+n1+n2+j, i, I0(j), j);
end
@ -292,8 +292,8 @@ if purely_backward_model || purely_forward_model
end
end
else
for i=DynareModel.eq_nbr+1:2*DynareModel.eq_nbr
for j=1:DynareModel.endo_nbr
for i=M_.eq_nbr+1:2*M_.eq_nbr
for j=1:M_.endo_nbr
if I2(j)
if I1(j)
if I0(j)
@ -325,7 +325,7 @@ else
end
end
fprintf(fid, ' JAC(:,%u:%u) = J(:,%u:%u);\n', DynareModel.endo_nbr+1, 2*DynareModel.endo_nbr, n0+n1+n2+1, n0+n1+n2+DynareModel.endo_nbr);
fprintf(fid, ' JAC(:,%u:%u) = J(:,%u:%u);\n', M_.endo_nbr+1, 2*M_.endo_nbr, n0+n1+n2+1, n0+n1+n2+M_.endo_nbr);
fprintf(fid,'end\n');
fclose(fid);

View File

@ -1,5 +1,5 @@
function bvar_density(maxnlags)
% function bvar_density(maxnlags)
function density(maxnlags)
% function density(maxnlags)
% computes the density of a bayesian var
%
% INPUTS
@ -12,7 +12,7 @@ function bvar_density(maxnlags)
% none
% Copyright © 2003-2007 Christopher Sims
% Copyright © 2007-2017 Dynare Team
% Copyright © 2007-2023 Dynare Team
%
% This file is part of Dynare.
%
@ -34,7 +34,7 @@ global oo_
oo_.bvar.log_marginal_data_density=NaN(maxnlags,1);
for nlags = 1:maxnlags
[ny, nx, posterior, prior] = bvar_toolbox(nlags);
[ny, ~, posterior, prior] = bvar.toolbox(nlags);
oo_.bvar.posterior{nlags}=posterior;
oo_.bvar.prior{nlags}=prior;
@ -75,8 +75,8 @@ function w = matrictint(S, df, XXi)
k=size(XXi,1);
ny=size(S,1);
[cx,p]=chol(XXi);
[cs,q]=chol(S);
[cx,p] = chol(XXi); %second output required to prevent error
[cs,p] = chol(S); %second output required to prevent error
if any(diag(cx)<100*eps)
error('singular XXi')

View File

@ -1,5 +1,5 @@
function bvar_forecast(nlags)
% function bvar_forecast(nlags)
function forecast(nlags)
% function forecast(nlags)
% builds forecats for a bvar model
%
% INPUTS
@ -11,7 +11,7 @@ function bvar_forecast(nlags)
% SPECIAL REQUIREMENTS
% none
% Copyright © 2007-2017 Dynare Team
% Copyright © 2007-2023 Dynare Team
%
% This file is part of Dynare.
%
@ -31,9 +31,9 @@ function bvar_forecast(nlags)
global options_ oo_ M_
if options_.forecast == 0
error('bvar_forecast: you must specify "forecast" option')
error('bvar.forecast: you must specify "forecast" option')
end
[ny, nx, posterior, prior, forecast_data] = bvar_toolbox(nlags);
[ny, nx, posterior, ~, forecast_data] = bvar.toolbox(nlags);
sims_no_shock = NaN(options_.forecast, ny, options_.bvar_replic);
sims_with_shocks = NaN(options_.forecast, ny, options_.bvar_replic);
@ -95,7 +95,7 @@ end
if p > 0
skipline()
disp(['Some of the VAR models sampled from the posterior distribution'])
disp('Some of the VAR models sampled from the posterior distribution')
disp(['were found to be explosive (' num2str(p/options_.bvar_replic) ' percent).'])
skipline()
end
@ -116,10 +116,10 @@ sims_with_shocks_up_conf = sims_with_shocks_sort(:, :, sort_idx(2));
OutputDirectoryName = CheckPath('graphs',M_.dname);
dyn_graph=dynare_graph_init(sprintf('BVAR forecasts (nlags = %d)', nlags), ny, {'b-' 'g-' 'g-' 'r-' 'r-'});
dyn_graph=bvar.graph_init(sprintf('BVAR forecasts (nlags = %d)', nlags), ny, {'b-' 'g-' 'g-' 'r-' 'r-'});
for i = 1:ny
dyn_graph=dynare_graph(dyn_graph,[ sims_no_shock_median(:, i) ...
dyn_graph=plot_graph(dyn_graph,[ sims_no_shock_median(:, i) ...
sims_no_shock_up_conf(:, i) sims_no_shock_down_conf(:, i) ...
sims_with_shocks_up_conf(:, i) sims_with_shocks_down_conf(:, i) ], ...
options_.varobs{i});
@ -154,8 +154,8 @@ end
% Store results
DirectoryName = [ M_.dname '/bvar_forecast' ];
if ~isdir(DirectoryName)
if ~isdir(M_.dname)
if ~isfolder(DirectoryName)
if ~isfolder(M_.dname)
mkdir(M_.dname);
end
mkdir(DirectoryName);
@ -166,20 +166,48 @@ for i = 1:length(options_.varobs)
name = options_.varobs{i};
sims = squeeze(sims_with_shocks(:,i,:));
eval(['oo_.bvar.forecast.with_shocks.Mean.' name ' = mean(sims, 2);']);
eval(['oo_.bvar.forecast.with_shocks.Median.' name ' = median(sims, 2);']);
eval(['oo_.bvar.forecast.with_shocks.Var.' name ' = var(sims, 0, 2);']);
eval(['oo_.bvar.forecast.with_shocks.HPDsup.' name ' = sims_with_shocks_up_conf(:,i);']);
eval(['oo_.bvar.forecast.with_shocks.HPDinf.' name ' = sims_with_shocks_down_conf(:,i);']);
oo_.bvar.forecast.with_shocks.Mean.(name) = mean(sims, 2);
oo_.bvar.forecast.with_shocks.Median.(name) = median(sims, 2);
oo_.bvar.forecast.with_shocks.Var.(name) = var(sims, 0, 2);
oo_.bvar.forecast.with_shocks.HPDsup.(name) = sims_with_shocks_up_conf(:,i);
oo_.bvar.forecast.with_shocks.HPDinf.(name) = sims_with_shocks_down_conf(:,i);
sims = squeeze(sims_no_shock(:,i,:));
eval(['oo_.bvar.forecast.no_shock.Mean.' name ' = sims_no_shock_mean(:,i);']);
eval(['oo_.bvar.forecast.no_shock.Median.' name ' = sims_no_shock_median(:,i);']);
eval(['oo_.bvar.forecast.no_shock.Var.' name ' = var(sims, 0, 2);']);
eval(['oo_.bvar.forecast.no_shock.HPDsup.' name ' = sims_no_shock_up_conf(:,i);']);
eval(['oo_.bvar.forecast.no_shock.HPDinf.' name ' = sims_no_shock_down_conf(:,i);']);
oo_.bvar.forecast.no_shock.Mean.(name) = sims_no_shock_mean(:,i);
oo_.bvar.forecast.no_shock.Median.(name) = sims_no_shock_median(:,i);
oo_.bvar.forecast.no_shock.Var.(name) = var(sims, 0, 2);
oo_.bvar.forecast.no_shock.HPDsup.(name) = sims_no_shock_up_conf(:,i);
oo_.bvar.forecast.no_shock.HPDinf.(name) = sims_no_shock_down_conf(:,i);
if exist('rmse')
eval(['oo_.bvar.forecast.rmse.' name ' = rmse(i);']);
if exist('rmse','var')
oo_.bvar.forecast.rmse.(name) = rmse(i);
end
end
function dyn_graph=plot_graph(dyn_graph,y,tit,x)
% function plot_graph(dyn_graph, y,tit,x)
if nargin < 4
x = (1:size(y,1))';
end
nplot = dyn_graph.plot_nbr + 1;
if nplot > dyn_graph.max_nplot
figure('Name',dyn_graph.figure_name);
nplot = 1;
end
dyn_graph.plot_nbr = nplot;
subplot(dyn_graph.nr,dyn_graph.nc,nplot);
line_types = dyn_graph.line_types;
line_type = line_types{1};
for i=1:size(y,2)
if length(line_types) > 1
line_type = line_types{i};
end
plot(x,y(:,i),line_type);
hold on
end
title(tit);
hold off

View File

@ -1,5 +1,5 @@
function dyn_graph=dynare_graph_init(figure_name,nplot,line_types,line_width)
% function dynare_graph_init(figure_name,colors)
function dyn_graph=graph_init(figure_name,nplot,line_types,line_width)
% function graph_init(figure_name,colors)
% initializes set of graphs
%
% INPUTS:
@ -12,7 +12,7 @@ function dyn_graph=dynare_graph_init(figure_name,nplot,line_types,line_width)
% SPECIAL REQUIREMENT
% none
% Copyright © 2006-2017 Dynare Team
% Copyright © 2006-2023 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -1,5 +1,6 @@
function bvar_irf(nlags,identification)
% builds IRFs for a bvar model
function irf(nlags,identification)
% function irf(nlags,identification)
% builds IRFs for a BVAR model
%
% INPUTS
% nlags [integer] number of lags for the bvar
@ -11,7 +12,7 @@ function bvar_irf(nlags,identification)
% SPECIAL REQUIREMENTS
% none
% Copyright © 2007-2017 Dynare Team
% Copyright © 2007-2023 Dynare Team
%
% This file is part of Dynare.
%
@ -34,7 +35,7 @@ if nargin==1
identification = 'Cholesky';
end
[ny, nx, posterior, prior] = bvar_toolbox(nlags);
[ny, nx, posterior] = bvar.toolbox(nlags);
S_inv_upper_chol = chol(inv(posterior.S));
@ -77,12 +78,14 @@ for draw=1:options_.bvar_replic
StructuralMat = Sigma_lower_chol;
elseif strcmpi(identification,'SquareRoot')
StructuralMat = sqrtm(Sigma);
else
error('Unknown identification option. Valid choices are ''Cholesky'' and ''SquareRoot''.')
end
% Build the IRFs...
lags_data = zeros(ny,ny*nlags) ;
sampled_irfs(:,:,1,draw) = Sigma_lower_chol ;
lags_data(:,1:ny) = Sigma_lower_chol ;
sampled_irfs(:,:,1,draw) = StructuralMat ;
lags_data(:,1:ny) = StructuralMat ;
for t=2:options_.irf
sampled_irfs(:,:,t,draw) = lags_data(:,:)*Phi(1:ny*nlags,:) ;
lags_data(:,ny+1:end) = lags_data(:,1:end-ny) ;
@ -93,7 +96,7 @@ end
if p > 0
skipline()
disp(['Some of the VAR models sampled from the posterior distribution'])
disp('Some of the VAR models sampled from the posterior distribution')
disp(['were found to be explosive (' int2str(p) ' samples).'])
skipline()
end
@ -127,7 +130,7 @@ end
% Save intermediate results
DirectoryName = [ M_.dname '/bvar_irf' ];
if ~isdir(DirectoryName)
if ~isfolder(DirectoryName)
mkdir('.',DirectoryName);
end
save([ DirectoryName '/simulations.mat'], 'sampled_irfs');
@ -137,10 +140,10 @@ for i=1:ny
shock_name = options_.varobs{i};
for j=1:ny
variable_name = options_.varobs{j};
eval(['oo_.bvar.irf.Mean.' variable_name '.' shock_name ' = posterior_mean_irfs(' int2str(j) ',' int2str(i) ',:);'])
eval(['oo_.bvar.irf.Median.' variable_name '.' shock_name ' = posterior_median_irfs(' int2str(j) ',' int2str(i) ',:);'])
eval(['oo_.bvar.irf.Var.' variable_name '.' shock_name ' = posterior_variance_irfs(' int2str(j) ',' int2str(i) ',:);'])
eval(['oo_.bvar.irf.Upper_bound.' variable_name '.' shock_name ' = posterior_up_conf_irfs(' int2str(j) ',' int2str(i) ',:);'])
eval(['oo_.bvar.irf.Lower_bound.' variable_name '.' shock_name ' = posterior_down_conf_irfs(' int2str(j) ',' int2str(i) ',:);'])
oo_.bvar.irf.Mean.(variable_name).(shock_name) = posterior_mean_irfs(j,i,:);
oo_.bvar.irf.Median.(variable_name).(shock_name) = posterior_median_irfs(j,i,:);
oo_.bvar.irf.Var.(variable_name).(shock_name) = posterior_variance_irfs(j,i,:);
oo_.bvar.irf.Upper_bound.(variable_name).(shock_name) = posterior_up_conf_irfs(j,i,:);
oo_.bvar.irf.Lower_bound.(variable_name).(shock_name) = posterior_down_conf_irfs(j,i,:);
end
end
end

View File

@ -1,5 +1,5 @@
function [ny, nx, posterior, prior, forecast_data] = bvar_toolbox(nlags)
%function [ny, nx, posterior, prior, forecast_data] = bvar_toolbox(nlags)
function [ny, nx, posterior, prior, forecast_data] = toolbox(nlags)
%function [ny, nx, posterior, prior, forecast_data] = toolbox(nlags)
% bvar_toolbox Routines shared between BVAR methods
% Computes several things for the estimations of a BVAR(nlags)
%
@ -42,7 +42,7 @@ function [ny, nx, posterior, prior, forecast_data] = bvar_toolbox(nlags)
% - bvar_prior_{tau,decay,lambda,mu,omega,flat,train}
% Copyright © 2003-2007 Christopher Sims
% Copyright © 2007-2017 Dynare Team
% Copyright © 2007-2023 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -1,5 +1,5 @@
function [forcs, e] = mcforecast3(cL, H, mcValue, shocks, forcs, T, R, mv, mu)
function [forcs, e] = get_shock_paths(cL, H, mcValue, shocks, forcs, T, R, mv, mu)
% [forcs, e] = get_shock_paths(cL, H, mcValue, shocks, forcs, T, R, mv, mu)
% Computes the shock values for constrained forecasts necessary to keep
% endogenous variables at their constrained paths
%

View File

@ -1,4 +1,5 @@
function plot_icforecast(Variables,periods,options_,oo_)
function plot(Variables,periods,options_,oo_)
% plot(Variables,periods,options_,oo_)
% Build plots for the conditional forecasts.
%
% INPUTS
@ -11,9 +12,9 @@ function plot_icforecast(Variables,periods,options_,oo_)
% None.
%
% SPECIAL REQUIREMENTS
% This routine has to be called after imcforecast.m.
% This routine has to be called after conditional_forecasts.run
% Copyright © 2006-2019 Dynare Team
% Copyright © 2006-2023 Dynare Team
%
% This file is part of Dynare.
%
@ -44,7 +45,7 @@ else
end
if periods>forecast_periods
fprintf('\nplot_icforecast:: Number of periods for plotting exceeds forecast horizon. Setting periods to %d.\n',forecast_periods-1)
fprintf('\nconditional_forecasts.plot:: Number of periods for plotting exceeds forecast horizon. Setting periods to %d.\n',forecast_periods-1)
periods=forecast_periods;
end
@ -59,7 +60,7 @@ for i=1:length(Variables)
end
function build_figure(name,cci1,cci2,mm1,mm2,options_,graphoptions)
hh = dyn_figure(options_.nodisplay,'Name',['Conditional forecast (' graphoptions.title ,'): ' name '.']);
hh_fig = dyn_figure(options_.nodisplay,'Name',['Conditional forecast (' graphoptions.title ,'): ' name '.']);
H = length(mm1);
h1 = area(1:H,cci1(2,1:H),'BaseValue',min([min(cci1(1,:)),min(cci2(1,:))]),'FaceColor',[.9 .9 .9]);
hold on
@ -70,4 +71,4 @@ plot(1:H,cci2(1,:),'--k','linewidth',1)
plot(1:H,cci2(2,:),'--k','linewidth',1)
axis tight
hold off
dyn_saveas(hh,[graphoptions.OutputDirectoryName '/Conditional_forecast_',strrep(deblank(graphoptions.title),' ','_'),'_',name],options_.nodisplay,options_.graph_format)
dyn_saveas(hh_fig,[graphoptions.OutputDirectoryName '/Conditional_forecast_',strrep(deblank(graphoptions.title),' ','_'),'_',name],options_.nodisplay,options_.graph_format)

View File

@ -1,11 +1,16 @@
function imcforecast(constrained_paths, constrained_vars, options_cond_fcst)
function forecasts=run(M_,options_,oo_,bayestopt_,estim_params_,constrained_paths, constrained_vars, options_cond_fcst)
% run(constrained_paths, constrained_vars, options_cond_fcst)
% Computes conditional forecasts.
%
% INPUTS
% - constrained_paths [double] m*p array, where m is the number of constrained endogenous variables and p is the number of constrained periods.
% - constrained_vars [integer] m*1 array, indices in M_.endo_names of the constrained variables.
% - options_cond_fcst [structure] containing the options. The fields are:
% M_ [structure] describing the model
% options_ [structure] describing the options
% oo_: [structure] storing the results
% bayestopt_ [structure] describing the priors
% estim_params_ [structure] characterizing parameters to be estimated
% - constrained_paths [double] m*p array, where m is the number of constrained endogenous variables and p is the number of constrained periods.
% - constrained_vars [integer] m*1 array, indices in M_.endo_names of the constrained variables.
% - options_cond_fcst [structure] containing the options. The fields are:
%
% + replic [integer] scalar, number of monte carlo simulations.
% + parameter_set [char] values of the estimated parameters:
@ -19,16 +24,16 @@ function imcforecast(constrained_paths, constrained_vars, options_cond_fcst)
% + conf_sig [double] scalar in [0,1], probability mass covered by the confidence bands.
%
% OUTPUTS
% None.
% - forecasts [structure] results of the conditional forecast exercise
%
% SPECIAL REQUIREMENTS
% This routine has to be called after an estimation statement or an estimated_params block.
%
% REMARKS
% [1] Results are stored in oo_.conditional_forecast.
% [2] Use the function plot_icforecast to plot the results.
% [2] Use the function conditional_forecasts.plot to plot the results.
% Copyright © 2006-2020 Dynare Team
% Copyright © 2006-2023 Dynare Team
%
% This file is part of Dynare.
%
@ -45,8 +50,6 @@ function imcforecast(constrained_paths, constrained_vars, options_cond_fcst)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
global options_ oo_ M_ bayestopt_ estim_params_
if ~isfield(options_cond_fcst,'parameter_set') || isempty(options_cond_fcst.parameter_set)
if isfield(oo_,'posterior_mode')
options_cond_fcst.parameter_set = 'posterior_mode';
@ -123,10 +126,9 @@ if estimated_model
missing_value = dataset_info.missing.state;
%store qz_criterium
qz_criterium_old=options_.qz_criterium;
options_=select_qz_criterium_value(options_);
options_smoothed_state_uncertainty_old = options_.smoothed_state_uncertainty;
[atT, ~, ~, ~,ys, ~, ~, ~, ~, ~, ~, ~, ~, ~,M_,oo_,bayestopt_] = ...
[atT, ~, ~, ~,ys, ~, ~, ~, ~, ~, ~, ~, ~, ~,oo_,bayestopt_] = ...
DsgeSmoother(xparam, gend, data, data_index, missing_value, M_, oo_, options_, bayestopt_, estim_params_);
options_.smoothed_state_uncertainty = options_smoothed_state_uncertainty_old;
%get constant part
@ -155,7 +157,6 @@ if estimated_model
trend = constant(oo_.dr.order_var,:);
InitState(:,1) = atT(:,end);
else
qz_criterium_old=options_.qz_criterium;
if isempty(options_.qz_criterium)
options_.qz_criterium = 1+1e-6;
end
@ -171,7 +172,7 @@ if options_.logged_steady_state %if steady state was previously logged, undo thi
options_.logged_steady_state=0;
end
[T, R, ys, ~, M_, oo_] = dynare_resolve(M_, options_, oo_);
[T, R, ys, ~, oo_.dr,M_.params] = dynare_resolve(M_, options_, oo_.dr,oo_.steady_state,oo_.exo_steady_state,oo_.exo_det_steady_state);
if options_.loglinear && isfield(oo_.dr,'ys') && options_.logged_steady_state==0 %log steady state
oo_.dr.ys=log_variable(1:M_.endo_nbr,oo_.dr.ys,M_);
@ -246,7 +247,7 @@ FORCS1_shocks = zeros(n1,cL,options_cond_fcst.replic);
for b=1:options_cond_fcst.replic %conditional forecast using cL set to constrained values
shocks = sQ*randn(ExoSize,options_cond_fcst.periods);
shocks(controlled_varexo,:) = zeros(n1, options_cond_fcst.periods);
[FORCS1(:,:,b), FORCS1_shocks(:,:,b)] = mcforecast3(cL,options_cond_fcst.periods,constrained_paths,shocks,FORCS1(:,:,b),T,R,mv, mu);
[FORCS1(:,:,b), FORCS1_shocks(:,:,b)] = conditional_forecasts.get_shock_paths(cL,options_cond_fcst.periods,constrained_paths,shocks,FORCS1(:,:,b),T,R,mv, mu);
FORCS1(:,:,b)=FORCS1(:,:,b)+trend; %add trend
end
if max(max(max(abs(bsxfun(@minus,FORCS1(constrained_vars,1+1:1+cL,:),trend(constrained_vars,1:cL)+constrained_paths)))))>1e-4
@ -292,7 +293,7 @@ FORCS2(:,1,:) = repmat(InitState,1,options_cond_fcst.replic); %set initial stead
for b=1:options_cond_fcst.replic %conditional forecast using cL set to 0
shocks = sQ*randn(ExoSize,options_cond_fcst.periods);
shocks(controlled_varexo,:) = zeros(n1, options_cond_fcst.periods);
FORCS2(:,:,b) = mcforecast3(0,options_cond_fcst.periods,constrained_paths,shocks,FORCS2(:,:,b),T,R,mv, mu)+trend;
FORCS2(:,:,b) = conditional_forecasts.get_shock_paths(0,options_cond_fcst.periods,constrained_paths,shocks,FORCS2(:,:,b),T,R,mv, mu)+trend;
end
mFORCS2 = mean(FORCS2,3);
@ -307,8 +308,4 @@ for i = 1:EndoSize
forecasts.uncond.ci.(M_.endo_names{oo_.dr.order_var(i)}) = [tmp(t1,:)' ,tmp(t2,:)' ]';
end
forecasts.graph.title = graph_title;
forecasts.graph.fname = M_.fname;
%reset qz_criterium
options_.qz_criterium=qz_criterium_old;
oo_.conditional_forecast = forecasts;
forecasts.graph.fname = M_.fname;

View File

@ -28,7 +28,7 @@ function nls(eqname, params, data, range, optimizer, varargin)
% equation must have NaN values in the object.
% [4] It is assumed that the residual is additive.
% Copyright © 2021-2022 Dynare Team
% Copyright © 2021-2023 Dynare Team
%
% This file is part of Dynare.
%
@ -179,12 +179,6 @@ write_residuals_routine(lhs, rhs, eqname, ipnames_, M_);
% Create a routine for evaluating the sum of squared residuals of the nonlinear model
write_ssr_routine(lhs, rhs, eqname, ipnames_, M_);
% Workaround for Octave bug https://savannah.gnu.org/bugs/?46282
% Octave will randomly fail to read the ssr_* file generated in the +folder
if isoctave && octave_ver_less_than('7')
path(path)
end
% Create a function handle returning the sum of square residuals for a given vector of parameters.
ssrfun = @(p) feval([M_.fname '.ssr_' eqname], p, DATA, M_, oo_);
@ -298,23 +292,23 @@ end
%
if is_gauss_newton
[params1, SSR, exitflag] = gauss_newton(resfun, params0);
[params1, SSR] = gauss_newton(resfun, params0);
elseif is_lsqnonlin
if ismember('levenberg-marquardt', varargin)
% Levenberg Marquardt does not handle boundary constraints.
[params1, SSR, ~, exitflag] = lsqnonlin(resfun, params0, [], [], optimset(varargin{:}));
[params1, SSR] = lsqnonlin(resfun, params0, [], [], optimset(varargin{:}));
else
[params1, SSR, ~, exitflag] = lsqnonlin(resfun, params0, bounds(:,1), bounds(:,2), optimset(varargin{:}));
[params1, SSR] = lsqnonlin(resfun, params0, bounds(:,1), bounds(:,2), optimset(varargin{:}));
end
else
% Estimate the parameters by minimizing the sum of squared residuals.
[params1, SSR, exitflag] = dynare_minimize_objective(ssrfun, params0, ...
minalgo, ...
options_, ...
bounds, ...
parameter_names, ...
[], ...
[]);
[params1, SSR] = dynare_minimize_objective(ssrfun, params0, ...
minalgo, ...
options_, ...
bounds, ...
parameter_names, ...
[], ...
[]);
end
% Revert local modifications to the options.

View File

@ -6,20 +6,20 @@ function [SAmeas, OutMatrix] = Morris_Measure_Groups(NumFact, Sample, Output, p,
% INPUTS
% -------------------------------------------------------------------------
% Group [NumFactor, NumGroups] := Matrix describing the groups.
% Each column represents one group.
% The element of each column are zero if the factor is not in the
% group. Otherwise it is 1.
% Each column represents one group.
% The element of each column are zero if the factor is not in the
% group. Otherwise it is 1.
%
% Sample := Matrix of the Morris sampled trajectories
%
% Output := Matrix of the output(s) values in correspondence of each point
% of each trajectory
% of each trajectory
%
% k = Number of factors
% -------------------------------------------------------------------------
% OUTPUTS
% OutMatrix (NumFactor*NumOutputs, 3)= [Mu*, Mu, StDev]
% for each output it gives the three measures of each factor
% for each output it gives the three measures of each factor
% -------------------------------------------------------------------------
%
% Written by Jessica Cariboni and Francesca Campolongo
@ -27,7 +27,7 @@ function [SAmeas, OutMatrix] = Morris_Measure_Groups(NumFact, Sample, Output, p,
%
% Copyright © 2005 European Commission
% Copyright © 2012-2017 Dynare Team
% Copyright © 2012-2023 Dynare Team
%
% This file is part of Dynare.
%
@ -50,32 +50,34 @@ if nargin==0
return
end
OutMatrix=[];
if nargin < 5, Group=[]; end
NumGroups = size(Group,2);
if nargin < 4 | isempty(p)
if nargin < 4 || isempty(p)
p = 4;
end
Delt = p/(2*p-2);
if NumGroups ~ 0
if NumGroups ~= 0
sizea = NumGroups; % Number of groups
GroupMat=Group;
GroupMat = GroupMat';
else
sizea = NumFact;
end
r=size(Sample,1)/(sizea+1); % Number of trajectories
if NumGroups > 0
OutMatrix = NaN(sizea*size(Output,2),1);
else
OutMatrix = NaN(sizea*size(Output,2),3);
end
% For Each Output
for k=1:size(Output,2)
OutValues=Output(:,k);
% For each r trajectory
for i=1:r
% For each step j in the trajectory
% Read the orientation matrix fact for the r-th sampling
% Read the corresponding output values
@ -86,13 +88,11 @@ for k=1:size(Output,2)
% For each point of the fixed trajectory compute the values of the Morris function. The function
% is partitioned in four parts, from order zero to order 4th.
% SAmeas=NaN();
for j=1:sizea % For each point in the trajectory i.e for each factor
% matrix of factor which changes
if NumGroups ~ 0
if NumGroups ~= 0
AuxFind (:,1) = A(:,j);
% AuxFind(find(A(:,j)),1)=1;
% Pippo = sum((Group - repmat(AuxFind,1,NumGroups)),1);
% Change_factor(j,i) = find(Pippo==0);
Change_factor = find(abs(AuxFind)>1e-010);
% If we deal with groups we can only estimate the new mu*
% measure since factors in the same groups can move in
@ -100,7 +100,6 @@ for k=1:size(Output,2)
% Morris mu cannopt be applied.
% In the new version the elementary effect is defined with
% the absolute value.
%SAmeas(find(GroupMat(Change_factor(j,i),:)),i) = abs((Single_OutValues(j) - Single_OutValues(j+1) )/Delt); %(2/3));
SAmeas(i,Change_factor') = abs((Single_OutValues(j) - Single_OutValues(j+1) )/Delt);
else
Change_factor(j,i) = find(Single_Sample(j+1,:)-Single_Sample(j,:));
@ -116,12 +115,17 @@ for k=1:size(Output,2)
end %for i=1:r
if NumGroups ~ 0
if NumGroups ~= 0
SAmeas = SAmeas';
end
% Compute Mu AbsMu and StDev
if any(any(isnan(SAmeas)))
AbsMu=NaN(NumFact,1);
if NumGroups == 0
Mu=NaN(NumFact,1);
StDev=NaN(NumFact,1);
end
for j=1:NumFact
SAm = SAmeas(j,:);
SAm = SAm(find(~isnan(SAm)));
@ -143,8 +147,8 @@ for k=1:size(Output,2)
% Define the output Matrix - if we have groups we cannot define the old
% measure mu, only mu* makes sense
if NumGroups > 0
OutMatrix = [OutMatrix; AbsMu];
OutMatrix((k-1)*sizea+1:k*sizea,:) = AbsMu;
else
OutMatrix = [OutMatrix; AbsMu, Mu, StDev];
OutMatrix((k-1)*sizea+1:k*sizea,:) = [AbsMu, Mu, StDev];
end
end % For Each Output

View File

@ -1,6 +1,7 @@
function [Outmatrix, OutFact] = Sampling_Function_2(p, k, r, UB, LB, GroupMat)
%[Outmatrix, OutFact] = Sampling_Function_2(p, k, r, UB, LB, GroupMat)
% Inputs: k (1,1) := number of factors examined or number of groups examined.
% Inputs:
% k (1,1) := number of factors examined or number of groups examined.
% In case the groups are chosen the number of factors is stores in NumFact and
% sizea becomes the number of created groups.
% NumFact (1,1) := number of factors examined in the case when groups are chosen
@ -13,7 +14,7 @@ function [Outmatrix, OutFact] = Sampling_Function_2(p, k, r, UB, LB, GroupMat)
% are set to 1 in correspondence of the factors that belong to the fixed group. All
% the other elements are zero.
% Local Variables:
% sizeb (1,1) := sizea+1
% sizeb (1,1) := sizea+1
% sizec (1,1) := 1
% randmult (sizea,1) := vector of random +1 and -1
% perm_e(1,sizea) := vector of sizea random permutated indeces
@ -34,7 +35,8 @@ function [Outmatrix, OutFact] = Sampling_Function_2(p, k, r, UB, LB, GroupMat)
% AuxMat(sizeb,sizea) := Delta*0.5*((2*B - A) * DD0 + A) in Morris, 1991. The AuxMat is used as in Morris design
% for single factor analysis, while it constitutes an intermediate step for the group analysis.
%
% Output: Outmatrix(sizeb*r, sizea) := for the entire sample size computed In(i,j) matrices
% Outputs:
% Outmatrix(sizeb*r, sizea) := for the entire sample size computed In(i,j) matrices
% OutFact(sizea*r,1) := for the entire sample size computed Fact(i,1) vectors
%
% Note: B0 is constructed as in Morris design when groups are not considered. When groups are considered the routine
@ -56,7 +58,7 @@ function [Outmatrix, OutFact] = Sampling_Function_2(p, k, r, UB, LB, GroupMat)
%
% Copyright © 2005 European Commission
% Copyright © 2012-2017 Dynare Team
% Copyright © 2012-2023 Dynare Team
%
% This file is part of Dynare.
%
@ -80,25 +82,23 @@ Delta = p/(2*p-2);
NumFact = sizea;
GroupNumber = size(GroupMat,2);
if GroupNumber ~ 0;
if GroupNumber ~= 0
sizea = size(GroupMat,2);
end
sizeb = sizea + 1;
sizec = 1;
Outmatrix = [];
OutFact = [];
% For each i generate a trajectory
for i=1:r
% Construct DD0 - OLD VERSION - it does not need communication toolbox
% RAND(N,M) is an NXM matrix with random entries, chosen from a uniform distribution on the interval (0.0,1.0).
% Note that DD0 tells if the factor have to be increased or ddecreased
% by Delta.
randmult = ones(k,1);
v = rand(k,1);
randmult (find(v < 0.5))=-1;
randmult (v < 0.5)=-1;
randmult = repmat(randmult,1,k);
DD0 = randmult .* eye(k);
@ -133,7 +133,7 @@ for i=1:r
% When groups are present the random permutation is done only on B. The effect is the same since
% the added part (A0*x0') is completely random.
if GroupNumber ~ 0
if GroupNumber ~= 0
B = B * (GroupMat*P0')';
end
@ -147,7 +147,7 @@ for i=1:r
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% a --> Define the random vector x0 for the factors. Note that x0 takes value in the hypercube
% [0,...,1-Delta]*[0,...,1-Delta]*[0,...,1-Delta]*[0,...,1-Delta]
MyInt = repmat([0:(1/(p-1)):(1-Delta)],NumFact,1); % Construct all possible values of the factors
MyInt = repmat(0:(1/(p-1)):(1-Delta),NumFact,1); % Construct all possible values of the factors
% OLD VERSION - it needs communication toolbox
% w = randint(NumFact,1,[1,size(MyInt,2)]);
@ -158,9 +158,9 @@ for i=1:r
% 3) check in which interval the random numbers fall
% 4) generate the corresponding integer
v = repmat(rand(NumFact,1),1,size(MyInt,2)+1); % 1)
IntUsed = repmat([0:1/size(MyInt,2):1],NumFact,1); % 2)
IntUsed = repmat(0:1/size(MyInt,2):1,NumFact,1); % 2)
DiffAuxVec = IntUsed - v; % 3)
w=NaN(1,size(DiffAuxVec,1));
for ii = 1:size(DiffAuxVec,1)
w(1,ii) = max(find(DiffAuxVec(ii,:)<0)); % 4)
end
@ -168,7 +168,7 @@ for i=1:r
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% b --> Compute the matrix B*, here indicated as B0. Each row in B0 is a
% trajectory for Morris Calculations. The dimension of B0 is (Numfactors+1,Numfactors)
if GroupNumber ~ 0
if GroupNumber ~= 0
B0 = (A0*x0' + AuxMat);
else
B0 = (A0*x0' + AuxMat)*P0;
@ -183,6 +183,7 @@ for i=1:r
% Create the Factor vector. Each component of this vector indicate which factor or group of factor
% has been changed in each step of the trajectory.
Fact=NaN(1,sizea);
for j=1:sizea
Fact(1,j) = find(P0(j,:));
end
@ -190,5 +191,4 @@ for i=1:r
Outmatrix = [Outmatrix; In];
OutFact = [OutFact; Fact'];
end

View File

@ -1,10 +1,8 @@
function sout = boxplot (data,notched,symbol,vertical,maxwhisker)
% sout = boxplot (data,notched,symbol,vertical,maxwhisker)
% Creates a box plot
function sout = myboxplot (data,notched,symbol,vertical,maxwhisker)
% sout = myboxplot (data,notched,symbol,vertical,maxwhisker)
%
% Copyright © 2010-2017 Dynare Team
% Copyright © 2010-2023 Dynare Team
%
% This file is part of Dynare.
%
@ -21,7 +19,6 @@ function sout = myboxplot (data,notched,symbol,vertical,maxwhisker)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
% % % % endif
if nargin < 5 || isempty(maxwhisker), maxwhisker = 1.5; end
if nargin < 4 || isempty(vertical), vertical = 1; end
if nargin < 3 || isempty(symbol), symbol = ['+','o']; end
@ -32,7 +29,7 @@ if length(symbol)==1, symbol(2)=symbol(1); end
if notched==1, notched=0.25; end
a=1-notched;
% ## figure out how many data sets we have
% % figure out how many data sets we have
if iscell(data)
nc = length(data);
else
@ -40,11 +37,11 @@ else
nc = size(data,2);
end
% ## compute statistics
% ## s will contain
% ## 1,5 min and max
% ## 2,3,4 1st, 2nd and 3rd quartile
% ## 6,7 lower and upper confidence intervals for median
% compute statistics
% s will contain
% 1,5 min and max
% 2,3,4 1st, 2nd and 3rd quartile
% 6,7 lower and upper confidence intervals for median
s = zeros(7,nc);
box = zeros(1,nc);
whisker_x = ones(2,1)*[1:nc,1:nc];
@ -55,44 +52,36 @@ outliers2_x = [];
outliers2_y = [];
for i=1:nc
% ## Get the next data set from the array or cell array
% Get the next data set from the array or cell array
if iscell(data)
col = data{i}(:);
else
col = data(:,i);
end
% ## Skip missing data
% Skip missing data
% % % % % % % col(isnan(col) | isna (col)) = [];
col(isnan(col)) = [];
% ## Remember the data length
% Remember the data length
nd = length(col);
box(i) = nd;
if (nd > 1)
% ## min,max and quartiles
% s(1:5,i) = statistics(col)(1:5);
% min,max and quartiles
s(1,i)=min(col);
s(5,i)=max(col);
s(2,i)=myprctilecol(col,25);
s(3,i)=myprctilecol(col,50);
s(4,i)=myprctilecol(col,75);
% ## confidence interval for the median
% confidence interval for the median
est = 1.57*(s(4,i)-s(2,i))/sqrt(nd);
s(6,i) = max([s(3,i)-est, s(2,i)]);
s(7,i) = min([s(3,i)+est, s(4,i)]);
% ## whiskers out to the last point within the desired inter-quartile range
% whiskers out to the last point within the desired inter-quartile range
IQR = maxwhisker*(s(4,i)-s(2,i));
whisker_y(:,i) = [min(col(col >= s(2,i)-IQR)); s(2,i)];
whisker_y(:,nc+i) = [max(col(col <= s(4,i)+IQR)); s(4,i)];
% ## outliers beyond 1 and 2 inter-quartile ranges
% outliers beyond 1 and 2 inter-quartile ranges
outliers = col((col < s(2,i)-IQR & col >= s(2,i)-2*IQR) | (col > s(4,i)+IQR & col <= s(4,i)+2*IQR));
outliers2 = col(col < s(2,i)-2*IQR | col > s(4,i)+2*IQR);
outliers_x = [outliers_x; i*ones(size(outliers))];
@ -100,41 +89,37 @@ for i=1:nc
outliers2_x = [outliers2_x; i*ones(size(outliers2))];
outliers2_y = [outliers2_y; outliers2];
elseif (nd == 1)
% ## all statistics collapse to the value of the point
% all statistics collapse to the value of the point
s(:,i) = col;
% ## single point data sets are plotted as outliers.
% single point data sets are plotted as outliers.
outliers_x = [outliers_x; i];
outliers_y = [outliers_y; col];
else
% ## no statistics if no points
% no statistics if no points
s(:,i) = NaN;
end
end
% % % % if isempty(outliers2_y)
% % % % outliers2_y=
% ## Note which boxes don't have enough stats
% Note which boxes don't have enough stats
chop = find(box <= 1);
% ## Draw a box around the quartiles, with width proportional to the number of
% ## items in the box. Draw notches if desired.
% Draw a box around the quartiles, with width proportional to the number of
% items in the box. Draw notches if desired.
box = box*0.23/max(box);
quartile_x = ones(11,1)*[1:nc] + [-a;-1;-1;1;1;a;1;1;-1;-1;-a]*box;
quartile_y = s([3,7,4,4,7,3,6,2,2,6,3],:);
% ## Draw a line through the median
% Draw a line through the median
median_x = ones(2,1)*[1:nc] + [-a;+a]*box;
% median_x=median(col);
median_y = s([3,3],:);
% ## Chop all boxes which don't have enough stats
% Chop all boxes which don't have enough stats
quartile_x(:,chop) = [];
quartile_y(:,chop) = [];
whisker_x(:,[chop,chop+nc]) = [];
whisker_y(:,[chop,chop+nc]) = [];
median_x(:,chop) = [];
median_y(:,chop) = [];
% % % %
% ## Add caps to the remaining whiskers
% Add caps to the remaining whiskers
cap_x = whisker_x;
cap_x(1,:) =cap_x(1,:)- 0.05;
cap_x(2,:) =cap_x(2,:)+ 0.05;
@ -144,12 +129,14 @@ cap_y = whisker_y([1,1],:);
% #whisker_x,whisker_y
% #median_x,median_y
% #cap_x,cap_y
%
% ## Do the plot
% Do the plot
mm=min(min(data));
MM=max(max(data));
if isnan(mm), mm=0; MM=0; end
if isnan(mm)
mm=0;
MM=0;
end
if vertical
plot (quartile_x, quartile_y, 'b', ...
@ -161,17 +148,30 @@ if vertical
set(gca,'XTick',1:nc);
set(gca, 'XLim', [0.5, nc+0.5]);
set(gca, 'YLim', [mm-(MM-mm)*0.05-eps, MM+(MM-mm)*0.05+eps]);
else
% % % % % plot (quartile_y, quartile_x, "b;;",
% % % % % whisker_y, whisker_x, "b;;",
% % % % % cap_y, cap_x, "b;;",
% % % % % median_y, median_x, "r;;",
% % % % % outliers_y, outliers_x, [symbol(1),"r;;"],
% % % % % outliers2_y, outliers2_x, [symbol(2),"r;;"]);
end
if nargout
sout=s;
end
% % % endfunction
function y = myprctilecol(x,p)
xx = sort(x);
[m,n] = size(x);
if m==1 | n==1
m = max(m,n);
if m == 1
y = x*ones(length(p),1);
return
end
n = 1;
q = 100*(0.5:m - 0.5)./m;
xx = [min(x); xx(:); max(x)];
else
q = 100*(0.5:m - 0.5)./m;
xx = [min(x); xx; max(x)];
end
q = [0 q 100];
y = interp1(q,xx,p);

View File

@ -1,5 +1,10 @@
function h = cumplot(x)
%function h =cumplot(x)
% Inputs:
% - x [double] data series
%
% Outputs:
% - h [handle] figure handle
% Written by Marco Ratto
% Joint Research Centre, The European Commission,
@ -26,9 +31,5 @@ function h = cumplot(x)
n=length(x);
x=[-inf; sort(x); Inf];
y=[0:n n]./n;
h0 = stairs(x,y);
grid on,
if nargout
h=h0;
end
h = stairs(x,y);
grid on

View File

@ -1,4 +1,29 @@
function [yy, xdir, isig, lam]=log_trans_(y0,xdir0,isig,lam)
function [yy, xdir, isig, lam]=log_transform(y0,xdir0,isig,lam)
% [yy, xdir, isig, lam]=log_transform(y0,xdir0,isig,lam)
% Conduct automatic log transformation lam(yy/isig+lam)
% Inputs:
% - y0 [double] series to transform
% - xdir [char] string indating the type of transformation:
% - log: standard log transformation
% - minuslog: log of minus (y0)
% - logsquared: log of y0^2
% - logskew: log of y0 shifted by lam
% - isig [double] scaling factor for y0
% - lam [double] shifting for y0
%
% Outputs:
% - yy [double] transformed series
% - xdir [char] string indating the type of transformation:
% - log: standard log transformation
% - minuslog: log of minus (y0)
% - logsquared: log of y0^2
% - logskew: log of y0 shifted by lam
% - isig [double] scaling factor for y0
% - lam [double] shifting for y0
%
% Notes: takes either one or four arguments. For one argument, the log
% transformation is conducted. For four arguments, the inverse
% transformation is applied.
% Written by Marco Ratto
% Joint Research Centre, The European Commission,
@ -31,14 +56,18 @@ end
if nargin==1
xdir0='';
end
f=@(lam,y)gsa_skewness(log(y+lam));
f=@(lam,y)gsa.skewness(log(y+lam));
isig=1;
if ~(max(y0)<0 | min(y0)>0)
if gsa_skewness(y0)<0,
if ~(max(y0)<0 || min(y0)>0)
if gsa.skewness(y0)<0
isig=-1;
y0=-y0;
end
n=hist(y0,10);
if isoctave
n=hist(y0,10);
else
n=histcounts(y0,10);
end
if n(1)>20*n(end)
try
lam=fzero(f,[-min(y0)+10*eps -min(y0)+abs(median(y0))],[],y0);
@ -48,7 +77,7 @@ if ~(max(y0)<0 | min(y0)>0)
if abs(yl(1))<abs(yl(2))
lam=-min(y0)+eps;
else
lam = -min(y0)+abs(median(y0)); %abs(100*(1+min(y0)));
lam = -min(y0)+abs(median(y0));
end
end
yy = log(y0+lam);
@ -63,10 +92,8 @@ else
if max(y0)<0
isig=-1;
y0=-y0;
%yy=log(-y0);
xdir=[xdir0,'_minuslog'];
elseif min(y0)>0
%yy=log(y0);
xdir=[xdir0,'_log'];
end
try
@ -77,7 +104,7 @@ else
if abs(yl(1))<abs(yl(2))
lam=-min(y0)+eps;
else
lam = -min(y0)+abs(median(y0)); %abs(100*(1+min(y0)));
lam = -min(y0)+abs(median(y0));
end
end
lam = max(lam,0);

View File

@ -1,11 +1,19 @@
function map_calibration(OutputDirectoryName, Model, DynareOptions, DynareResults, EstimatedParameters, BayesInfo)
function map_calibration(OutputDirectoryName, M_, options_, oo_, estim_params_, bayestopt_)
% map_calibration(OutputDirectoryName, M_, options_, oo_, estim_params_, bayestopt_)
% Inputs:
% - OutputDirectoryName [string] name of the output directory
% - M_ [structure] describing the model
% - options_ [structure] describing the options
% - oo_ [structure] storing the results
% - estim_params_ [structure] characterizing parameters to be estimated
% - bayestopt_ [structure] describing the priors
%
% Written by Marco Ratto
% Joint Research Centre, The European Commission,
% marco.ratto@ec.europa.eu
% Copyright © 2014-2016 European Commission
% Copyright © 2014-2018 Dynare Team
% Copyright © 2014-2023 Dynare Team
%
% This file is part of Dynare.
%
@ -22,33 +30,32 @@ function map_calibration(OutputDirectoryName, Model, DynareOptions, DynareResult
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
fname_ = Model.fname;
fname_ = M_.fname;
np = EstimatedParameters.np;
nshock = EstimatedParameters.nvx + EstimatedParameters.nvn + EstimatedParameters.ncx + EstimatedParameters.ncn;
np = estim_params_.np;
nshock = estim_params_.nvx + estim_params_.nvn + estim_params_.ncx + estim_params_.ncn;
pnames=cell(np,1);
pnames_tex=cell(np,1);
for jj=1:np
if DynareOptions.TeX
[param_name_temp, param_name_tex_temp]= get_the_name(nshock+jj, DynareOptions.TeX, Model, EstimatedParameters, DynareOptions);
pnames_tex{jj,1} = strrep(param_name_tex_temp,'$','');
if options_.TeX
[param_name_temp, param_name_tex_temp]= get_the_name(nshock+jj, options_.TeX, M_, estim_params_, options_.varobs);
pnames_tex{jj,1} = param_name_tex_temp;
pnames{jj,1} = param_name_temp;
else
param_name_temp = get_the_name(nshock+jj, DynareOptions.TeX, Model, EstimatedParameters, DynareOptions);
param_name_temp = get_the_name(nshock+jj, options_.TeX, M_, estim_params_, options_.varobs);
pnames{jj,1} = param_name_temp;
end
end
pvalue_ks = DynareOptions.opt_gsa.pvalue_ks;
indx_irf = [];
indx_moment = [];
init = ~DynareOptions.opt_gsa.load_stab;
init = ~options_.opt_gsa.load_stab;
options_mcf.pvalue_ks = DynareOptions.opt_gsa.pvalue_ks;
options_mcf.pvalue_corr = DynareOptions.opt_gsa.pvalue_corr;
options_mcf.alpha2 = DynareOptions.opt_gsa.alpha2_stab;
options_mcf.pvalue_ks = options_.opt_gsa.pvalue_ks;
options_mcf.pvalue_corr = options_.opt_gsa.pvalue_corr;
options_mcf.alpha2 = options_.opt_gsa.alpha2_stab;
options_mcf.param_names = pnames;
if DynareOptions.TeX
if options_.TeX
options_mcf.param_names_tex = pnames_tex;
end
options_mcf.fname_ = fname_;
@ -57,24 +64,24 @@ options_mcf.OutputDirectoryName = OutputDirectoryName;
skipline()
disp('Sensitivity analysis for calibration criteria')
if DynareOptions.opt_gsa.ppost
filetoload=dir([Model.dname filesep 'metropolis' filesep fname_ '_param_irf*.mat']);
if options_.opt_gsa.ppost
filetoload=dir([M_.dname filesep 'metropolis' filesep fname_ '_param_irf*.mat']);
lpmat=[];
for j=1:length(filetoload)
load([Model.dname filesep 'metropolis' filesep fname_ '_param_irf',int2str(j),'.mat'])
load([M_.dname filesep 'metropolis' filesep fname_ '_param_irf',int2str(j),'.mat'],'stock')
lpmat = [lpmat; stock];
clear stock
end
type = 'post';
else
if DynareOptions.opt_gsa.pprior
if options_.opt_gsa.pprior
filetoload=[OutputDirectoryName '/' fname_ '_prior'];
load(filetoload,'lpmat','lpmat0','istable','iunstable','iindeterm','iwrong' ,'infox')
load(filetoload,'lpmat','lpmat0')
lpmat = [lpmat0 lpmat];
type = 'prior';
else
filetoload=[OutputDirectoryName '/' fname_ '_mc'];
load(filetoload,'lpmat','lpmat0','istable','iunstable','iindeterm','iwrong' ,'infox')
load(filetoload,'lpmat','lpmat0')
lpmat = [lpmat0 lpmat];
type = 'mc';
end
@ -83,31 +90,31 @@ end
npar = size(pnames,1);
nshock = np - npar;
nbr_irf_restrictions = size(DynareOptions.endogenous_prior_restrictions.irf,1);
nbr_moment_restrictions = size(DynareOptions.endogenous_prior_restrictions.moment,1);
nbr_irf_restrictions = size(options_.endogenous_prior_restrictions.irf,1);
nbr_moment_restrictions = size(options_.endogenous_prior_restrictions.moment,1);
if init
mat_irf=cell(nbr_irf_restrictions,1);
for ij=1:nbr_irf_restrictions
mat_irf{ij}=NaN(Nsam,length(DynareOptions.endogenous_prior_restrictions.irf{ij,3}));
mat_irf{ij}=NaN(Nsam,length(options_.endogenous_prior_restrictions.irf{ij,3}));
end
mat_moment=cell(nbr_moment_restrictions,1);
for ij=1:nbr_moment_restrictions
mat_moment{ij}=NaN(Nsam,length(DynareOptions.endogenous_prior_restrictions.moment{ij,3}));
mat_moment{ij}=NaN(Nsam,length(options_.endogenous_prior_restrictions.moment{ij,3}));
end
irestrictions = [1:Nsam];
irestrictions = 1:Nsam;
h = dyn_waitbar(0,'Please wait...');
for j=1:Nsam
Model = set_all_parameters(lpmat(j,:)',EstimatedParameters,Model);
M_ = set_all_parameters(lpmat(j,:)',estim_params_,M_);
if nbr_moment_restrictions
[Tt,Rr,SteadyState,info,Model,DynareResults] = dynare_resolve(Model,DynareOptions,DynareResults);
[Tt,Rr,~,info,oo_.dr, M_.params] = dynare_resolve(M_,options_,oo_.dr, oo_.steady_state, oo_.exo_steady_state, oo_.exo_det_steady_state);
else
[Tt,Rr,SteadyState,info,Model,DynareResults] = dynare_resolve(Model,DynareOptions,DynareResults,'restrict');
[Tt,Rr,~,info,oo_.dr, M_.params] = dynare_resolve(M_,options_,oo_.dr, oo_.steady_state, oo_.exo_steady_state, oo_.exo_det_steady_state,'restrict');
end
if info(1)==0
[info, info_irf, info_moment, data_irf, data_moment]=endogenous_prior_restrictions(Tt,Rr,Model,DynareOptions,DynareResults);
[~, info_irf, info_moment, data_irf, data_moment]=endogenous_prior_restrictions(Tt,Rr,M_,options_,oo_.dr,oo_.steady_state,oo_.exo_steady_state,oo_.exo_det_steady_state);
if ~isempty(info_irf)
for ij=1:nbr_irf_restrictions
mat_irf{ij}(j,:)=data_irf{ij}(:,2)';
@ -123,14 +130,16 @@ if init
else
irestrictions(j)=0;
end
dyn_waitbar(j/Nsam,h,['MC iteration ',int2str(j),'/',int2str(Nsam)])
if mod(j,3)==0
dyn_waitbar(j/Nsam,h,['MC iteration ',int2str(j),'/',int2str(Nsam)])
end
end
dyn_waitbar_close(h);
irestrictions=irestrictions(find(irestrictions));
xmat=lpmat(irestrictions,:);
skipline()
endo_prior_restrictions=DynareOptions.endogenous_prior_restrictions;
endo_prior_restrictions=options_.endogenous_prior_restrictions;
save([OutputDirectoryName,filesep,fname_,'_',type,'_restrictions'],'xmat','mat_irf','mat_moment','irestrictions','indx_irf','indx_moment','endo_prior_restrictions');
else
load([OutputDirectoryName,filesep,fname_,'_',type,'_restrictions'],'xmat','mat_irf','mat_moment','irestrictions','indx_irf','indx_moment','endo_prior_restrictions');
@ -181,7 +190,7 @@ if ~isempty(indx_irf)
maxijv=0;
for ij=1:nbr_irf_restrictions
if length(endo_prior_restrictions.irf{ij,3})>maxijv
maxij=ij;maxijv=length(endo_prior_restrictions.irf{ij,3});
maxijv=length(endo_prior_restrictions.irf{ij,3});
end
plot_indx(ij) = find(strcmp(irf_couples,all_irf_couples(ij,:)));
time_matrix{plot_indx(ij)} = [time_matrix{plot_indx(ij)} endo_prior_restrictions.irf{ij,3}];
@ -189,8 +198,8 @@ if ~isempty(indx_irf)
iplot_indx = ones(size(plot_indx));
indx_irf = indx_irf(irestrictions,:);
if ~DynareOptions.nograph
h1=dyn_figure(DynareOptions.nodisplay,'name',[type ' evaluation of irf restrictions']);
if ~options_.nograph
h1=dyn_figure(options_.nodisplay,'name',[type ' evaluation of irf restrictions']);
nrow=ceil(sqrt(nbr_irf_couples));
ncol=nrow;
if nrow*(nrow-1)>nbr_irf_couples
@ -203,7 +212,7 @@ if ~isempty(indx_irf)
indx_irf_matrix(:,plot_indx(ij)) = indx_irf_matrix(:,plot_indx(ij)) + indx_irf(:,ij);
for ik=1:size(mat_irf{ij},2)
[Mean,Median,Var,HPD,Distrib] = ...
posterior_moments(mat_irf{ij}(:,ik),0,DynareOptions.mh_conf_sig);
posterior_moments(mat_irf{ij}(:,ik),options_.mh_conf_sig);
irf_mean{plot_indx(ij)} = [irf_mean{plot_indx(ij)}; Mean];
irf_median{plot_indx(ij)} = [irf_median{plot_indx(ij)}; Median];
irf_var{plot_indx(ij)} = [irf_var{plot_indx(ij)}; Var];
@ -217,10 +226,10 @@ if ~isempty(indx_irf)
aleg = [aleg,'-' ,num2str(endo_prior_restrictions.irf{ij,3}(end))];
iplot_indx(ij)=0;
end
if ~DynareOptions.nograph && length(time_matrix{plot_indx(ij)})==1
if ~options_.nograph && length(time_matrix{plot_indx(ij)})==1
set(0,'currentfigure',h1),
subplot(nrow,ncol, plot_indx(ij)),
hc = cumplot(mat_irf{ij}(:,ik));
hc = gsa.cumplot(mat_irf{ij}(:,ik));
a=axis;
delete(hc);
x1val=max(endo_prior_restrictions.irf{ij,4}(1),a(1));
@ -228,47 +237,34 @@ if ~isempty(indx_irf)
hp = patch([x1val x2val x2val x1val],a([3 3 4 4]),'b');
hold all,
set(hp,'FaceColor', [0.7 0.8 1])
hc = cumplot(mat_irf{ij}(:,ik));
hc = gsa.cumplot(mat_irf{ij}(:,ik));
set(hc,'color','k','linewidth',2)
hold off,
% hold off,
title([endo_prior_restrictions.irf{ij,1},' vs ',endo_prior_restrictions.irf{ij,2}, '(', leg,')'],'interpreter','none'),
%set(legend_h,'Xlim',[0 1]);
% if ij==maxij
% leg1 = num2str(endo_prior_restrictions.irf{ij,3}(:));
% [legend_h,object_h,plot_h,text_strings]=legend(leg1);
% Position=get(legend_h,'Position');Position(1:2)=[-0.055 0.95-Position(4)];
% set(legend_h,'Position',Position);
% end
end
% hc = get(h,'Children');
%for i=2:2:length(hc)
%end
indx1 = find(indx_irf(:,ij)==0);
indx2 = find(indx_irf(:,ij)~=0);
atitle0=[endo_prior_restrictions.irf{ij,1},' vs ',endo_prior_restrictions.irf{ij,2}, '(', leg,')'];
fprintf(['%4.1f%% of the ',type,' support matches IRF ',atitle0,' inside [%4.1f, %4.1f]\n'],length(indx1)/length(irestrictions)*100,endo_prior_restrictions.irf{ij,4})
% aname=[type '_irf_calib_',int2str(ij)];
aname=[type '_irf_calib_',endo_prior_restrictions.irf{ij,1},'_vs_',endo_prior_restrictions.irf{ij,2},'_',aleg];
atitle=[type ' IRF Calib: Parameter(s) driving ',endo_prior_restrictions.irf{ij,1},' vs ',endo_prior_restrictions.irf{ij,2}, '(', leg,')'];
options_mcf.amcf_name = aname;
options_mcf.amcf_title = atitle;
options_mcf.beha_title = 'IRF restriction';
options_mcf.nobeha_title = 'NO IRF restriction';
if options_.TeX
options_mcf.beha_title_latex = 'IRF restriction';
options_mcf.nobeha_title_latex = 'NO IRF restriction';
end
options_mcf.title = atitle0;
if ~isempty(indx1) && ~isempty(indx2)
mcf_analysis(xmat(:,nshock+1:end), indx1, indx2, options_mcf, DynareOptions);
gsa.monte_carlo_filtering_analysis(xmat(:,nshock+1:end), indx1, indx2, options_mcf, M_, options_, bayestopt_, estim_params_);
end
% [proba, dproba] = stab_map_1(xmat, indx1, indx2, aname, 0);
% indplot=find(proba<pvalue_ks);
% if ~isempty(indplot)
% stab_map_1(xmat, indx1, indx2, aname, 1, indplot, OutputDirectoryName,[],atitle);
% end
end
for ij=1:nbr_irf_couples
if length(time_matrix{ij})>1
if ~DynareOptions.nograph
if ~options_.nograph
set(0,'currentfigure',h1);
subplot(nrow,ncol, ij)
itmp = (find(plot_indx==ij));
@ -282,7 +278,6 @@ if ~isempty(indx_irf)
tmp(temp_index,:) = endo_prior_restrictions.irf{itmp(ir),4};
end
end
% tmp = cell2mat(endo_prior_restrictions.irf(itmp,4));
tmp(isinf(tmp(:,1)),1)=a(3);
tmp(isinf(tmp(:,2)),2)=a(4);
hp = patch([time_matrix{ij} time_matrix{ij}(end:-1:1)],[tmp(:,1); tmp(end:-1:1,2)],'c');
@ -295,7 +290,6 @@ if ~isempty(indx_irf)
hold off
axis([max(1,a(1)) a(2:4)])
box on
%set(gca,'xtick',sort(time_matrix{ij}))
itmp = min(itmp);
title([endo_prior_restrictions.irf{itmp,1},' vs ',endo_prior_restrictions.irf{itmp,2}],'interpreter','none'),
end
@ -309,23 +303,27 @@ if ~isempty(indx_irf)
aleg = 'ALL';
atitle0=[endo_prior_restrictions.irf{itmp,1},' vs ',endo_prior_restrictions.irf{itmp,2}, '(', leg,')'];
fprintf(['%4.1f%% of the ',type,' support matches IRF restrictions ',atitle0,'\n'],length(indx1)/length(irestrictions)*100)
% aname=[type '_irf_calib_',int2str(ij)];
aname=[type '_irf_calib_',endo_prior_restrictions.irf{itmp,1},'_vs_',endo_prior_restrictions.irf{itmp,2},'_',aleg];
atitle=[type ' IRF Calib: Parameter(s) driving ',endo_prior_restrictions.irf{itmp,1},' vs ',endo_prior_restrictions.irf{itmp,2}, '(', leg,')'];
options_mcf.amcf_name = aname;
options_mcf.amcf_title = atitle;
options_mcf.beha_title = 'IRF restriction';
options_mcf.nobeha_title = 'NO IRF restriction';
if options_.TeX
options_mcf.beha_title_latex = 'IRF restriction';
options_mcf.nobeha_title_latex = 'NO IRF restriction';
end
options_mcf.title = atitle0;
if ~isempty(indx1) && ~isempty(indx2)
mcf_analysis(xmat(:,nshock+1:end), indx1, indx2, options_mcf, DynareOptions);
gsa.monte_carlo_filtering_analysis(xmat(:,nshock+1:end), indx1, indx2, options_mcf, M_, options_, bayestopt_, estim_params_);
end
end
end
end
if ~DynareOptions.nograph
dyn_saveas(h1,[OutputDirectoryName,filesep,fname_,'_',type,'_irf_restrictions'],DynareOptions.nodisplay,DynareOptions.graph_format);
create_TeX_loader(DynareOptions,[OutputDirectoryName,filesep,fname_,'_',type,'_irf_restrictions'],[type ' evaluation of irf restrictions'],'irf_restrictions',type,DynareOptions.figures.textwidth*min(ij/ncol,1))
if ~options_.nograph
dyn_saveas(h1,[OutputDirectoryName,filesep,fname_,'_',type,'_irf_restrictions'],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[OutputDirectoryName,filesep,fname_,'_',type,'_irf_restrictions'],[type ' evaluation of irf restrictions'],'irf_restrictions',type,options_.figures.textwidth*min(ij/ncol,1))
end
skipline()
end
@ -361,24 +359,24 @@ if ~isempty(indx_moment)
skipline()
%get parameter names including standard deviations
np=size(BayesInfo.name,1);
np=size(bayestopt_.name,1);
name=cell(np,1);
name_tex=cell(np,1);
for jj=1:np
if DynareOptions.TeX
[param_name_temp, param_name_tex_temp]= get_the_name(jj,DynareOptions.TeX,Model,EstimatedParameters,DynareOptions);
name_tex{jj,1} = strrep(param_name_tex_temp,'$','');
if options_.TeX
[param_name_temp, param_name_tex_temp]= get_the_name(jj,options_.TeX,M_,estim_params_,options_.varobs);
name_tex{jj,1} = param_name_tex_temp;
name{jj,1} = param_name_temp;
else
param_name_temp = get_the_name(jj,DynareOptions.TeX,Model,EstimatedParameters,DynareOptions);
param_name_temp = get_the_name(jj,options_.TeX,M_,estim_params_,options_.varobs);
name{jj,1} = param_name_temp;
end
end
options_mcf.param_names = name;
if DynareOptions.TeX
if options_.TeX
options_mcf.param_names_tex = name_tex;
end
options_mcf.param_names = BayesInfo.name;
options_mcf.param_names = bayestopt_.name;
all_moment_couples = cellstr([char(endo_prior_restrictions.moment(:,1)) char(endo_prior_restrictions.moment(:,2))]);
moment_couples = unique(all_moment_couples);
nbr_moment_couples = size(moment_couples,1);
@ -396,7 +394,7 @@ if ~isempty(indx_moment)
for ij=1:nbr_moment_restrictions
endo_prior_restrictions.moment{ij,3} = sort(endo_prior_restrictions.moment{ij,3});
if length(endo_prior_restrictions.moment{ij,3})>maxijv
maxij=ij;maxijv=length(endo_prior_restrictions.moment{ij,3});
maxijv=length(endo_prior_restrictions.moment{ij,3});
end
plot_indx(ij) = find(strcmp(moment_couples,all_moment_couples(ij,:)));
time_matrix{plot_indx(ij)} = [time_matrix{plot_indx(ij)} endo_prior_restrictions.moment{ij,3}];
@ -404,8 +402,8 @@ if ~isempty(indx_moment)
iplot_indx = ones(size(plot_indx));
indx_moment = indx_moment(irestrictions,:);
if ~DynareOptions.nograph
h2=dyn_figure(DynareOptions.nodisplay,'name',[type ' evaluation of moment restrictions']);
if ~options_.nograph
h2=dyn_figure(options_.nodisplay,'name',[type ' evaluation of moment restrictions']);
nrow=ceil(sqrt(nbr_moment_couples));
ncol=nrow;
if nrow*(nrow-1)>nbr_moment_couples
@ -419,7 +417,7 @@ if ~isempty(indx_moment)
indx_moment_matrix(:,plot_indx(ij)) = indx_moment_matrix(:,plot_indx(ij)) + indx_moment(:,ij);
for ik=1:size(mat_moment{ij},2)
[Mean,Median,Var,HPD,Distrib] = ...
posterior_moments(mat_moment{ij}(:,ik),0,DynareOptions.mh_conf_sig);
posterior_moments(mat_moment{ij}(:,ik),options_.mh_conf_sig);
moment_mean{plot_indx(ij)} = [moment_mean{plot_indx(ij)}; Mean];
moment_median{plot_indx(ij)} = [moment_median{plot_indx(ij)}; Median];
moment_var{plot_indx(ij)} = [moment_var{plot_indx(ij)}; Var];
@ -433,10 +431,10 @@ if ~isempty(indx_moment)
aleg = [aleg,'_' ,num2str(endo_prior_restrictions.moment{ij,3}(end))];
iplot_indx(ij)=0;
end
if ~DynareOptions.nograph && length(time_matrix{plot_indx(ij)})==1
if ~options_.nograph && length(time_matrix{plot_indx(ij)})==1
set(0,'currentfigure',h2);
subplot(nrow,ncol,plot_indx(ij)),
hc = cumplot(mat_moment{ij}(:,ik));
hc = gsa.cumplot(mat_moment{ij}(:,ik));
a=axis; delete(hc),
% hist(mat_moment{ij}),
x1val=max(endo_prior_restrictions.moment{ij,4}(1),a(1));
@ -444,43 +442,34 @@ if ~isempty(indx_moment)
hp = patch([x1val x2val x2val x1val],a([3 3 4 4]),'b');
set(hp,'FaceColor', [0.7 0.8 1])
hold all
hc = cumplot(mat_moment{ij}(:,ik));
hc = gsa.cumplot(mat_moment{ij}(:,ik));
set(hc,'color','k','linewidth',2)
hold off
title([endo_prior_restrictions.moment{ij,1},' vs ',endo_prior_restrictions.moment{ij,2},'(',leg,')'],'interpreter','none'),
% if ij==maxij
% leg1 = num2str(endo_prior_restrictions.moment{ij,3}(:));
% [legend_h,object_h,plot_h,text_strings]=legend(leg1);
% Position=get(legend_h,'Position');Position(1:2)=[-0.055 0.95-Position(4)];
% set(legend_h,'Position',Position);
% end
end
indx1 = find(indx_moment(:,ij)==0);
indx2 = find(indx_moment(:,ij)~=0);
atitle0=[endo_prior_restrictions.moment{ij,1},' vs ',endo_prior_restrictions.moment{ij,2}, '(', leg,')'];
fprintf(['%4.1f%% of the ',type,' support matches MOMENT ',atitle0,' inside [%4.1f, %4.1f]\n'],length(indx1)/length(irestrictions)*100,endo_prior_restrictions.moment{ij,4})
% aname=[type '_moment_calib_',int2str(ij)];
aname=[type '_moment_calib_',endo_prior_restrictions.moment{ij,1},'_vs_',endo_prior_restrictions.moment{ij,2},'_',aleg];
atitle=[type ' MOMENT Calib: Parameter(s) driving ',endo_prior_restrictions.moment{ij,1},' vs ',endo_prior_restrictions.moment{ij,2}, '(', leg,')'];
options_mcf.amcf_name = aname;
options_mcf.amcf_title = atitle;
options_mcf.beha_title = 'moment restriction';
options_mcf.nobeha_title = 'NO moment restriction';
if options_.TeX
options_mcf.beha_title_latex = 'moment restriction';
options_mcf.nobeha_title_latex = 'NO moment restriction';
end
options_mcf.title = atitle0;
if ~isempty(indx1) && ~isempty(indx2)
mcf_analysis(xmat, indx1, indx2, options_mcf, DynareOptions);
gsa.monte_carlo_filtering_analysis(xmat, indx1, indx2, options_mcf, M_, options_, bayestopt_, estim_params_);
end
% [proba, dproba] = stab_map_1(xmat, indx1, indx2, aname, 0);
% indplot=find(proba<pvalue_ks);
% if ~isempty(indplot)
% stab_map_1(xmat, indx1, indx2, aname, 1, indplot, OutputDirectoryName,[],atitle);
% end
end
for ij=1:nbr_moment_couples
time_matrix{ij} = sort(time_matrix{ij});
if length(time_matrix{ij})>1
if ~DynareOptions.nograph
if ~options_.nograph
itmp = (find(plot_indx==ij));
set(0,'currentfigure',h2);
subplot(nrow,ncol, ij)
@ -494,7 +483,6 @@ if ~isempty(indx_moment)
tmp(temp_index,:) = endo_prior_restrictions.moment{itmp(ir),4};
end
end
% tmp = cell2mat(endo_prior_restrictions.moment(itmp,4));
tmp(isinf(tmp(:,1)),1)=a(3);
tmp(isinf(tmp(:,2)),2)=a(4);
hp = patch([time_matrix{ij} time_matrix{ij}(end:-1:1)],[tmp(:,1); tmp(end:-1:1,2)],'b');
@ -507,7 +495,6 @@ if ~isempty(indx_moment)
hold off
axis(a)
box on
% set(gca,'xtick',sort(time_matrix{ij}))
itmp = min(itmp);
title([endo_prior_restrictions.moment{itmp,1},' vs ',endo_prior_restrictions.moment{itmp,2}],'interpreter','none'),
end
@ -521,23 +508,26 @@ if ~isempty(indx_moment)
aleg = 'ALL';
atitle0=[endo_prior_restrictions.moment{itmp,1},' vs ',endo_prior_restrictions.moment{itmp,2}, '(', leg,')'];
fprintf(['%4.1f%% of the ',type,' support matches MOMENT restrictions ',atitle0,'\n'],length(indx1)/length(irestrictions)*100)
% aname=[type '_moment_calib_',int2str(ij)];
aname=[type '_moment_calib_',endo_prior_restrictions.moment{itmp,1},'_vs_',endo_prior_restrictions.moment{itmp,2},'_',aleg];
atitle=[type ' MOMENT Calib: Parameter(s) driving ',endo_prior_restrictions.moment{itmp,1},' vs ',endo_prior_restrictions.moment{itmp,2}, '(', leg,')'];
options_mcf.amcf_name = aname;
options_mcf.amcf_title = atitle;
options_mcf.beha_title = 'moment restriction';
options_mcf.nobeha_title = 'NO moment restriction';
if options_.TeX
options_mcf.beha_title_latex = 'moment restriction';
options_mcf.nobeha_title_latex = 'NO moment restriction';
end
options_mcf.title = atitle0;
if ~isempty(indx1) && ~isempty(indx2)
mcf_analysis(xmat, indx1, indx2, options_mcf, DynareOptions);
gsa.monte_carlo_filtering_analysis(xmat, indx1, indx2, options_mcf, M_, options_, bayestopt_, estim_params_);
end
end
end
end
if ~DynareOptions.nograph
dyn_saveas(h2,[OutputDirectoryName,filesep,fname_,'_',type,'_moment_restrictions'],DynareOptions.nodisplay,DynareOptions.graph_format);
create_TeX_loader(DynareOptions,[OutputDirectoryName,filesep,fname_,'_',type,'_moment_restrictions'],[type ' evaluation of moment restrictions'],'moment_restrictions',type,DynareOptions.figures.textwidth*min(ij/ncol,1))
if ~options_.nograph
dyn_saveas(h2,[OutputDirectoryName,filesep,fname_,'_',type,'_moment_restrictions'],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[OutputDirectoryName,filesep,fname_,'_',type,'_moment_restrictions'],[type ' evaluation of moment restrictions'],'moment_restrictions',type,options_.figures.textwidth*min(ij/ncol,1))
end
skipline()

View File

@ -0,0 +1,305 @@
function map_identification(OutputDirectoryName,opt_gsa,M_,oo_,options_,estim_params_,bayestopt_)
% map_identification(OutputDirectoryName,opt_gsa,M_,oo_,options_,estim_params_,bayestopt_)
% Inputs
% - OutputDirectoryName [string] name of the output directory
% - opt_gsa [structure] GSA options structure
% - M_ [structure] Matlab's structure describing the model
% - oo_ [structure] Matlab's structure describing the results
% - options_ [structure] Matlab's structure describing the current options
% - estim_params_ [structure] characterizing parameters to be estimated
% - bayestopt_ [structure] describing the priors
% Written by Marco Ratto
% Joint Research Centre, The European Commission,
% marco.ratto@ec.europa.eu
% Copyright © 2012-2016 European Commission
% Copyright © 2012-2023 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
fname_ = M_.fname;
dr=oo_.dr;
nliv = opt_gsa.morris_nliv;
itrans = opt_gsa.trans_ident;
np = size(estim_params_.param_vals,1);
pnames = M_.param_names(estim_params_.param_vals(:,1));
if opt_gsa.pprior
filetoload=[OutputDirectoryName '/' fname_ '_prior'];
else
filetoload=[OutputDirectoryName '/' fname_ '_mc'];
end
load(filetoload,'lpmat','lpmat0','istable','T','yys')
if ~isempty(lpmat0)
lpmatx=lpmat0(istable,:);
else
lpmatx=[];
end
Nsam = size(lpmat,1);
nshock = size(lpmat0,2);
npT = np+nshock;
fname_ = M_.fname;
if opt_gsa.load_ident_files==0
mss = yys(bayestopt_.mfys,:);
mss = gsa.teff(mss(:,istable),Nsam,istable);
yys = gsa.teff(yys(dr.order_var,istable),Nsam,istable);
if exist('T','var')
[vdec, cc, ac] = gsa.monte_carlo_moments(T, lpmatx, dr, M_, options_, estim_params_);
else
return
end
if opt_gsa.morris==2
pdraws = identification.run(M_,oo_,options_,bayestopt_,estim_params_,options_.options_ident,[lpmatx lpmat(istable,:)]);
if ~isempty(pdraws) && max(max(abs(pdraws-[lpmatx lpmat(istable,:)])))==0
disp(['Sample check OK. Largest difference: ', num2str(max(max(abs(pdraws-[lpmatx lpmat(istable,:)]))))]),
clear pdraws;
end
clear GAM gas
end
if opt_gsa.morris~=1 && M_.exo_nbr>1
ifig=0;
for j=1:M_.exo_nbr
if mod(j,6)==1
hh_fig=dyn_figure(options_.nodisplay,'name','Variance decomposition shocks');
ifig=ifig+1;
iplo=0;
end
iplo=iplo+1;
subplot(2,3,iplo)
gsa.boxplot(squeeze(vdec(:,j,:))',[],'.',[],10)
set(gca,'xticklabel',' ','fontsize',10,'xtick',1:size(options_.varobs,1))
set(gca,'xlim',[0.5 size(options_.varobs,1)+0.5])
set(gca,'ylim',[-2 102])
for ip=1:size(options_.varobs,1)
if options_.TeX
text(ip,-4,deblank(opt_gsa.varobs_tex(ip,:)),'rotation',90,'HorizontalAlignment','right','interpreter','latex')
else
text(ip,-4,deblank(options_.varobs(ip,:)),'rotation',90,'HorizontalAlignment','right','interpreter','none')
end
end
xlabel(' ')
ylabel(' ')
title(M_.exo_names{j},'interpreter','none')
if mod(j,6)==0 || j==M_.exo_nbr
dyn_saveas(hh_fig,[OutputDirectoryName,'/',fname_,'_vdec_exo_',int2str(ifig)],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[OutputDirectoryName,'/',fname_,'_vdec_exo_',int2str(ifig)],ifig,'Variance decomposition shocks','vdec_exo',options_.figures.textwidth*min(iplo/3,1))
end
end
end
for j=1:size(cc,1)
cc(j,j,:)=gsa.standardize_columns(squeeze(log(cc(j,j,:))))./2;
end
[vdec, ~, ir_vdec, ic_vdec] = gsa.teff(vdec,Nsam,istable);
[cc, ~, ir_cc, ic_cc] = gsa.teff(cc,Nsam,istable);
[ac, ~, ir_ac, ic_ac] = gsa.teff(ac,Nsam,istable);
nc1= size(T,2);
endo_nbr = M_.endo_nbr;
nstatic = M_.nstatic;
nspred = M_.nspred;
iv = (1:endo_nbr)';
ic = [ nstatic+(1:nspred) endo_nbr+(1:size(dr.ghx,2)-nspred) ]';
dr.ghx = T(:, 1:(nc1-M_.exo_nbr),1);
dr.ghu = T(:, (nc1-M_.exo_nbr+1):end, 1);
[Aa,Bb] = kalman_transition_matrix(dr,iv,ic);
A = zeros(size(Aa,1),size(Aa,2)+size(Aa,1),length(istable));
if ~isempty(lpmatx)
M_=gsa.set_shocks_param(M_,estim_params_,lpmatx(1,:));
end
A(:,:,1)=[Aa, triu(Bb*M_.Sigma_e*Bb')];
for j=2:length(istable)
dr.ghx = T(:, 1:(nc1-M_.exo_nbr),j);
dr.ghu = T(:, (nc1-M_.exo_nbr+1):end, j);
[Aa,Bb] = kalman_transition_matrix(dr, iv, ic);
if ~isempty(lpmatx)
M_=gsa.set_shocks_param(M_,estim_params_,lpmatx(j,:));
end
A(:,:,j)=[Aa, triu(Bb*M_.Sigma_e*Bb')];
end
clear T
clear lpmatx
[yt, j0]=gsa.teff(A,Nsam,istable);
yt = [yys yt];
if opt_gsa.morris==2
clear TAU A
else
clear A
end
save([OutputDirectoryName,'/',fname_,'_main_eff.mat'],'ac','cc','vdec','yt','mss')
else %load identification files
load([OutputDirectoryName,'/',fname_,'_main_eff.mat'],'ac','cc','vdec','yt','mss')
end
if opt_gsa.morris==1
if ~isempty(vdec)
if opt_gsa.load_ident_files==0
SAMorris=NaN(npT,3,size(vdec,2));
for i=1:size(vdec,2)
[~, SAMorris(:,:,i)] = gsa.Morris_Measure_Groups(npT, [lpmat0 lpmat], vdec(:,i),nliv);
end
SAvdec = squeeze(SAMorris(:,1,:))';
save([OutputDirectoryName,'/',fname_,'_morris_IDE.mat'],'SAvdec','vdec','ir_vdec','ic_vdec')
else
load([OutputDirectoryName,'/',fname_,'_morris_IDE.mat'],'SAvdec')
end
hh_fig = dyn_figure(options_.nodisplay,'name','Screening identification: variance decomposition');
gsa.boxplot(SAvdec,[],'.',[],10)
set(gca,'xticklabel',' ','fontsize',10,'xtick',1:npT)
set(gca,'xlim',[0.5 npT+0.5])
ydum = get(gca,'ylim');
set(gca,'ylim',[0 ydum(2)])
set(gca,'position',[0.13 0.2 0.775 0.7])
for ip=1:npT
if options_.TeX
[~, param_name_tex_temp]= get_the_name(ip,options_.TeX,M_,estim_params_,options_.varobs);
text(ip,-2,param_name_tex_temp,'rotation',90,'HorizontalAlignment','right','interpreter','latex')
else
text(ip,-2,bayestopt_.name{ip},'rotation',90,'HorizontalAlignment','right','interpreter','none')
end
end
xlabel(' ')
title('Elementary effects variance decomposition')
dyn_saveas(hh_fig,[OutputDirectoryName,'/',fname_,'_morris_vdec'],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[OutputDirectoryName,'/',fname_,'_morris_vdec'],1,'Screening identification: variance decomposition','morris_vdec',1)
else
save([OutputDirectoryName,'/',fname_,'_morris_IDE.mat'],'vdec')
end
if opt_gsa.load_ident_files==0
ccac = [mss cc ac];
SAMorris=NaN(npT,3,size(ccac,2));
for i=1:size(ccac,2)
[~, SAMorris(:,:,i)] = gsa.Morris_Measure_Groups(npT, [lpmat0 lpmat], [ccac(:,i)],nliv);
end
SAcc = squeeze(SAMorris(:,1,:))';
SAcc = SAcc./(max(SAcc,[],2)*ones(1,npT));
save([OutputDirectoryName,'/',fname_,'_morris_IDE.mat'],'SAcc','cc','ir_cc','ic_cc','-append')
save([OutputDirectoryName,'/',fname_,'_morris_IDE.mat'],'ac','ir_ac','ic_ac','-append')
else
load([OutputDirectoryName,'/',fname_,'_morris_IDE'],'SAcc','cc','ir_cc','ic_cc')
load([OutputDirectoryName,'/',fname_,'_morris_IDE'],'ac','ir_ac','ic_ac')
end
hh_fig=dyn_figure(options_.nodisplay,'name','Screening identification: theoretical moments');
gsa.boxplot(SAcc,[],'.',[],10)
set(gca,'xticklabel',' ','fontsize',10,'xtick',1:npT)
set(gca,'xlim',[0.5 npT+0.5])
set(gca,'ylim',[0 1])
set(gca,'position',[0.13 0.2 0.775 0.7])
for ip=1:npT
if options_.TeX
[~, param_name_tex_temp]= get_the_name(ip,options_.TeX,M_,estim_params_,options_.varobs);
text(ip,-0.02,param_name_tex_temp,'rotation',90,'HorizontalAlignment','right','interpreter','latex')
else
text(ip,-0.02,bayestopt_.name{ip},'rotation',90,'HorizontalAlignment','right','interpreter','none')
end
end
xlabel(' ')
title('Elementary effects in the moments')
dyn_saveas(hh_fig,[OutputDirectoryName,'/',fname_,'_morris_moments'],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[OutputDirectoryName,'/',fname_,'_morris_moments'],1,'Screening identification: theoretical moments','morris_moments',1)
if opt_gsa.load_ident_files==0
SAMorris=NaN(npT,3,j0);
for j=1:j0
[~, SAMorris(:,:,j)] = gsa.Morris_Measure_Groups(npT, [lpmat0 lpmat], yt(:,j),nliv);
end
SAM = squeeze(SAMorris(1:end,1,:));
SAnorm=NaN(npT,j0);
irex=NaN(j0);
for j=1:j0
SAnorm(:,j)=SAM(:,j)./max(SAM(:,j));
irex(j)=length(find(SAnorm(:,j)>0.01));
end
SAMmu = squeeze(SAMorris(1:end,2,:));
SAmunorm=NaN(npT,j0);
for j=1:j0
SAmunorm(:,j)=SAMmu(:,j)./max(SAM(:,j)); % normalised w.r.t. mu*
end
SAMsig = squeeze(SAMorris(1:end,3,:));
SAsignorm=NaN(npT,j0);
for j=1:j0
SAsignorm(:,j)=SAMsig(:,j)./max(SAMsig(:,j));
end
save([OutputDirectoryName,'/',fname_,'_morris_IDE.mat'],'SAnorm','SAmunorm','SAsignorm','-append')
else
load([OutputDirectoryName,'/',fname_,'_morris_IDE'],'SAnorm')
end
hh_fig=dyn_figure(options_.nodisplay,'name','Screening identification: model');
gsa.boxplot(SAnorm',[],'.',[],10)
set(gca,'xticklabel',' ','fontsize',10,'xtick',1:npT)
set(gca,'xlim',[0.5 npT+0.5])
set(gca,'ylim',[0 1])
set(gca,'position',[0.13 0.2 0.775 0.7])
xlabel(' ')
for ip=1:npT
if options_.TeX
[~, param_name_tex_temp]= get_the_name(ip,options_.TeX,M_,estim_params_,options_.varobs);
text(ip,-0.02,param_name_tex_temp,'rotation',90,'HorizontalAlignment','right','interpreter','latex')
else
text(ip,-0.02,bayestopt_.name{ip},'rotation',90,'HorizontalAlignment','right','interpreter','none')
end
end
xlabel(' ')
title('Elementary effects in the model')
dyn_saveas(hh_fig,[OutputDirectoryName,'/',fname_,'_morris_par'],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[OutputDirectoryName,'/',fname_,'_morris_par'],1,'Screening identification: model','morris_par',1)
elseif opt_gsa.morris==3
return
elseif opt_gsa.morris==2 % ISKREV stuff
return
else
error('gsa/map_identification: unsupported option morris=%u',opt_gsa.morris)
end
function []=create_TeX_loader(options_,figpath,ifig_number,caption,label_name,scale_factor)
if nargin<6
scale_factor=1;
end
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fidTeX = fopen([figpath '.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by map_ident_.m (Dynare).\n');
fprintf(fidTeX,['%% ' datestr(now,0) '\n\n']);
fprintf(fidTeX,'\\begin{figure}[H]\n');
fprintf(fidTeX,'\\centering \n');
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s}\n',scale_factor,strrep(figpath,'\','/'));
fprintf(fidTeX,'\\caption{%s.}',caption);
fprintf(fidTeX,'\\label{Fig:%s:%u}\n',label_name,ifig_number);
fprintf(fidTeX,'\\end{figure}\n\n');
fprintf(fidTeX,'%% End Of TeX file. \n');
fclose(fidTeX);
end
function yr = trank(y)
% yr is the rank transformation of y
yr=NaN(size(y));
[nr, nc] = size(y);
for j=1:nc
[~, is]=sort(y(:,j));
yr(is,j)=[1:nr]'./nr;
end

View File

@ -1,5 +1,25 @@
function [rmse_MC, ixx] = filt_mc_(OutDir,options_gsa_,dataset_,dataset_info)
% function [rmse_MC, ixx] = filt_mc_(OutDir)
function [rmse_MC, ixx] = monte_carlo_filtering(OutDir,options_gsa_,dataset_,dataset_info,M_,oo_,options_,bayestopt_,estim_params_)
% [rmse_MC, ixx] = monte_carlo_filtering(OutDir,options_gsa_,dataset_,dataset_info,M_,oo_,options_,bayestopt_,estim_params_
% Inputs:
% - OutputDirectoryName [string] name of the output directory
% - options_gsa_ [structure] GSA options
% - dataset_ [dseries] object storing the dataset
% - dataset_info [structure] storing informations about the sample.
% - M_ [structure] Matlab's structure describing the model
% - oo_ [structure] storing the results
% - options_ [structure] Matlab's structure describing the current options
% - bayestopt_ [structure] describing the priors
% - estim_params_ [structure] characterizing parameters to be estimated
%
% Outputs:
% - rmse_MC [double] RMSE by nvar matrix of the RMSEs
% - ixx [double] RMSE by nvar matrix of sorting
% indices (descending order of RMSEs)
%
% Notes: the R^2 definition is 1-var(ymodel-ydata)/var(ydata). It ranges
% bewteen (-inf, 1], with negative values indicating that themodel is a worse
% predictor than the sample mean of the data
% inputs (from opt_gsa structure)
% vvarvecm = options_gsa_.var_rmse;
% loadSA = options_gsa_.load_rmse;
@ -7,7 +27,6 @@ function [rmse_MC, ixx] = filt_mc_(OutDir,options_gsa_,dataset_,dataset_info)
% alpha = options_gsa_.alpha_rmse;
% alpha2 = options_gsa_.alpha2_rmse;
% istart = options_gsa_.istart_rmse;
% alphaPC = 0.5;
%
% Written by Marco Ratto
% Joint Research Centre, The European Commission,
@ -31,9 +50,6 @@ function [rmse_MC, ixx] = filt_mc_(OutDir,options_gsa_,dataset_,dataset_info)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
global bayestopt_ estim_params_ M_ options_ oo_
% options_gsa_=options_.opt_gsa;
vvarvecm = options_gsa_.var_rmse;
if options_.TeX
vvarvecm_tex = options_gsa_.var_rmse_tex;
@ -46,13 +62,10 @@ alpha = options_gsa_.alpha_rmse;
alpha2 = 0;
pvalue = options_gsa_.alpha2_rmse;
istart = max(2,options_gsa_.istart_rmse);
alphaPC = 0.5;
fname_ = M_.fname;
lgy_ = M_.endo_names;
dr_ = oo_.dr;
skipline(2)
skipline(1)
disp('Starting sensitivity analysis')
disp('for the fit of EACH observed series ...')
skipline()
@ -61,12 +74,12 @@ if ~options_.nograph
a=dir([OutDir,filesep,'*.*']);
tmp1='0';
if options_.opt_gsa.ppost
tmp=['_rmse_post'];
tmp='_rmse_post';
else
if options_.opt_gsa.pprior
tmp=['_rmse_prior'];
tmp='_rmse_prior';
else
tmp=['_rmse_mc'];
tmp='_rmse_mc';
end
if options_gsa_.lik_only
tmp1 = [tmp,'_post_SA'];
@ -75,17 +88,23 @@ if ~options_.nograph
end
for j=1:length(a)
if strmatch([fname_,tmp],a(j).name)
disp(a(j).name)
if options_.debug
disp(a(j).name)
end
delete([OutDir,filesep,a(j).name])
end
if strmatch([fname_,tmp1],a(j).name)
disp(a(j).name)
if options_.debug
disp(a(j).name)
end
delete([OutDir,filesep,a(j).name])
end
end
disp('done !')
end
[param_names,param_names_tex]=get_LaTeX_parameter_names(M_,options_,estim_params_,bayestopt_);
nshock=estim_params_.nvx + estim_params_.nvn + estim_params_.ncx + estim_params_.ncn;
npar=estim_params_.np;
if ~isempty(options_.mode_file)
@ -94,10 +113,12 @@ end
if options_.opt_gsa.ppost
c=load([M_.dname filesep 'Output' filesep fname_,'_mean.mat'],'xparam1');
xparam1_mean=c.xparam1;
xparam1=c.xparam1;
clear c
elseif ~isempty(options_.mode_file) && exist([M_.dname filesep 'Output' filesep fname_,'_mean.mat'])==2
elseif ~isempty(options_.mode_file) && exist([M_.dname filesep 'Output' filesep fname_,'_mean.mat'],'file')==2
c=load([M_.dname filesep 'Output' filesep fname_,'_mean.mat'],'xparam1');
xparam1_mean=c.xparam1;
xparam1=c.xparam1;
clear c
end
@ -124,31 +145,11 @@ if loadSA
end
end
if ~loadSA
if exist('xparam1','var')
M_ = set_all_parameters(xparam1,estim_params_,M_);
ys_mode=evaluate_steady_state(oo_.steady_state,[oo_.exo_steady_state; oo_.exo_det_steady_state],M_,options_,~options_.steadystate.nocheck);
end
if exist('xparam1_mean','var')
M_ = set_all_parameters(xparam1_mean,estim_params_,M_);
ys_mean=evaluate_steady_state(oo_.steady_state,[oo_.exo_steady_state; oo_.exo_det_steady_state],M_,options_,~options_.steadystate.nocheck);
end
Y = transpose(dataset_.data);
gend = dataset_.nobs;
data_index = dataset_info.missing.aindex;
missing_value = dataset_info.missing.state;
for jx=1:gend
data_indx(jx,data_index{jx})=true;
end
load([DirectoryName filesep M_.fname '_data.mat']);
filfilt = dir([DirectoryName filesep M_.fname '_filter_step_ahead*.mat']);
temp_smooth_file_list = dir([DirectoryName filesep M_.fname '_smooth*.mat']);
jfile=0;
for j=1:length(temp_smooth_file_list)
if isempty(strfind(temp_smooth_file_list(j).name,'smoothed')),
jfile=jfile+1;
filsmooth(jfile)=temp_smooth_file_list(j);
end
end
filupdate = dir([DirectoryName filesep M_.fname '_update*.mat']);
filparam = dir([DirectoryName filesep M_.fname '_param*.mat']);
x=[];
@ -156,11 +157,11 @@ if ~loadSA
sto_ys=[];
for j=1:length(filparam)
if isempty(strmatch([M_.fname '_param_irf'],filparam(j).name))
load([DirectoryName filesep filparam(j).name]);
x=[x; stock];
logpo2=[logpo2; stock_logpo];
sto_ys=[sto_ys; stock_ys];
clear stock stock_logpo stock_ys;
temp=load([DirectoryName filesep filparam(j).name]); % from prior_posterior_statistics_core
x=[x; temp.stock];
logpo2=[logpo2; temp.stock_logpo];
sto_ys=[sto_ys; temp.stock_ys];
clear temp;
end
end
nruns=size(x,1);
@ -168,38 +169,41 @@ if ~loadSA
if options_.opt_gsa.ppost || (options_.opt_gsa.ppost==0 && options_.opt_gsa.lik_only==0)
skipline()
disp('Computing RMSE''s...')
jxj=NaN(length(vvarvecm),1);
js=NaN(length(vvarvecm),1);
yss=NaN(length(vvarvecm),gend,size(sto_ys,1));
for i = 1:length(vvarvecm)
vj = vvarvecm{i};
jxj(i) = strmatch(vj, lgy_(dr_.order_var), 'exact');
js(i) = strmatch(vj, lgy_, 'exact');
jxj(i) = strmatch(vj, M_.endo_names(oo_.dr.order_var), 'exact');
js(i) = strmatch(vj, M_.endo_names, 'exact');
yss(i,:,:)=repmat(sto_ys(:,js(i))',[gend,1]);
end
if exist('xparam1','var')
[alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK] = DsgeSmoother(xparam1,gend,Y,data_index,missing_value,M_,oo_,options_,bayestopt_,estim_params_);
y0 = reshape( squeeze(aK(1,jxj,1:gend)),[gend length(jxj)]);% + kron(ys_mode(js),ones(1,gend)));
yobs = transpose( ahat(jxj,:));% + kron(ys_mode(js),ones(1,gend)));
[~,~,~,ahat,~,~,aK] = DsgeSmoother(xparam1,gend,Y,data_index,missing_value,M_,oo_,options_,bayestopt_,estim_params_);
y0 = reshape( squeeze(aK(1,jxj,1:gend)),[gend length(jxj)]);
yobs = transpose( ahat(jxj,:));
rmse_mode = sqrt(mean((yobs(istart:end,:)-y0(istart:end,:)).^2));
r2_mode = 1-sum((yobs(istart:end,:)-y0(istart:end,:)).^2)./sum(yobs(istart:end,:).^2);
end
y0=-yss;
y0=-yss; %demean everything using the theoretical mean, i.e. steady state
nbb=0;
for j=1:length(filfilt)
load([DirectoryName filesep M_.fname '_filter_step_ahead',num2str(j),'.mat']);
nb = size(stock,4);
y0(:,:,nbb+1:nbb+nb)=y0(:,:,nbb+1:nbb+nb)+reshape(stock(1,js,1:gend,:),[length(js) gend nb]);
temp=load([DirectoryName filesep M_.fname '_filter_step_ahead',num2str(j),'.mat']);
nb = size(temp.stock,4);
y0(:,:,nbb+1:nbb+nb)=y0(:,:,nbb+1:nbb+nb)+reshape(temp.stock(1,js,1:gend,:),[length(js) gend nb]);
nbb=nbb+nb;
clear stock;
clear temp;
end
yobs=-yss;
nbb=0;
for j=1:length(filupdate)
load([DirectoryName filesep M_.fname '_update',num2str(j),'.mat']);
nb = size(stock,3);
yobs(:,:,nbb+1:nbb+nb)=yobs(:,:,nbb+1:nbb+nb)+reshape(stock(js,1:gend,:),[length(js) gend nb]);
temp=load([DirectoryName filesep M_.fname '_update',num2str(j),'.mat']);
nb = size(temp.stock,3);
yobs(:,:,nbb+1:nbb+nb)=yobs(:,:,nbb+1:nbb+nb)+reshape(temp.stock(js,1:gend,:),[length(js) gend nb]);
nbb=nbb+nb;
clear stock;
clear temp;
end
y0M=mean(y0,2);
rmse_MC=zeros(nruns,length(js));
r2_MC=zeros(nruns,length(js));
for j=1:nruns
@ -207,14 +211,15 @@ if ~loadSA
r2_MC(j,:) = 1-mean((yobs(:,istart:end,j)'-y0(:,istart:end,j)').^2)./mean((yobs(:,istart:end,j)').^2);
end
if exist('xparam1_mean','var')
[alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK] = DsgeSmoother(xparam1_mean,gend,Y,data_index,missing_value,M_,oo_,options_,bayestopt_,estim_params_);
y0 = reshape( squeeze(aK(1,jxj,1:gend)),[gend length(jxj)]);% + kron(ys_mean(js),ones(1,gend)));
yobs = transpose( ahat(jxj,:));% + kron(ys_mean(js),ones(1,gend)));
[~,~,~,ahat,~,~,aK] = DsgeSmoother(xparam1_mean,gend,Y,data_index,missing_value,M_,oo_,options_,bayestopt_,estim_params_);
y0 = reshape( squeeze(aK(1,jxj,1:gend)),[gend length(jxj)]);
yobs = transpose( ahat(jxj,:));
rmse_pmean = sqrt(mean((yobs(istart:end,:)-y0(istart:end,:)).^2));
r2_pmean = 1-mean((yobs(istart:end,:)-y0(istart:end,:)).^2)./mean(yobs(istart:end,:).^2);
end
clear stock_filter;
end
lnprior=NaN(nruns,1);
for j=1:nruns
lnprior(j,1) = priordens(x(j,:)',bayestopt_.pshape,bayestopt_.p6,bayestopt_.p7,bayestopt_.p3,bayestopt_.p4);
end
@ -242,7 +247,7 @@ if ~loadSA
end
end
end
else
else % loadSA
if options_.opt_gsa.lik_only && options_.opt_gsa.ppost==0
load([OutDir,filesep,fnamtmp, '.mat'],'x','logpo2','likelihood');
else
@ -252,27 +257,27 @@ else
nruns=size(x,1);
nfilt=floor(pfilt*nruns);
end
% smirnov tests
% Smirnov tests
nfilt0 = nfilt*ones(length(vvarvecm), 1);
logpo2=logpo2(:);
if ~options_.opt_gsa.ppost
[dum, ipost]=sort(-logpo2);
[dum, ilik]=sort(-likelihood);
[~, ipost]=sort(-logpo2);
[~, ilik]=sort(-likelihood);
end
% visual scatter analysis!
if options_.opt_gsa.ppost
tmp_title='R2 Posterior:';
atitle='R2 Posterior:';
tmp_title='R2 Scatter plot: Posterior';
atitle='R2 Scatter plot: Posterior';
asname='r2_post';
else
if options_.opt_gsa.pprior
tmp_title='R2 Prior:';
atitle='R2 Prior:';
tmp_title='R2 Scatter plot: Prior';
atitle='R2 Scatter plot: Prior';
asname='r2_prior';
else
tmp_title='R2 MC:';
atitle='R2 MC:';
tmp_title='R2 Scatter plot: MC';
atitle='R2 Scatter plot: MC';
asname='r2_mc';
end
end
@ -283,7 +288,7 @@ options_scatter.OutputDirectoryName = OutDir;
options_scatter.amcf_name = asname;
options_scatter.amcf_title = atitle;
options_scatter.title = tmp_title;
scatter_analysis(r2_MC, x,options_scatter, options_);
gsa.scatter_analysis(r2_MC, x,options_scatter, options_);
% end of visual scatter analysis
if ~options_.opt_gsa.ppost && options_.opt_gsa.lik_only
@ -297,13 +302,10 @@ if ~options_.opt_gsa.ppost && options_.opt_gsa.lik_only
options_mcf.pvalue_ks = alpha;
options_mcf.pvalue_corr = pvalue;
options_mcf.alpha2 = alpha2;
options_mcf.param_names = param_names;
if options_.TeX
[pnames,pnames_tex]=get_LaTeX_parameter_names(M_,options_,estim_params_,bayestopt_);
options_mcf.param_names = pnames;
options_mcf.param_names_tex = pnames_tex;
options_mcf.param_names_tex = param_names_tex;
else
[pnames]=get_LaTeX_parameter_names(M_,options_,estim_params_,bayestopt_);
options_mcf.param_names = pnames;
options_mcf.param_names_tex = {};
end
options_mcf.fname_ = fname_;
@ -313,7 +315,12 @@ if ~options_.opt_gsa.ppost && options_.opt_gsa.lik_only
options_mcf.title = atitle;
options_mcf.beha_title = 'better posterior kernel';
options_mcf.nobeha_title = 'worse posterior kernel';
mcf_analysis(x, ipost(1:nfilt), ipost(nfilt+1:end), options_mcf, options_);
if options_.TeX
options_mcf.beha_title_latex = 'better posterior kernel';
options_mcf.nobeha_title_latex = 'worse posterior kernel';
end
gsa.monte_carlo_filtering_analysis(x, ipost(1:nfilt), ipost(nfilt+1:end), options_mcf, M_, options_, bayestopt_, estim_params_);
if options_.opt_gsa.pprior
anam = 'rmse_prior_lik';
atitle = 'RMSE prior: Log Likelihood Kernel';
@ -326,15 +333,20 @@ if ~options_.opt_gsa.ppost && options_.opt_gsa.lik_only
options_mcf.title = atitle;
options_mcf.beha_title = 'better likelihood';
options_mcf.nobeha_title = 'worse likelihood';
mcf_analysis(x, ilik(1:nfilt), ilik(nfilt+1:end), options_mcf, options_);
if options_.TeX
options_mcf.beha_title_latex = 'better likelihood';
options_mcf.nobeha_title_latex = 'worse likelihood';
end
gsa.monte_carlo_filtering_analysis(x, ilik(1:nfilt), ilik(nfilt+1:end), options_mcf, M_, options_, bayestopt_, estim_params_);
else
if options_.opt_gsa.ppost
rmse_txt=rmse_pmean;
r2_txt=r2_pmean;
else
if options_.opt_gsa.pprior || ~exist('rmse_pmean')
if exist('rmse_mode')
if options_.opt_gsa.pprior || ~exist('rmse_pmean','var')
if exist('rmse_mode','var')
rmse_txt=rmse_mode;
r2_txt=r2_mode;
else
@ -346,18 +358,19 @@ else
r2_txt=r2_pmean;
end
end
ixx=NaN(size(rmse_MC,1),length(vvarvecm));
for i = 1:length(vvarvecm)
[dum, ixx(:,i)] = sort(rmse_MC(:,i));
[~, ixx(:,i)] = sort(rmse_MC(:,i));
end
PP = ones(npar+nshock, length(vvarvecm));
PPV = ones(length(vvarvecm), length(vvarvecm), npar+nshock);
SS = zeros(npar+nshock, length(vvarvecm));
for j = 1:npar+nshock
for i = 1:length(vvarvecm)
[H, P, KSSTAT] = smirnov(x(ixx(nfilt0(i)+1:end,i),j),x(ixx(1:nfilt0(i),i),j), alpha);
[H1, P1, KSSTAT1] = smirnov(x(ixx(nfilt0(i)+1:end,i),j),x(ixx(1:nfilt0(i),i),j),alpha,1);
[H2, P2, KSSTAT2] = smirnov(x(ixx(nfilt0(i)+1:end,i),j),x(ixx(1:nfilt0(i),i),j),alpha,-1);
if H1 & H2==0
[~, P] = gsa.smirnov_test(x(ixx(nfilt0(i)+1:end,i),j),x(ixx(1:nfilt0(i),i),j), alpha);
[H1] = gsa.smirnov_test(x(ixx(nfilt0(i)+1:end,i),j),x(ixx(1:nfilt0(i),i),j),alpha,1);
[H2] = gsa.smirnov_test(x(ixx(nfilt0(i)+1:end,i),j),x(ixx(1:nfilt0(i),i),j),alpha,-1);
if H1==0 && H2==0
SS(j,i)=1;
elseif H1==0
SS(j,i)=-1;
@ -369,7 +382,7 @@ else
for i = 1:length(vvarvecm)
for l = 1:length(vvarvecm)
if l~=i && PP(j,i)<alpha && PP(j,l)<alpha
[H,P,KSSTAT] = smirnov(x(ixx(1:nfilt0(i),i),j),x(ixx(1:nfilt0(l),l),j), alpha);
[~,P] = gsa.smirnov_test(x(ixx(1:nfilt0(i),i),j),x(ixx(1:nfilt0(l),l),j), alpha);
PPV(i,l,j) = P;
elseif l==i
PPV(i,l,j) = PP(j,i);
@ -391,34 +404,38 @@ else
end
if mod(i,9)==1
ifig=ifig+1;
hh=dyn_figure(options_.nodisplay,'name',[temp_name,' ',int2str(ifig)]);
hh_fig=dyn_figure(options_.nodisplay,'name',[temp_name,' ',int2str(ifig)]);
end
subplot(3,3,i-9*(ifig-1))
h=cumplot(lnprior(ixx(1:nfilt0(i),i)));
h=gsa.cumplot(lnprior(ixx(1:nfilt0(i),i)));
set(h,'color','blue','linewidth',2)
hold on, h=cumplot(lnprior);
hold on, h=gsa.cumplot(lnprior);
set(h,'color','k','linewidth',1)
h=cumplot(lnprior(ixx(nfilt0(i)+1:end,i)));
h=gsa.cumplot(lnprior(ixx(nfilt0(i)+1:end,i)));
set(h,'color','red','linewidth',2)
title(vvarvecm{i},'interpreter','none')
if options_.TeX
title(vvarvecm_tex{i},'interpreter','latex')
else
title(vvarvecm{i},'interpreter','none')
end
if mod(i,9)==0 || i==length(vvarvecm)
if ~isoctave
annotation('textbox', [0.1,0,0.35,0.05],'String', 'Log-prior for BETTER R2','Color','Blue','horizontalalignment','center');
annotation('textbox', [0.55,0,0.35,0.05],'String', 'Log-prior for WORSE R2', 'Color','Red','horizontalalignment','center');
end
if options_.opt_gsa.ppost
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_post_lnprior',int2str(ifig)],options_.nodisplay,options_.graph_format);
dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_post_lnprior',int2str(ifig)],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir '/' fname_ '_rmse_post_lnprior',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_post_lnprior',options_.figures.textwidth*min((i-9*(ifig-1))/3,1))
end
else
if options_.opt_gsa.pprior
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_lnprior',int2str(ifig) ],options_.nodisplay,options_.graph_format);
dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_prior_lnprior',int2str(ifig) ],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir '/' fname_ '_rmse_prior_lnprior',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_prior_lnprior',options_.figures.textwidth*min((i-9*(ifig-1))/3,1))
end
else
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_lnprior',int2str(ifig) ],options_.nodisplay,options_.graph_format);
dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_mc_lnprior',int2str(ifig) ],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir '/' fname_ '_rmse_mc_lnprior',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_mc_lnprior',options_.figures.textwidth*min((i-9*(ifig-1))/3,1))
end
@ -439,16 +456,20 @@ else
end
if mod(i,9)==1
ifig=ifig+1;
hh = dyn_figure(options_.nodisplay,'Name',[temp_name,' ',int2str(ifig)]);
hh_fig = dyn_figure(options_.nodisplay,'Name',[temp_name,' ',int2str(ifig)]);
end
subplot(3,3,i-9*(ifig-1))
h=cumplot(likelihood(ixx(1:nfilt0(i),i)));
h=gsa.cumplot(likelihood(ixx(1:nfilt0(i),i)));
set(h,'color','blue','linewidth',2)
hold on, h=cumplot(likelihood);
hold on, h=gsa.cumplot(likelihood);
set(h,'color','k','linewidth',1)
h=cumplot(likelihood(ixx(nfilt0(i)+1:end,i)));
h=gsa.cumplot(likelihood(ixx(nfilt0(i)+1:end,i)));
set(h,'color','red','linewidth',2)
title(vvarvecm{i},'interpreter','none')
if options_.TeX
title(vvarvecm_tex{i},'interpreter','latex')
else
title(vvarvecm{i},'interpreter','none')
end
if options_.opt_gsa.ppost==0
set(gca,'xlim',[min( likelihood(ixx(1:nfilt0(i),i)) ) max( likelihood(ixx(1:nfilt0(i),i)) )])
end
@ -458,18 +479,18 @@ else
annotation('textbox', [0.55,0,0.35,0.05],'String', 'Log-likelihood for WORSE R2', 'Color','Red','horizontalalignment','center');
end
if options_.opt_gsa.ppost
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_post_lnlik',int2str(ifig) ],options_.nodisplay,options_.graph_format);
dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_post_lnlik',int2str(ifig) ],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_post_lnprior',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_post_lnprior',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
end
else
if options_.opt_gsa.pprior
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_lnlik',int2str(ifig)],options_.nodisplay,options_.graph_format);
dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_prior_lnlik',int2str(ifig)],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_prior_lnlik',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_prior_lnlik',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
end
else
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_lnlik',int2str(ifig) ],options_.nodisplay,options_.graph_format);
dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_mc_lnlik',int2str(ifig) ],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_mc_lnlik',int2str(ifig) ],ifig,[temp_name,' ',int2str(ifig)],'rmse_mc_lnlik',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
end
@ -490,16 +511,20 @@ else
end
if mod(i,9)==1
ifig=ifig+1;
hh = dyn_figure(options_.nodisplay,'Name',[temp_name,' ',int2str(ifig)]);
hh_fig = dyn_figure(options_.nodisplay,'Name',[temp_name,' ',int2str(ifig)]);
end
subplot(3,3,i-9*(ifig-1))
h=cumplot(logpo2(ixx(1:nfilt0(i),i)));
h=gsa.cumplot(logpo2(ixx(1:nfilt0(i),i)));
set(h,'color','blue','linewidth',2)
hold on, h=cumplot(logpo2);
hold on, h=gsa.cumplot(logpo2);
set(h,'color','k','linewidth',1)
h=cumplot(logpo2(ixx(nfilt0(i)+1:end,i)));
h=gsa.cumplot(logpo2(ixx(nfilt0(i)+1:end,i)));
set(h,'color','red','linewidth',2)
title(vvarvecm{i},'interpreter','none')
if options_.TeX
title(vvarvecm_tex{i},'interpreter','latex')
else
title(vvarvecm{i},'interpreter','none')
end
if options_.opt_gsa.ppost==0
set(gca,'xlim',[min( logpo2(ixx(1:nfilt0(i),i)) ) max( logpo2(ixx(1:nfilt0(i),i)) )])
end
@ -509,18 +534,18 @@ else
annotation('textbox', [0.55,0,0.35,0.05],'String', 'Log-posterior for WORSE R2', 'Color','Red','horizontalalignment','center');
end
if options_.opt_gsa.ppost
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_post_lnpost',int2str(ifig) ],options_.nodisplay,options_.graph_format);
dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_post_lnpost',int2str(ifig) ],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_post_lnpost',int2str(ifig) ],ifig,[temp_name,' ',int2str(ifig)],'rmse_post_lnpost',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
end
else
if options_.opt_gsa.pprior
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_lnpost',int2str(ifig)],options_.nodisplay,options_.graph_format);
dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_prior_lnpost',int2str(ifig)],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_prior_lnpost',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_prior_lnpost',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
end
else
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_lnpost',int2str(ifig)],options_.nodisplay,options_.graph_format);
dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_mc_lnpost',int2str(ifig)],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_mc_lnpost',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_mc_lnpost',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
end
@ -529,15 +554,6 @@ else
end
end
end
if options_.TeX
[pnames,pnames_tex]=get_LaTeX_parameter_names(M_,options_,estim_params_,bayestopt_);
param_names = pnames;
param_names_tex = pnames_tex;
else
[pnames]=get_LaTeX_parameter_names(M_,options_,estim_params_,bayestopt_);
param_names = pnames;
param_names_tex = {};
end
skipline()
title_string='RMSE over the MC sample:';
data_mat=[min(rmse_MC)' max(rmse_MC)'];
@ -549,7 +565,7 @@ else
end
invar = find( std(rmse_MC)./mean(rmse_MC)<=0.0001 );
if ~isempty(invar)
skipline(2)
skipline(1)
disp('RMSE is not varying significantly over the MC sample for the following variables:')
disp(vvarvecm{invar})
disp('These variables are excluded from SA')
@ -561,8 +577,7 @@ else
rmse_MC = rmse_MC(:,ivar);
skipline()
disp(['Sample filtered the ',num2str(pfilt*100),'% best RMSE''s for each observed series ...' ])
skipline(2)
disp('RMSE ranges after filtering:')
skipline(1)
title_string='RMSE ranges after filtering:';
if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior
headers = {'Variable'; 'min'; 'max'; 'min'; 'max'; 'posterior mode'};
@ -589,7 +604,7 @@ else
else
values_length = max(ceil(max(max(log10(abs(data_mat(isfinite(data_mat))))))),1)+val_precis+1;
end
if any(data_mat) < 0 %add one character for minus sign
if any(data_mat < 0) %add one character for minus sign
values_length = values_length+1;
end
headers_length = cellofchararraymaxlength(headers(2:end));
@ -598,7 +613,6 @@ else
else
val_width = max(headers_length, values_length)+2;
end
value_format = sprintf('%%%d.%df',val_width,val_precis);
header_string_format = sprintf('%%%ds',val_width);
if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior
optional_header=sprintf([label_format_leftbound,header_string_format,header_string_format,header_string_format,header_string_format],'','',['best ',num2str(pfilt*100),'% filtered'],'','remaining 90%');
@ -610,7 +624,7 @@ else
if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior
optional_header={[' & \multicolumn{2}{c}{best ',num2str(pfilt*100),' filtered} & \multicolumn{2}{c}{remaining 90\%}\\']};
else
optional_header={[' & \multicolumn{2}{c}{best filtered} & \multicolumn{2}{c}{remaining}\\']};
optional_header={' & \multicolumn{2}{c}{best filtered} & \multicolumn{2}{c}{remaining}\\'};
end
dyn_latex_table(M_, options_, title_string, 'RMSE_ranges_after_filtering', headers_tex, vvarvecm_tex, data_mat, 0, val_width, val_precis, optional_header);
end
@ -657,7 +671,7 @@ else
else
values_length = max(ceil(max(max(log10(abs(data_mat(isfinite(data_mat))))))),1)+val_precis+1;
end
if any(data_mat) < 0 %add one character for minus sign
if any(data_mat < 0) %add one character for minus sign
values_length = values_length+1;
end
headers_length = cellofchararraymaxlength(headers(2:end));
@ -666,7 +680,6 @@ else
else
val_width = max(headers_length, values_length)+2;
end
value_format = sprintf('%%%d.%df',val_width,val_precis);
header_string_format = sprintf('%%%ds',val_width);
if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior
@ -679,7 +692,7 @@ else
if ~options_.opt_gsa.ppost && options_.opt_gsa.pprior
optional_header = {[' & \multicolumn{2}{c}{best ',num2str(pfilt*100),' filtered} & \multicolumn{2}{c}{remaining 90\%}\\']};
else
optional_header = {[' & \multicolumn{2}{c}{best filtered} & \multicolumn{2}{c}{remaining}\\']};
optional_header = {' & \multicolumn{2}{c}{best filtered} & \multicolumn{2}{c}{remaining}\\'};
end
dyn_latex_table(M_, options_, title_string, 'R2_ranges_after_filtering', headers_tex, vvarvecm_tex, data_mat, 0, val_width, val_precis, optional_header);
end
@ -690,16 +703,15 @@ else
SP(ns,j)=ones(size(ns));
SS(:,j)=SS(:,j).*SP(:,j);
end
for j=1:npar+nshock %estim_params_.np,
nsp=NaN(npar+nshock,1);
for j=1:npar+nshock
nsp(j)=length(find(SP(j,:)));
end
snam0=param_names(find(nsp==0));
snam1=param_names(find(nsp==1));
snam2=param_names(find(nsp>1));
snam=param_names(find(nsp>0));
snam0=param_names(nsp==0);
snam1=param_names(nsp==1);
snam2=param_names(nsp>1);
nsnam=(find(nsp>1));
skipline(2)
skipline(1)
disp('These parameters do not affect significantly the fit of ANY observed series:')
disp(char(snam0))
skipline()
@ -708,7 +720,6 @@ else
skipline()
disp('These parameters affect MORE THAN ONE observed series: trade off exists!')
disp(char(snam2))
pnam=bayestopt_.name;
% plot trade-offs
if ~options_.nograph
a00=jet(length(vvarvecm));
@ -740,62 +751,74 @@ else
options_mcf.amcf_title = [atitle ' ' vvarvecm{iy}];
options_mcf.beha_title = ['better fit of ' vvarvecm{iy}];
options_mcf.nobeha_title = ['worse fit of ' vvarvecm{iy}];
if options_.TeX
options_mcf.beha_title_latex = ['better fit of ' vvarvecm_tex{iy}];
options_mcf.nobeha_title_latex = ['worse fit of ' vvarvecm_tex{iy}];
end
options_mcf.title = ['the fit of ' vvarvecm{iy}];
mcf_analysis(x, ixx(1:nfilt0(iy),iy), ixx(nfilt0(iy)+1:end,iy), options_mcf, options_);
gsa.monte_carlo_filtering_analysis(x, ixx(1:nfilt0(iy),iy), ixx(nfilt0(iy)+1:end,iy), options_mcf, M_, options_, bayestopt_, estim_params_);
end
for iy = 1:length(vvarvecm)
ipar = find(any(squeeze(PPV(iy,:,:))<alpha));
for ix=1:ceil(length(ipar)/5)
hh = dyn_figure(options_.nodisplay,'name',[temp_name,' observed variable ', vvarvecm{iy}]);
hh_fig = dyn_figure(options_.nodisplay,'name',[temp_name,' observed variable ', vvarvecm{iy}]);
for j=1+5*(ix-1):min(length(ipar),5*ix)
subplot(2,3,j-5*(ix-1))
h0=cumplot(x(:,ipar(j)));
h0=gsa.cumplot(x(:,ipar(j)));
set(h0,'color',[0 0 0])
hold on,
iobs=find(squeeze(PPV(iy,:,ipar(j)))<alpha);
for i = 1:length(vvarvecm)
if any(iobs==i) || i==iy
h0=cumplot(x(ixx(1:nfilt0(i),i),ipar(j)));
h0=gsa.cumplot(x(ixx(1:nfilt0(i),i),ipar(j)));
if ~isoctave
hcmenu = uicontextmenu;
uimenu(hcmenu,'Label',vvarvecm{i});
set(h0,'uicontextmenu',hcmenu)
end
else
h0=cumplot(x(ixx(1:nfilt0(i),i),ipar(j))*NaN);
h0=gsa.cumplot(x(ixx(1:nfilt0(i),i),ipar(j))*NaN);
end
set(h0,'color',a00(i,:),'linewidth',2)
end
ydum=get(gca,'ylim');
if exist('xparam1')
if exist('xparam1','var')
xdum=xparam1(ipar(j));
h1=plot([xdum xdum],ydum);
set(h1,'color',[0.85 0.85 0.85],'linewidth',2)
end
xlabel('')
title([pnam{ipar(j)}],'interpreter','none')
if options_.TeX
title([param_names_tex{ipar(j)}],'interpreter','latex')
else
title([param_names{ipar(j)}],'interpreter','none')
end
end
if isoctave
legend(vertcat('base',vvarvecm),'location','eastoutside');
else
h0=legend(vertcat('base',vvarvecm));
set(h0,'fontsize',6,'position',[0.7 0.1 0.2 0.3],'interpreter','none');
if options_.TeX
h0=legend(vertcat('base',vvarvecm_tex),'interpreter','latex');
else
h0=legend(vertcat('base',vvarvecm),'interpreter','none');
end
set(h0,'fontsize',6,'position',[0.7 0.1 0.2 0.3]);
end
if options_.opt_gsa.ppost
dyn_saveas(hh,[ OutDir filesep fname_ '_rmse_post_' vvarvecm{iy} '_' int2str(ix)],options_.nodisplay,options_.graph_format);
dyn_saveas(hh_fig,[ OutDir filesep fname_ '_rmse_post_' vvarvecm{iy} '_' int2str(ix)],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[ OutDir filesep fname_ '_rmse_post_' vvarvecm{iy} '_' int2str(ix)],ix,[temp_name,' observed variable $',vvarvecm_tex{iy} '$'],['rmse_post_' vvarvecm{iy}],1)
create_TeX_loader(options_,[ OutDir filesep fname_ '_rmse_post_' vvarvecm{iy} '_' int2str(ix)],ix,[temp_name,' observed variable ',vvarvecm_tex{iy} ],['rmse_post_' vvarvecm{iy}],1)
end
else
if options_.opt_gsa.pprior
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_' vvarvecm{iy} '_' int2str(ix) ],options_.nodisplay,options_.graph_format);
dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_prior_' vvarvecm{iy} '_' int2str(ix) ],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_prior_' vvarvecm{iy} '_' int2str(ix) ],ix,[temp_name,' observed variable $',vvarvecm_tex{iy} '$'],['rmse_prior_' vvarvecm{iy}],1)
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_prior_' vvarvecm{iy} '_' int2str(ix) ],ix,[temp_name,' observed variable ',vvarvecm_tex{iy}],['rmse_prior_' vvarvecm{iy}],1)
end
else
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_' vvarvecm{iy} '_' int2str(ix)],options_.nodisplay,options_.graph_format);
dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_mc_' vvarvecm{iy} '_' int2str(ix)],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_mc_' vvarvecm{iy} '_' int2str(ix)],ix,[temp_name,' observed variable $',vvarvecm_tex{iy} '$'],['rmse_mc_' vvarvecm{iy}],1)
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_mc_' vvarvecm{iy} '_' int2str(ix)],ix,[temp_name,' observed variable ',vvarvecm_tex{iy}],['rmse_mc_' vvarvecm{iy}],1)
end
end
end
@ -803,18 +826,18 @@ else
end
% now I plot by individual parameters
for ix=1:ceil(length(nsnam)/5)
hh = dyn_figure(options_.nodisplay,'name',[temp_name,' estimated params and shocks ',int2str(ix)]);
hh_fig = dyn_figure(options_.nodisplay,'name',[temp_name,' estimated params and shocks ',int2str(ix)]);
for j=1+5*(ix-1):min(size(snam2,1),5*ix)
subplot(2,3,j-5*(ix-1))
h0=cumplot(x(:,nsnam(j)));
h0=gsa.cumplot(x(:,nsnam(j)));
set(h0,'color',[0 0 0])
hold on,
npx=find(SP(nsnam(j),:)==0);
for i = 1:length(vvarvecm)
if any(npx==i)
h0=cumplot(x(ixx(1:nfilt0(i),i),nsnam(j))*NaN);
h0=gsa.cumplot(x(ixx(1:nfilt0(i),i),nsnam(j))*NaN);
else
h0=cumplot(x(ixx(1:nfilt0(i),i),nsnam(j)));
h0=gsa.cumplot(x(ixx(1:nfilt0(i),i),nsnam(j)));
if ~isoctave
hcmenu = uicontextmenu;
uimenu(hcmenu,'Label', vvarvecm{i});
@ -824,34 +847,42 @@ else
set(h0,'color',a00(i,:),'linewidth',2)
end
ydum=get(gca,'ylim');
if exist('xparam1')
if exist('xparam1','var')
xdum=xparam1(nsnam(j));
h1=plot([xdum xdum],ydum);
set(h1,'color',[0.85 0.85 0.85],'linewidth',2)
end
xlabel('')
title([pnam{nsnam(j)}],'interpreter','none')
if options_.TeX
title([param_names_tex{nsnam(j)}],'interpreter','latex')
else
title([param_names{nsnam(j)}],'interpreter','none')
end
end
%subplot(3,2,6)
if isoctave
legend(vertcat('base',vvarvecm),'location','eastoutside');
else
h0=legend(vertcat('base',vvarvecm));
set(h0,'fontsize',6,'position',[0.7 0.1 0.2 0.3],'interpreter','none');
if options_.TeX
h0=legend(vertcat('base',vvarvecm_tex),'interpreter','latex');
else
h0=legend(vertcat('base',vvarvecm),'interpreter','none');
end
set(h0,'fontsize',6,'position',[0.7 0.1 0.2 0.3]);
end
if options_.opt_gsa.ppost
dyn_saveas(hh,[ OutDir filesep fname_ '_rmse_post_params_' int2str(ix)],options_.nodisplay,options_.graph_format);
dyn_saveas(hh_fig,[ OutDir filesep fname_ '_rmse_post_params_' int2str(ix)],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[ OutDir filesep fname_ '_rmse_post_params_' int2str(ix)],ix,[temp_name,' estimated params and shocks ',int2str(ix)],'rmse_post_params',1)
end
else
if options_.opt_gsa.pprior
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_params_' int2str(ix) ],options_.nodisplay,options_.graph_format);
dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_prior_params_' int2str(ix) ],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_prior_params_' int2str(ix) ],ix,[temp_name,' estimated params and shocks ',int2str(ix)],'rmse_prior_params',1)
end
else
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_params_' int2str(ix)],options_.nodisplay,options_.graph_format);
dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_mc_params_' int2str(ix)],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_mc_params_' int2str(ix)],ix,[temp_name,' estimated params and shocks ',int2str(ix)],'rmse_mc_params',1)
end
@ -885,11 +916,11 @@ pnames=cell(np,1);
pnames_tex=cell(np,1);
for ii=1:length(bayestopt_.name)
if options_.TeX
[param_name_temp, param_name_tex_temp]= get_the_name(ii,options_.TeX,M_,estim_params_,options_);
pnames_tex{ii,1} = strrep(param_name_tex_temp,'$','');
[param_name_temp, param_name_tex_temp]= get_the_name(ii,options_.TeX,M_,estim_params_,options_.varobs);
pnames_tex{ii,1} = param_name_tex_temp;
pnames{ii,1} = param_name_temp;
else
param_name_temp = get_the_name(ii,options_.TeX,M_,estim_params_,options_);
param_name_temp = get_the_name(ii,options_.TeX,M_,estim_params_,options_.varobs);
pnames{ii,1} = param_name_temp;
end
end

View File

@ -0,0 +1,115 @@
function indmcf = monte_carlo_filtering_analysis(lpmat, ibeha, inobeha, options_mcf, M_, options_, bayestopt_, estim_params_)
% indmcf = monte_carlo_filtering_analysis(lpmat, ibeha, inobeha, options_mcf, M_, options_, bayestopt_, estim_params_)
% Inputs:
% - lpmat [double] Monte Carlo matrix
% - ibeha [integer] index of behavioural runs
% - inobeha [integer] index of non-behavioural runs
% - options_gsa_ [structure] GSA options_
% - M_ [structure] describing the model
% - options_ [structure] describing the options
% - bayestopt_ [structure] describing the priors
% - estim_params_ [structure] characterizing parameters to be estimated
%
% Outputs:
% - indmcf [double] results of matrix
% Written by Marco Ratto
% Joint Research Centre, The European Commission,
% marco.ratto@ec.europa.eu
%
% Copyright © 2014 European Commission
% Copyright © 2016-2023 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
pvalue_ks = options_mcf.pvalue_ks;
pvalue_corr = options_mcf.pvalue_corr;
alpha2 = options_mcf.alpha2;
param_names = options_mcf.param_names;
if options_.TeX
if ~isfield(options_mcf,'param_names_tex')
param_names_tex = options_mcf.param_names;
else
param_names_tex = options_mcf.param_names_tex;
end
else
param_names_tex = strrep(options_mcf.param_names,'_','\_');
end
amcf_name = options_mcf.amcf_name;
amcf_title = options_mcf.amcf_title;
beha_title = options_mcf.beha_title;
nobeha_title = options_mcf.nobeha_title;
if options_.TeX
beha_title_latex = options_mcf.beha_title_latex;
nobeha_title_latex = options_mcf.nobeha_title_latex;
end
title = options_mcf.title;
fname_ = options_mcf.fname_;
xparam1=[];
if isfield(options_mcf,'xparam1')
xparam1=options_mcf.xparam1;
end
OutputDirectoryName = options_mcf.OutputDirectoryName;
[proba, dproba] = gsa.stability_mapping_univariate(lpmat, ibeha, inobeha, [],fname_, options_, bayestopt_.name, estim_params_,0);
indmcf=find(proba<pvalue_ks);
[~,jtmp] = sort(proba(indmcf),1,'ascend');
indmcf = indmcf(jtmp);
if ~isempty(indmcf)
skipline()
headers = {'Parameter','d-stat','p-value'};
labels = param_names(indmcf);
data_mat=[dproba(indmcf) proba(indmcf)];
options_temp.noprint=0;
dyntable(options_temp,['Smirnov statistics in driving ', title],headers,labels,data_mat,size(labels,2)+2,16,3);
if options_.TeX
labels_TeX=param_names_tex(indmcf);
M_temp.dname=OutputDirectoryName ;
M_temp.fname=fname_;
dyn_latex_table(M_temp,options_temp,['Smirnov statistics in driving ', strrep(title,'_','\\_')],amcf_name,headers,labels_TeX,data_mat,size(labels,2)+2,16,6);
end
end
if length(ibeha)>10 && length(inobeha)>10
if options_.TeX
indcorr1 = gsa.stability_mapping_bivariate(lpmat(ibeha,:),alpha2, pvalue_corr, M_, options_, bayestopt_, estim_params_, beha_title, beha_title_latex);
indcorr2 = gsa.stability_mapping_bivariate(lpmat(inobeha,:),alpha2, pvalue_corr, M_, options_, bayestopt_, estim_params_, nobeha_title, nobeha_title_latex);
else
indcorr1 = gsa.stability_mapping_bivariate(lpmat(ibeha,:),alpha2, pvalue_corr, M_, options_, bayestopt_, estim_params_, beha_title);
indcorr2 = gsa.stability_mapping_bivariate(lpmat(inobeha,:),alpha2, pvalue_corr, M_, options_, bayestopt_, estim_params_, nobeha_title);
end
indcorr = union(indcorr1(:), indcorr2(:));
indcorr = indcorr(~ismember(indcorr(:),indmcf));
indmcf = [indmcf(:); indcorr(:)];
end
if ~isempty(indmcf) && ~options_.nograph
skipline()
xx=[];
if ~ isempty(xparam1)
xx=xparam1(indmcf);
end
if options_.TeX
gsa.scatter_mcf(lpmat(ibeha,indmcf),lpmat(inobeha,indmcf), param_names_tex(indmcf), ...
'.', [fname_,'_',amcf_name], OutputDirectoryName, amcf_title,xx, options_, ...
beha_title, nobeha_title, beha_title_latex, nobeha_title_latex)
else
gsa.scatter_mcf(lpmat(ibeha,indmcf),lpmat(inobeha,indmcf), param_names_tex(indmcf), ...
'.', [fname_,'_',amcf_name], OutputDirectoryName, amcf_title,xx, options_, ...
beha_title, nobeha_title)
end
end

View File

@ -0,0 +1,60 @@
function [vdec, cc, ac] = monte_carlo_moments(mm, ss, dr, M_, options_, estim_params_)
% [vdec, cc, ac] = monte_carlo_moments(mm, ss, dr, M_, options_,estim_params_)
% Conduct Monte Carlo simulation of second moments for GSA
% Inputs:
% - dr [structure] decision rules
% - M_ [structure] model structure
% - options_ [structure] Matlab's structure describing the current options
% - estim_params_ [structure] characterizing parameters to be estimated
%
% Outputs:
% - vdec [double] variance decomposition matrix
% - cc [double] vector of unique elements of cross correlation matrix
% - ac [cell] autocorrelation matrix
% Copyright © 2012-2023 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
[~, nc1, nsam] = size(mm);
nobs=length(options_.varobs);
disp('monte_carlo_moments: Computing theoretical moments ...')
h = dyn_waitbar(0,'Theoretical moments ...');
vdec = zeros(nobs,M_.exo_nbr,nsam);
cc = zeros(nobs,nobs,nsam);
ac = zeros(nobs,nobs*options_.ar,nsam);
for j=1:nsam
dr.ghx = mm(:, 1:(nc1-M_.exo_nbr),j);
dr.ghu = mm(:, (nc1-M_.exo_nbr+1):end, j);
if ~isempty(ss)
M_=gsa.set_shocks_param(M_,estim_params_,ss(j,:));
end
[vdec(:,:,j), corr, autocorr] = gsa.th_moments(dr,options_,M_);
cc(:,:,j)=triu(corr);
dum=NaN(nobs,nobs*options_.ar);
for i=1:options_.ar
dum(:,(i-1)*nobs+1:i*nobs)=autocorr{i};
end
ac(:,:,j)=dum;
if mod(j,3)==0
dyn_waitbar(j/nsam,h)
end
end
dyn_waitbar_close(h)
skipline()
disp('... done !')

View File

@ -1,9 +1,14 @@
function pdraw = prior_draw_gsa(init,rdraw)
function pdraw = prior_draw(M_,bayestopt_,options_,estim_params_,init,rdraw)
% pdraw = prior_draw(M_,bayestopt_,options_,estim_params_,init,rdraw)
% Draws from the prior distributions for use with Sensitivity Toolbox for DYNARE
%
% INPUTS
% o init [integer] scalar equal to 1 (first call) or 0.
% o rdraw
% - M_ [structure] describing the model
% - bayestopt_ [structure] describing the priors
% - options_ [structure] describing the options
% - estim_params_ [structure] characterizing parameters to be estimated
% - init [integer] scalar equal to 1 (first call) or 0.
% - rdraw
%
% OUTPUTS
% o pdraw [double] draw from the joint prior density.
@ -35,8 +40,7 @@ function pdraw = prior_draw_gsa(init,rdraw)
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
global bayestopt_ options_ estim_params_ M_
persistent npar pshape p6 p7 p3 p4 lbcum ubcum
if init
@ -49,7 +53,7 @@ if init
pdraw = zeros(npar,1);
lbcum = zeros(npar,1);
ubcum = ones(npar,1);
[~,~,~,lb,ub,~] = set_prior(estim_params_,M_,options_); %Prepare bounds
[~,~,~,lb,ub] = set_prior(estim_params_,M_,options_); %Prepare bounds
if ~isempty(bayestopt_) && any(bayestopt_.pshape > 0)
% Set prior bounds
bounds = prior_bounds(bayestopt_, options_.prior_trunc);
@ -64,29 +68,29 @@ if init
% set bounds for cumulative probabilities
for i = 1:npar
switch pshape(i)
case 5% Uniform prior.
p4(i) = min(p4(i),bounds.ub(i));
p3(i) = max(p3(i),bounds.lb(i));
case 3% Gaussian prior.
lbcum(i) = 0.5 * erfc(-(bounds.lb(i)-p6(i))/p7(i) ./ sqrt(2));
ubcum(i) = 0.5 * erfc(-(bounds.ub(i)-p6(i))/p7(i) ./ sqrt(2));
case 2% Gamma prior.
lbcum(i) = gamcdf(bounds.lb(i)-p3(i),p6(i),p7(i));
ubcum(i) = gamcdf(bounds.ub(i)-p3(i),p6(i),p7(i));
case 1% Beta distribution (TODO: generalized beta distribution)
lbcum(i) = betainc((bounds.lb(i)-p3(i))./(p4(i)-p3(i)),p6(i),p7(i));
ubcum(i) = betainc((bounds.ub(i)-p3(i))./(p4(i)-p3(i)),p6(i),p7(i));
case 2% Gamma prior.
lbcum(i) = gamcdf(bounds.lb(i)-p3(i),p6(i),p7(i));
ubcum(i) = gamcdf(bounds.ub(i)-p3(i),p6(i),p7(i));
case 3% Gaussian prior.
lbcum(i) = 0.5 * erfc(-(bounds.lb(i)-p6(i))/p7(i) ./ sqrt(2));
ubcum(i) = 0.5 * erfc(-(bounds.ub(i)-p6(i))/p7(i) ./ sqrt(2));
case 4% INV-GAMMA1 distribution
% TO BE CHECKED
lbcum(i) = gamcdf(1/(bounds.ub(i)-p3(i))^2,p7(i)/2,2/p6(i));
ubcum(i) = gamcdf(1/(bounds.lb(i)-p3(i))^2,p7(i)/2,2/p6(i));
case 5% Uniform prior.
p4(i) = min(p4(i),bounds.ub(i));
p3(i) = max(p3(i),bounds.lb(i));
case 6% INV-GAMMA2 distribution
% TO BE CHECKED
lbcum(i) = gamcdf(1/(bounds.ub(i)-p3(i)),p7(i)/2,2/p6(i));
ubcum(i) = gamcdf(1/(bounds.lb(i)-p3(i)),p7(i)/2,2/p6(i));
case 8
lbcum(i) = weibcdf(bounds.lb(i)-p3(i),p6(i),p7(i));
ubcum(i) = weibcdf(bounds.ub(i)-p3(i),p6(i),p7(i));
lbcum(i) = wblcdf(bounds.lb(i)-p3(i),p6(i),p7(i));
ubcum(i) = wblcdf(bounds.ub(i)-p3(i),p6(i),p7(i));
otherwise
% Nothing to do here.
end
@ -94,7 +98,7 @@ if init
return
end
pdraw=NaN(size(rdraw,1),npar);
for i = 1:npar
rdraw(:,i) = rdraw(:,i).*(ubcum(i)-lbcum(i))+lbcum(i);
switch pshape(i)

Some files were not shown because too many files have changed in this diff Show More