diff --git a/matlab/+mom/default_option_mom_values.m b/matlab/+mom/default_option_mom_values.m index c0bc017d24f53fdc3990b3833c3b9b3376d2d6e4..9a27c76134200e06da184e80a547ea21b124bf43 100644 --- a/matlab/+mom/default_option_mom_values.m +++ b/matlab/+mom/default_option_mom_values.m @@ -29,6 +29,7 @@ function options_mom_ = default_option_mom_values(options_mom_, options_, dname, % o user_has_matlab_license % o user_has_octave_forge_package % ------------------------------------------------------------------------- + % Copyright © 2023 Dynare Team % % This file is part of Dynare. diff --git a/matlab/PlotPosteriorDistributions.m b/matlab/PlotPosteriorDistributions.m index 7da52aa723bcbe6841c750f8661fe65b115e5035..6a5cec13d0b93f737cd78d674bbebe7168a94a20 100644 --- a/matlab/PlotPosteriorDistributions.m +++ b/matlab/PlotPosteriorDistributions.m @@ -4,14 +4,14 @@ function oo_ = PlotPosteriorDistributions(estim_params_, M_, options_, bayestopt % plots posterior distributions % % INPUTS -% estim_params_ [structure] -% M_ [structure] -% options_ [structure] -% bayestopt_ [structure] -% oo_ [structure] +% estim_params_ [structure] information on estimated paramters +% M_ [structure] information on model +% options_ [structure] information on options +% bayestopt_ [structure] information on priors +% oo_ [structure] results % % OUTPUTS -% oo_ [structure] +% oo_ [structure] updated results % % SPECIAL REQUIREMENTS % none diff --git a/matlab/mode_check.m b/matlab/mode_check.m index 7b6e89ff425becb65364700a308aaddacdaabc1e..a7db27a108796e428e4a0812b49cba991b43f305 100644 --- a/matlab/mode_check.m +++ b/matlab/mode_check.m @@ -4,7 +4,7 @@ function mcheck = mode_check(fun,xparam,hessian_mat,options_,M_,estim_params_,ba % Checks the estimated ML or Posterior mode/minimum by plotting sections of % the likelihood/posterior kernel. Each plot shows the variation of the % function implied by the variations of a single parameter ( ceteris paribus) -% ========================================================================= +% ------------------------------------------------------------------------- % INPUTS % - fun: [func_handle] objective function % - xparam: [vector] estimated mode/minimum @@ -25,6 +25,7 @@ function mcheck = mode_check(fun,xparam,hessian_mat,options_,M_,estim_params_,ba % - dynare_estimation_1 % - mom.run % ------------------------------------------------------------------------- + % Copyright © 2023 Dynare Team % % This file is part of Dynare. @@ -41,7 +42,6 @@ function mcheck = mode_check(fun,xparam,hessian_mat,options_,M_,estim_params_,ba % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -% ========================================================================= tolBounds = 1e-8; diff --git a/matlab/utilities/estimation/check_hessian_at_the_mode.m b/matlab/utilities/estimation/check_hessian_at_the_mode.m index 8fa880253fcc8555590b572b75cc5c8a62640eb6..1e91bf6661a26b93d531a8d0c4000729b4c8c9d2 100644 --- a/matlab/utilities/estimation/check_hessian_at_the_mode.m +++ b/matlab/utilities/estimation/check_hessian_at_the_mode.m @@ -2,7 +2,7 @@ function check_hessian_at_the_mode(hessian_xparam1, xparam1, M_, estim_params_, % check_hessian_at_the_mode(hessian_xparam1, xparam1, M_, estim_params_, options_, bounds) % ------------------------------------------------------------------------- % This function checks whether the hessian matrix at the mode is positive definite. -% ========================================================================= +% ------------------------------------------------------------------------- % INPUTS % o hessian_xparam1: [matrix] hessian matrix at the mode % o xparam1: [vector] vector of parameter values at the mode @@ -17,6 +17,7 @@ function check_hessian_at_the_mode(hessian_xparam1, xparam1, M_, estim_params_, % This function is called by % o dynare_estimation_1.m % ------------------------------------------------------------------------- + % Copyright © 2023 Dynare Team % % This file is part of Dynare. @@ -33,7 +34,6 @@ function check_hessian_at_the_mode(hessian_xparam1, xparam1, M_, estim_params_, % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -% ========================================================================= try chol(hessian_xparam1); diff --git a/matlab/utilities/estimation/check_mode_file.m b/matlab/utilities/estimation/check_mode_file.m index 29ddb1e84690817d6d94d34daf3711ece75449f5..040c74a80e787c092cb4da3d81d708c2afe5cd5a 100644 --- a/matlab/utilities/estimation/check_mode_file.m +++ b/matlab/utilities/estimation/check_mode_file.m @@ -2,7 +2,7 @@ function [xparam1, hh] = check_mode_file(xparam1, hh, options_, bayestopt_) % function [xparam1, hh] = check_mode_file(xparam1, hh, options_, bayestopt_) % ------------------------------------------------------------------------- % Check that the provided mode_file is compatible with the current estimation settings. -% ========================================================================= +% ------------------------------------------------------------------------- % INPUTS % o xparam1: [vector] current vector of parameter values at the mode % o hh: [matrix] current hessian matrix at the mode @@ -16,6 +16,7 @@ function [xparam1, hh] = check_mode_file(xparam1, hh, options_, bayestopt_) % This function is called by % o dynare_estimation_init.m % ------------------------------------------------------------------------- + % Copyright © 2023 Dynare Team % % This file is part of Dynare. @@ -32,7 +33,6 @@ function [xparam1, hh] = check_mode_file(xparam1, hh, options_, bayestopt_) % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -% ========================================================================= number_of_estimated_parameters = length(xparam1); mode_file = load(options_.mode_file); diff --git a/matlab/utilities/estimation/check_prior_stderr_corr.m b/matlab/utilities/estimation/check_prior_stderr_corr.m index 0cdc7b71c1b6c6a8d9b74c1a1349331102f5304c..867e0ba7cd4876dc1c53f4ae5f72b01dda6305a0 100644 --- a/matlab/utilities/estimation/check_prior_stderr_corr.m +++ b/matlab/utilities/estimation/check_prior_stderr_corr.m @@ -3,7 +3,7 @@ function check_prior_stderr_corr(estim_params_,bayestopt_) % ------------------------------------------------------------------------- % Check if the prior allows for negative standard deviations and % correlations larger than +-1. If so, issue a warning. -% ========================================================================= +% ------------------------------------------------------------------------- % INPUTS % o estim_params_: [struct] information on estimated parameters % o bayestopt_: [struct] information on priors @@ -14,6 +14,7 @@ function check_prior_stderr_corr(estim_params_,bayestopt_) % This function is called by % o initial_estimation_checks.m % ------------------------------------------------------------------------- + % Copyright © 2023 Dynare Team % % This file is part of Dynare. @@ -30,7 +31,6 @@ function check_prior_stderr_corr(estim_params_,bayestopt_) % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -% ========================================================================= nvx = estim_params_.nvx; % number of stderr parameters for structural shocks if nvx && any(bayestopt_.p3(1:nvx)<0) diff --git a/matlab/utilities/estimation/check_steady_state_changes_parameters.m b/matlab/utilities/estimation/check_steady_state_changes_parameters.m index 1cd40b29306dff4467daf6f09dc924c6c519a54f..9f6bdfcea0d9a43b1e224eb2e38a5facdaa9b052 100644 --- a/matlab/utilities/estimation/check_steady_state_changes_parameters.m +++ b/matlab/utilities/estimation/check_steady_state_changes_parameters.m @@ -2,7 +2,7 @@ function [steady_state, info, steady_state_changes_parameters] = check_steady_st % function [steady_state, info, steady_state_changes_parameters] = check_steady_state_changes_parameters(M_,estim_params_,oo_,options_,steadystate_check_flag_vec) % ------------------------------------------------------------------------- % Check if steady-state solves static model and if it changes estimated parameters -% ========================================================================= +% ------------------------------------------------------------------------- % INPUTS % o M_: [struct] information on the model % o estim_params_: [struct] information on estimated parameters @@ -18,6 +18,7 @@ function [steady_state, info, steady_state_changes_parameters] = check_steady_st % This function is called by % o initial_estimation_checks.m % ------------------------------------------------------------------------- + % Copyright © 2023 Dynare Team % % This file is part of Dynare. @@ -34,7 +35,6 @@ function [steady_state, info, steady_state_changes_parameters] = check_steady_st % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -% ========================================================================= value_parameter_change = 1.01; % value with which parameters are slightly changed. steady_state_changes_parameters = false; % initialize diff --git a/matlab/utilities/estimation/check_varobs_are_endo_and_declared_once.m b/matlab/utilities/estimation/check_varobs_are_endo_and_declared_once.m index 75daffc917c77c61fa165bbe683300576b829f9b..1cb92635da33eadc8f8e08fed45c1601a3a8ed71 100644 --- a/matlab/utilities/estimation/check_varobs_are_endo_and_declared_once.m +++ b/matlab/utilities/estimation/check_varobs_are_endo_and_declared_once.m @@ -4,7 +4,7 @@ function check_varobs_are_endo_and_declared_once(varobs,endo_names) % Check that each declared observed variable: % - is also an endogenous variable % - is declared only once -% ========================================================================= +% ------------------------------------------------------------------------- % INPUTS % o varobs: [cell] list of observed variables % o endo_names: [cell] list of endogenous variables @@ -15,6 +15,7 @@ function check_varobs_are_endo_and_declared_once(varobs,endo_names) % This function is called by % o dynare_estimation_init.m % ------------------------------------------------------------------------- + % Copyright © 2023 Dynare Team % % This file is part of Dynare. @@ -31,7 +32,6 @@ function check_varobs_are_endo_and_declared_once(varobs,endo_names) % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -% ========================================================================= number_of_observed_variables = length(varobs); for i = 1:number_of_observed_variables diff --git a/matlab/utilities/estimation/set_mcmc_jumping_covariance.m b/matlab/utilities/estimation/set_mcmc_jumping_covariance.m index b0cb99d49852e79a0dfee3e685138d4722668150..6902d509fe41930c2a41c46bccdfc8a5119d828f 100644 --- a/matlab/utilities/estimation/set_mcmc_jumping_covariance.m +++ b/matlab/utilities/estimation/set_mcmc_jumping_covariance.m @@ -2,7 +2,7 @@ function invhess = set_mcmc_jumping_covariance(invhess, xparam_nbr, MCMC_jumping % function invhess = set_mcmc_jumping_covariance(invhess, xparam_nbr, MCMC_jumping_covariance, bayestopt_, stringForErrors) % ------------------------------------------------------------------------- % sets the jumping covariance matrix for the MCMC algorithm -% ========================================================================= +% ------------------------------------------------------------------------- % INPUTS % o invhess: [matrix] already computed inverse of the hessian matrix % o xparam_nbr: [integer] number of estimated parameters @@ -16,6 +16,7 @@ function invhess = set_mcmc_jumping_covariance(invhess, xparam_nbr, MCMC_jumping % This function is called by % o dynare_estimation_1.m % ------------------------------------------------------------------------- + % Copyright © 2023 Dynare Team % % This file is part of Dynare. @@ -32,7 +33,6 @@ function invhess = set_mcmc_jumping_covariance(invhess, xparam_nbr, MCMC_jumping % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -% ========================================================================= switch MCMC_jumping_covariance case 'hessian' % do nothing and use hessian from previous mode optimization diff --git a/matlab/utilities/estimation/set_mcmc_prior_bounds.m b/matlab/utilities/estimation/set_mcmc_prior_bounds.m index 76bbf09ca47f0c213f0d0b7fcd7b2611a02a6741..a94b7b9c6d296981298cc3e733850ce673e8258c 100644 --- a/matlab/utilities/estimation/set_mcmc_prior_bounds.m +++ b/matlab/utilities/estimation/set_mcmc_prior_bounds.m @@ -15,6 +15,7 @@ function bounds = set_mcmc_prior_bounds(xparam, bayestopt_, options_, stringForE % This function is called by % o dynare_estimation_1.m % ------------------------------------------------------------------------- + % Copyright © 2023 Dynare Team % % This file is part of Dynare. @@ -31,7 +32,6 @@ function bounds = set_mcmc_prior_bounds(xparam, bayestopt_, options_, stringForE % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -% ========================================================================= bounds = prior_bounds(bayestopt_, options_.prior_trunc); outside_bound_pars = find(xparam < bounds.lb | xparam > bounds.ub); diff --git a/matlab/utilities/estimation/tune_mcmc_mh_jscale_wrapper.m b/matlab/utilities/estimation/tune_mcmc_mh_jscale_wrapper.m index d0be1e6e87ba0a1f49e9ab5c81eb7f2bf74c6408..0da796f513cd6ebbf74e77a49be771094ff4eb35 100644 --- a/matlab/utilities/estimation/tune_mcmc_mh_jscale_wrapper.m +++ b/matlab/utilities/estimation/tune_mcmc_mh_jscale_wrapper.m @@ -3,7 +3,7 @@ function mh_jscale = tune_mcmc_mh_jscale_wrapper(invhess, options_, M_, objectiv % ------------------------------------------------------------------------- % Wrapper to call the algorithm to tune the jumping scale parameter for the % Metropolis-Hastings algorithm; currently only supports RW-MH algorithm. -% ========================================================================= +% ------------------------------------------------------------------------- % INPUTS % o invhess: [matrix] jumping covariance matrix % o options_: [struct] Dynare options @@ -17,8 +17,9 @@ function mh_jscale = tune_mcmc_mh_jscale_wrapper(invhess, options_, M_, objectiv % o mh_jscale: [double] tuned jumping scale parameter % ------------------------------------------------------------------------- % This function is called by -% o dynare_estimation_1.m +% o dynare_estimation_1 % ------------------------------------------------------------------------- + % Copyright © 2023 Dynare Team % % This file is part of Dynare. @@ -35,9 +36,7 @@ function mh_jscale = tune_mcmc_mh_jscale_wrapper(invhess, options_, M_, objectiv % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -% ========================================================================= -% get invhess in case of use_mh_covariance_matrix posterior_sampler_options_temp = options_.posterior_sampler_options.current_options; posterior_sampler_options_temp.invhess = invhess; posterior_sampler_options_temp = check_posterior_sampler_options(posterior_sampler_options_temp, M_.fname, M_.dname, options_);