From 9506e723c9e3a16c005320b6db1ee3ba32813b89 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Tue, 20 Sep 2022 12:42:04 +0200 Subject: [PATCH 1/2] ispd.m: filter out Octave incompatibility https://savannah.gnu.org/bugs/?63082 --- matlab/utilities/general/ispd.m | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/matlab/utilities/general/ispd.m b/matlab/utilities/general/ispd.m index a88f90e31..ff6ec1291 100644 --- a/matlab/utilities/general/ispd.m +++ b/matlab/utilities/general/ispd.m @@ -24,7 +24,7 @@ function [test, penalty] = ispd(A) %! @end deftypefn %@eod: -% Copyright © 2007-2017 Dynare Team +% Copyright © 2007-2022 Dynare Team % % This file is part of Dynare. % @@ -45,16 +45,20 @@ if ~isquare(A) error(['ispd:: Input argument ' inputname(1) ' has to be a square matrix!']) end -[cholA, info] = chol(A); +[~, info] = chol(A); test = ~info; if nargout>1 penalty = 0; if info - a = diag(eig(A)); - k = find(a<0); - if k > 0 - penalty = sum(-a(k)); + if isoctave && any(any(~isfinite(A))) % workaround for https://savannah.gnu.org/bugs/index.php?63082 + penalty = 1; + else + a = diag(eig(A)); + k = find(a<0); + if k > 0 + penalty = sum(-a(k)); + end end end end \ No newline at end of file From 563035d07007fa544806ff7e6f1f9d48b182ae6a Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Tue, 20 Sep 2022 12:55:30 +0200 Subject: [PATCH 2/2] AnScho/AnScho_MoM_common.inc: use csminwel to prevent fmincon problems under Octave --- .../method_of_moments/AnScho/AnScho_MoM_common.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/estimation/method_of_moments/AnScho/AnScho_MoM_common.inc b/tests/estimation/method_of_moments/AnScho/AnScho_MoM_common.inc index 28a3a8e35..6ba8a8f8a 100644 --- a/tests/estimation/method_of_moments/AnScho/AnScho_MoM_common.inc +++ b/tests/estimation/method_of_moments/AnScho/AnScho_MoM_common.inc @@ -210,10 +210,10 @@ method_of_moments( , se_tolx=1e-6 % step size for numerical computation of standard errors % Options for SMM - % , burnin=500 % number of periods dropped at beginning of simulation + , burnin=50 % number of periods dropped at beginning of simulation , bounded_shock_support % trim shocks in simulation to +- 2 stdev % , seed = 24051986 % seed used in simulations - % , simulation_multiple = 5 % multiple of the data length used for simulation + , simulation_multiple = 5 % multiple of the data length used for simulation % Options for GMM @#if MoM_Method == "GMM" @@ -244,7 +244,7 @@ method_of_moments( , mode_compute = 0 @#else , mode_compute = 13 % specifies the optimizer for minimization of moments distance - , additional_optimizer_steps = [1] % vector of additional mode-finders run after mode_compute + , additional_optimizer_steps = [4] % vector of additional mode-finders run after mode_compute , mode_check % plot the target function for values around the computed minimum for each estimated parameter in turn @#endif % optim: a list of NAME and VALUE pairs to set options for the optimization routines. Available options depend on mode_compute, some exemplary common options: @@ -272,7 +272,7 @@ method_of_moments( % , sylvester_fixed_point_tol = 1e-12 % convergence criterion used in the fixed point Sylvester solver % , qz_criterium = 0.999999 % value used to split stable from unstable eigenvalues in reordering the Generalized Schur decomposition used for solving first order problems % , qz_zero_threshold = 1e-6 % value used to test if a generalized eigenvalue is 0/0 in the generalized Schur decomposition - % , schur_vec_tol=1e-11 % tolerance level used to find nonstationary variables in Schur decomposition of the transition matrix + % , schur_vec_tol=1e-11 % tolerance level used to find nonstationary variables in Schur decomposition of the transition matrix % , mode_check_neighbourhood_size = 5 % width of the window (expressed in percentage deviation) around the computed minimum to be displayed on the diagnostic plots % , mode_check_symmetric_plots=1 % ensure that the check plots are symmetric around the minimum % , mode_check_number_of_points = 20 % number of points around the minimum where the target function is evaluated (for each parameter)