From 9e40cb0e6b1a592414d737a106a95465d4e245e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=28Charybdis=29?= Date: Tue, 24 Jul 2018 12:59:42 +0200 Subject: [PATCH 1/7] Changed remote for matlab/particles submodule. --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index c6a396a39..ec91857fd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -15,7 +15,7 @@ url = https://github.com/DynareTeam/m-unit-tests.git [submodule "matlab/particles"] path = matlab/particles - url = https://github.com/DynareTeam/particles.git + url = https://git.dynare.org/Dynare/particles.git [submodule "matlab/modules/dates"] path = matlab/modules/dates url = https://github.com/DynareTeam/dates.git From 157641ac9118b9620bd8e515ae28e103a0de31b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=28Charybdis=29?= Date: Tue, 24 Jul 2018 14:12:53 +0200 Subject: [PATCH 2/7] Updated particles submodule. --- matlab/particles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matlab/particles b/matlab/particles index 857168ddf..66867386e 160000 --- a/matlab/particles +++ b/matlab/particles @@ -1 +1 @@ -Subproject commit 857168ddf8c2d386dac875da1ede31fd689be309 +Subproject commit 66867386ef5c70e8db69293af8a0e051488196f1 From 433a68169d3a1576992bdf523c3265d17679f23f Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Fri, 29 Jun 2018 15:05:15 +0200 Subject: [PATCH 3/7] TaRB: fix bug where incorrect last posterior was returned if last draw was rejected --- matlab/posterior_sampler_iteration.m | 60 ++++++++++++++++++---------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/matlab/posterior_sampler_iteration.m b/matlab/posterior_sampler_iteration.m index 5b54e785e..a6366c1c2 100644 --- a/matlab/posterior_sampler_iteration.m +++ b/matlab/posterior_sampler_iteration.m @@ -4,16 +4,29 @@ function [par, logpost, accepted, neval] = posterior_sampler_iteration(TargetFu % posterior samplers % % INPUTS -% posterior_sampler_options: posterior sampler options -% options_: structure storing the options - +% TargetFun: string storing the objective function (e.g. 'dsge_likelihood.m') +% last_draw: parameter vector in last iteration +% last_posterior: value of the posterior in last iteration +% sampler_options: posterior sampler options +% dataset_: the dataset after required transformation +% dataset_info: Various informations about the dataset (descriptive statistics and missing observations). +% options_: structure storing the options +% M_: structure storing the model information +% estim_params_: structure storing information about estimated parameters +% bayestopt_: structure storing information about priors +% mh_bounds: structure containing prior bounds +% oo_: structure storing the results +% % OUTPUTS -% posterior_sampler_options: checked posterior sampler options +% par: last accepted parameter vector +% logpost: value of the posterior after current iteration +% accepted: share of proposed draws that were accepted +% neval: number of evaluations (>1 only for slice) % % SPECIAL REQUIREMENTS % none -% Copyright (C) 2015-16 Dynare Team +% Copyright (C) 2015-18 Dynare Team % % This file is part of Dynare. % @@ -121,28 +134,31 @@ switch posterior_sampling_method else logpost = -inf; end - %get ratio of proposal densities, required because proposal depends - %on current mode via Hessian and is thus not symmetric anymore - if strcmpi(sampler_options.proposal_distribution,'rand_multivariate_normal') - proposal_density_proposed_move_forward=multivariate_normal_pdf(proposed_par,xopt_current_block',proposal_covariance_Cholesky_decomposition_upper,n); - proposal_density_proposed_move_backward=multivariate_normal_pdf(par_start_current_block',xopt_current_block',proposal_covariance_Cholesky_decomposition_upper,n); - elseif strcmpi(sampler_options.proposal_distribution,'rand_multivariate_student') - proposal_density_proposed_move_forward=multivariate_student_pdf(proposed_par,xopt_current_block',proposal_covariance_Cholesky_decomposition_upper,n); - proposal_density_proposed_move_backward=multivariate_student_pdf(par_start_current_block',xopt_current_block',proposal_covariance_Cholesky_decomposition_upper,n); - end - accprob=logpost-last_posterior+ log(proposal_density_proposed_move_backward)-log(proposal_density_proposed_move_forward); %Formula (6), Chib/Ramamurthy - - if (logpost > -inf) && (log(rand) < accprob) - current_draw(indices(blocks==block_iter,1))=proposed_par; - last_posterior=logpost; - accepted_draws_counter =accepted_draws_counter +1; - else %no updating - %do nothing, keep old value + + if (logpost > -inf) + %get ratio of proposal densities, required because proposal depends + %on current mode via Hessian and is thus not symmetric anymore + if strcmpi(sampler_options.proposal_distribution,'rand_multivariate_normal') + proposal_density_proposed_move_forward=multivariate_normal_pdf(proposed_par,xopt_current_block',proposal_covariance_Cholesky_decomposition_upper,n); + proposal_density_proposed_move_backward=multivariate_normal_pdf(par_start_current_block',xopt_current_block',proposal_covariance_Cholesky_decomposition_upper,n); + elseif strcmpi(sampler_options.proposal_distribution,'rand_multivariate_student') + proposal_density_proposed_move_forward=multivariate_student_pdf(proposed_par,xopt_current_block',proposal_covariance_Cholesky_decomposition_upper,n); + proposal_density_proposed_move_backward=multivariate_student_pdf(par_start_current_block',xopt_current_block',proposal_covariance_Cholesky_decomposition_upper,n); + end + accprob=logpost-last_posterior+ log(proposal_density_proposed_move_backward)-log(proposal_density_proposed_move_forward); %Formula (6), Chib/Ramamurthy + if (log(rand) < accprob) + current_draw(indices(blocks==block_iter,1))=proposed_par; + last_posterior=logpost; + accepted_draws_counter =accepted_draws_counter +1; + else %no updating + %do nothing, keep old value + end end end accepted=accepted_draws_counter/blocked_draws_counter; par = current_draw; neval=1; + logpost = last_posterior; %make sure not a temporary draw is returned; case 'independent_metropolis_hastings' neval = 1; ProposalFun = sampler_options.proposal_distribution; From 1bd74c470459b0e791cde50cc2d3d0365d4e675d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=28Charybdis=29?= Date: Wed, 25 Jul 2018 17:01:02 +0200 Subject: [PATCH 4/7] Updated NEWS (4.5.6 release). --- NEWS | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/NEWS b/NEWS index 3fcc13c7e..0aac10872 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,49 @@ +Announcement for Dynare 4.5.6 (on 2018-07-25) +============================================= + +We are pleased to announce the release of Dynare 4.5.6. + +This is a bugfix release. + +The Windows packages are already available for download at: + + http://www.dynare.org/download/dynare-stable + +The Mac and GNU/Linux packages (for Debian and Ubuntu LTS) should follow soon. + +This release is compatible with MATLAB versions 7.5 (R2007b) to 9.3 (R2018a) +and with GNU Octave versions 4.4. + +Here is a list of the problems identified in version 4.5.5 and that have been +fixed in version 4.5.6: + + - TaRB sampler: incorrect last posterior was returned if the last draw was + rejected. + + - Fixed online particle filter by drawing initial conditions in the prior + distribution.x + + - Fixed evaluation of the likelihood in non linear / particle filters. + + - Added missing documented `montecarlo` option in Gaussian Filter and + Nonlinear Kalman Filter. + + - Added back a flag to deal with errors on Cholesky decomposition in the + Conditional Particle Filter. + + - Macroprocessor `length()` operator was returning 1 when applied to a + string. Macroprocessor now raises an error when `length()` operator is + called on an integer and return the number of characters when applied to a + string. + + - `mode_compute=8`: the error code during mode-finding was not correctly + handled, resulting in crashes. + + - Identification was not correctly displaying a message for collinear parameters + if there was no unidentified parameter present. + + + Announcement for Dynare 4.5.5 (on 2018-06-08) ============================================= From 0da4aefd99bdff86a21a9ba1e854c924f1dd1f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Wed, 25 Jul 2018 18:51:03 +0200 Subject: [PATCH 5/7] Update preprocessor submodule with macroprocessor refactoring By the way, add new tests for the macroprocessor. --- preprocessor | 2 +- tests/Makefile.am | 2 +- ...xample1_macroif.mod => example1_macro.mod} | 36 ++++++++++++++++++- 3 files changed, 37 insertions(+), 3 deletions(-) rename tests/{example1_macroif.mod => example1_macro.mod} (58%) diff --git a/preprocessor b/preprocessor index 49e1c43ae..9cf3e034d 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit 49e1c43aed1acd80237d7fe911603ac4dd52d67d +Subproject commit 9cf3e034de954f9b221fd72f6cd02334d47bda89 diff --git a/tests/Makefile.am b/tests/Makefile.am index 651f1ba03..a9472adfe 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -64,7 +64,7 @@ MODFILES = \ example1_with_tags.mod \ example1_irf_shocks.mod \ example1_abs_sign.mod \ - example1_macroif.mod \ + example1_macro.mod \ example1long.mod \ example2long.mod \ example2long_use_dll.mod \ diff --git a/tests/example1_macroif.mod b/tests/example1_macro.mod similarity index 58% rename from tests/example1_macroif.mod rename to tests/example1_macro.mod index 02749cc3b..34a81277f 100644 --- a/tests/example1_macroif.mod +++ b/tests/example1_macro.mod @@ -1,4 +1,5 @@ -// Example 1 from Collard's guide to Dynare +// Various tests for the macroprocessor + var y, c, k, a, h, b; varexo e, u; @@ -21,6 +22,39 @@ theta = 2.95; phi = 0.1; @#endif +@#define a = 5 +@#define b = 2*(a + 3)/4-1 +@#if b != 3 +@#error "Arithmetic problem" +@#endif + +@#define v = [ "a", 1, 2:3] +@#define empty = [] +@#define z = v[2:3] +@#if z != [ 1, [ 2, 3 ]] || length(v) != 3 || 5 in v || !("a" in v) || length(empty) != 0 +@#error "Array problem" +@#endif + +@#define w = [ 1 ] +@#for elt in v +@#define w = w + [ elt ] +@#endfor +@#if w != [ 1, "a", 1, 2:3] +@#error "For loop problem" +@#endif + +@#define s = "abcde" +@#if length(s) != 5 || s[3:4] != "cd" +@#error "String problem" +@#endif + +@#define f(y, z) = "@{y}bar@{z}" +@#if f("foo", "baz") != "foobarbaz" +@#error "Function problem" +@#endif + + + model; c*theta*h^(1+psi)=(1-alpha)*y; k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) From 7087534baeea5a2f09888dea4acca63d20742cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=28Charybdis=29?= Date: Thu, 26 Jul 2018 11:04:45 +0200 Subject: [PATCH 6/7] Fixed typo. --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 0aac10872..3ad74e2f2 100644 --- a/NEWS +++ b/NEWS @@ -21,7 +21,7 @@ fixed in version 4.5.6: rejected. - Fixed online particle filter by drawing initial conditions in the prior - distribution.x + distribution. - Fixed evaluation of the likelihood in non linear / particle filters. From df3942b4393ac44a2a4063ff3acd463b12714d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=28Charybdis=29?= Date: Fri, 27 Jul 2018 09:45:51 +0200 Subject: [PATCH 7/7] Updated preprocessor submodule. --- preprocessor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preprocessor b/preprocessor index 9cf3e034d..762f25abe 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit 9cf3e034de954f9b221fd72f6cd02334d47bda89 +Subproject commit 762f25abe9ad2681c2a049ddcb0be85bcfcf1306