diff --git a/matlab/+mom/display_comparison_moments.m b/matlab/+mom/display_comparison_moments.m index bcd1584edcb2e728dd8a399babaddddfef13689d..a9e703a14f6ef5794ff40478df470e16dd16b2f5 100644 --- a/matlab/+mom/display_comparison_moments.m +++ b/matlab/+mom/display_comparison_moments.m @@ -1,8 +1,8 @@ function display_comparison_moments(M_, options_mom_, data_moments, model_moments) -% function display_comparison_moments(M_, options_mom_, data_moments, model_moments) +% display_comparison_moments(M_, options_mom_, data_moments, model_moments) % ------------------------------------------------------------------------- % Displays and saves to disk the comparison of the data moments and the model moments -% ========================================================================= +% ------------------------------------------------------------------------- % INPUTS % M_: [structure] model information % options_mom_: [structure] method of moments options @@ -19,7 +19,8 @@ function display_comparison_moments(M_, options_mom_, data_moments, model_moment % o dyn_latex_table % o dyntable % o cellofchararraymaxlength -% ========================================================================= +% ------------------------------------------------------------------------- + % Copyright © 2023 Dynare Team % % This file is part of Dynare. @@ -36,7 +37,7 @@ function display_comparison_moments(M_, options_mom_, data_moments, model_moment % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -% ========================================================================= + titl = ['Comparison of matched data moments and model moments (',options_mom_.mom.mom_method,')']; headers = {'Moment','Data','Model'}; diff --git a/matlab/+mom/get_data_moments.m b/matlab/+mom/get_data_moments.m index aedf02f28976349dd5b5e3c2ffce1bf76da67e3b..16b128813ad414bcade16aca42b0aea8fe41b3b7 100644 --- a/matlab/+mom/get_data_moments.m +++ b/matlab/+mom/get_data_moments.m @@ -1,7 +1,8 @@ function [dataMoments, m_data] = get_data_moments(data, obs_var, inv_order_var, matched_moments_, options_mom_) % [dataMoments, m_data] = get_data_moments(data, obs_var, inv_order_var, matched_moments_, options_mom_) -% This function computes the user-selected empirical moments from data -% ========================================================================= +% ------------------------------------------------------------------------- +% Computes the user-selected empirical moments from data +% ------------------------------------------------------------------------- % INPUTS % o data [T x varobs_nbr] data set % o obs_var: [integer] index of observables @@ -16,7 +17,8 @@ function [dataMoments, m_data] = get_data_moments(data, obs_var, inv_order_var, % This function is called by % o mom.run % o mom.objective_function -% ========================================================================= +% ------------------------------------------------------------------------- + % Copyright © 2020-2023 Dynare Team % % This file is part of Dynare. @@ -33,11 +35,7 @@ function [dataMoments, m_data] = get_data_moments(data, obs_var, inv_order_var, % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -% ------------------------------------------------------------------------- -% Author(s): -% o Willi Mutschler (willi@mutschler.eu) -% o Johannes Pfeifer (johannes.pfeifer@unibw.de) -% ========================================================================= + % Initialization T = size(data,1); % Number of observations (T) diff --git a/matlab/+mom/matched_moments_block.m b/matlab/+mom/matched_moments_block.m index a0b44c70b87b848001c744849b4fee29107c8760..9bdf9da739fbca66338a273a0c587d234df4b879 100644 --- a/matlab/+mom/matched_moments_block.m +++ b/matlab/+mom/matched_moments_block.m @@ -68,7 +68,7 @@ end % remove duplicate elements DuplicateMoms = setdiff(1:size(matched_moments_orig,1),UniqueMomIdx); if ~isempty(DuplicateMoms) - fprintf('Duplicate declared moments found and removed in ''matched_moments'' block in rows:\n %s.\n',num2str(DuplicateMoms)) + fprintf('Duplicate declared moments found and removed in ''matched_moments'' block in rows:\n %s.\n',num2str(DuplicateMoms)); fprintf('Dynare will continue with remaining moment conditions\n'); end if strcmp(mom_method, 'SMM') diff --git a/matlab/+mom/mode_compute_gmm_smm.m b/matlab/+mom/mode_compute_gmm_smm.m index c4d28f53844b91239b3637c4cf14d87492c1a6db..77d0e075d916e119dba3dad6e8a9346bb5bc019a 100644 --- a/matlab/+mom/mode_compute_gmm_smm.m +++ b/matlab/+mom/mode_compute_gmm_smm.m @@ -57,7 +57,7 @@ function [xparam1, weighting_info, mom_verbose] = mode_compute_gmm_smm(xparam0, mom_verbose = []; if size(options_mom_.mom.weighting_matrix,1)>1 && ~(any(strcmpi('diagonal',options_mom_.mom.weighting_matrix)) || any(strcmpi('optimal',options_mom_.mom.weighting_matrix))) - fprintf('\nYou did not specify the use of an optimal or diagonal weighting matrix. There is no point in running an iterated method of moments.\n') + fprintf('\nYou did not specify the use of an optimal or diagonal weighting matrix. There is no point in running an iterated method of moments.\n'); end for stage_iter = 1:size(options_mom_.mom.weighting_matrix,1) @@ -91,17 +91,17 @@ for stage_iter = 1:size(options_mom_.mom.weighting_matrix,1) try load(options_mom_.mom.weighting_matrix{stage_iter},'weighting_matrix') catch - error(['method_of_moments: No matrix named ''weighting_matrix'' could be found in ',options_mom_.mom.weighting_matrix{stage_iter},'.mat !']) + error(['method_of_moments: No matrix named ''weighting_matrix'' could be found in ',options_mom_.mom.weighting_matrix{stage_iter},'.mat !']); end [nrow, ncol] = size(weighting_matrix); if ~isequal(nrow,ncol) || ~isequal(nrow,length(data_moments)) %check if square and right size - error(['method_of_moments: ''weighting_matrix'' must be square and have ',num2str(length(data_moments)),' rows and columns!']) + error(['method_of_moments: ''weighting_matrix'' must be square and have ',num2str(length(data_moments)),' rows and columns!']); end end try % check for positive definiteness of weighting_matrix weighting_info.Sw = chol(weighting_matrix); catch - error('method_of_moments: Specified ''weighting_matrix'' is not positive definite. Check whether your model implies stochastic singularity!') + error('method_of_moments: Specified ''weighting_matrix'' is not positive definite. Check whether your model implies stochastic singularity!'); end for optim_iter = 1:length(options_mom_.optimizer_vec) @@ -126,9 +126,9 @@ for stage_iter = 1:size(options_mom_.mom.weighting_matrix,1) fval = fval'*fval; end end - fprintf('\nStage %d Iteration %d: Value of minimized moment distance objective function: %12.10f.\n',stage_iter,optim_iter,fval) + fprintf('\nStage %d Iteration %d: Value of minimized moment distance objective function: %12.10f.\n',stage_iter,optim_iter,fval); if options_mom_.mom.verbose - fprintf('\n''verbose'' option: ') + fprintf('\n''verbose'' option: '); std_via_invhessian_xparam1_iter = NaN(size(xparam1)); tbl_title_iter = sprintf('FREQUENTIST %s (STAGE %d ITERATION %d) VERBOSE',options_mom_.mom.mom_method,stage_iter,optim_iter); field_name_iter = sprintf('%s_stage_%d_iter_%d',lower(options_mom_.mom.mom_method),stage_iter,optim_iter); diff --git a/matlab/+mom/objective_function.m b/matlab/+mom/objective_function.m index 2514a295603f851fd00b568549c7371e5d117809..6562f96628eab12bd9f6060ff7606018f2808314 100644 --- a/matlab/+mom/objective_function.m +++ b/matlab/+mom/objective_function.m @@ -145,7 +145,7 @@ if strcmp(options_mom_.mom.mom_method,'GMM') indpcorr = estim_params_.corrx(:,1:2); % values correspond to varexo declaration order, row number corresponds to order in estimated_params end if estim_params_.nvn || estim_params_.ncn % nvn is number of stderr parameters and ncn is number of corr parameters of measurement innovations as declared in estimated_params - error('Analytic computation of standard errrors does not (yet) support measurement errors.\nInstead, define them explicitly as varexo and provide measurement equations in the model definition.\nAlternatively, use numerical standard errors.') + error('Analytic computation of standard errrors does not (yet) support measurement errors.\nInstead, define them explicitly as varexo and provide measurement equations in the model definition.\nAlternatively, use numerical standard errors.'); end modparam_nbr = estim_params_.np; % number of model parameters as declared in estimated_params stderrparam_nbr = estim_params_.nvx; % number of stderr parameters diff --git a/matlab/+mom/optimal_weighting_matrix.m b/matlab/+mom/optimal_weighting_matrix.m index c09e56fd37789831a79a1654ba71dc907be54c29..11459f08c9f26b1dc64edf973d14294c9d415645 100644 --- a/matlab/+mom/optimal_weighting_matrix.m +++ b/matlab/+mom/optimal_weighting_matrix.m @@ -2,9 +2,10 @@ function W_opt = optimal_weighting_matrix(m_data, moments, q_lag) % W_opt = optimal_weighting_matrix(m_data, moments, q_lag) % ------------------------------------------------------------------------- % This function computes the optimal weigthing matrix by a Bartlett kernel with maximum lag q_lag -% Adapted from replication codes of -% o Andreasen, Fernández-Villaverde, 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. -% ========================================================================= +% Adapted from replication codes of Andreasen, Fernández-Villaverde, 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. +% ------------------------------------------------------------------------- % INPUTS % o m_data [T x numMom] selected data moments at each point in time % o moments [numMom x 1] selected estimated moments (either data_moments or estimated model_moments) @@ -18,8 +19,9 @@ function W_opt = optimal_weighting_matrix(m_data, moments, q_lag) % ------------------------------------------------------------------------- % This function calls: % o CorrMatrix (embedded) -% ========================================================================= -% Copyright © 2020-2021 Dynare Team +% ------------------------------------------------------------------------- + +% Copyright © 2020-2023 Dynare Team % % This file is part of Dynare. % @@ -35,19 +37,15 @@ function W_opt = optimal_weighting_matrix(m_data, moments, q_lag) % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -% ------------------------------------------------------------------------- -% Author(s): -% o Willi Mutschler (willi@mutschler.eu) -% o Johannes Pfeifer (johannes.pfeifer@unibw.de) -% ========================================================================= -% Initialize -[T,num_Mom] = size(m_data); %note that in m_data NaN values (due to leads or lags in matched_moments and missing data) were replaced by the mean + +% initialize +[T,num_Mom] = size(m_data); % note that in m_data NaN values (due to leads or lags in matched_moments and missing data) were replaced by the mean % center around moments (could be either data_moments or model_moments) h_Func = m_data - repmat(moments',T,1); -% The required correlation matrices +% the required correlation matrices GAMA_array = zeros(num_Mom,num_Mom,q_lag); GAMA0 = Corr_Matrix(h_Func,T,num_Mom,0); if q_lag > 0 @@ -56,7 +54,7 @@ if q_lag > 0 end end -% The estimate of S +% the estimate of S S = GAMA0; if q_lag > 0 for ii=1:q_lag @@ -64,11 +62,11 @@ if q_lag > 0 end end -% The estimate of W +% the estimate of W W_opt = S\eye(size(S,1)); -W_opt=(W_opt+W_opt')/2; %assure symmetry -end +W_opt=(W_opt+W_opt')/2; % ensure symmetry +end % main function end % The correlation matrix function GAMA_corr = Corr_Matrix(h_Func,T,num_Mom,v) @@ -77,4 +75,4 @@ function GAMA_corr = Corr_Matrix(h_Func,T,num_Mom,v) GAMA_corr = GAMA_corr + h_Func(t-v,:)'*h_Func(t,:); end GAMA_corr = GAMA_corr/T; -end +end % Corr_Matrix end \ No newline at end of file diff --git a/matlab/+mom/print_info_on_estimation_settings.m b/matlab/+mom/print_info_on_estimation_settings.m index 45dfe832a551db8189f5b3fe7082b742a5a6e57d..69da168b318488130e1289c7835d9f95da47b5e8 100644 --- a/matlab/+mom/print_info_on_estimation_settings.m +++ b/matlab/+mom/print_info_on_estimation_settings.m @@ -1,11 +1,11 @@ function print_info_on_estimation_settings(options_mom_, number_of_estimated_parameters) -% function print_info_on_estimation_settings(options_mom_, number_of_estimated_parameters) +% print_info_on_estimation_settings(options_mom_, number_of_estimated_parameters) % ------------------------------------------------------------------------- % Print information on the method of moments estimation settings to the console -% ========================================================================= +% ------------------------------------------------------------------------- % INPUTS -% options_mom_ [struct] Options for the method of moments estimation -% number_of_estimated_parameters [integer] Number of estimated parameters +% options_mom_ [struct] options for the method of moments estimation +% number_of_estimated_parameters [integer] number of estimated parameters % ------------------------------------------------------------------------- % OUTPUT % No output, just displays the chosen settings @@ -15,7 +15,8 @@ function print_info_on_estimation_settings(options_mom_, number_of_estimated_par % ------------------------------------------------------------------------- % This function calls % o skipline -% ========================================================================= +% ------------------------------------------------------------------------- + % Copyright © 2023 Dynare Team % % This file is part of Dynare. @@ -32,8 +33,9 @@ function print_info_on_estimation_settings(options_mom_, number_of_estimated_par % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -% ========================================================================= -fprintf('\n---------------------------------------------------\n') + + +fprintf('\n---------------------------------------------------\n'); if strcmp(options_mom_.mom.mom_method,'SMM') fprintf('Simulated method of moments with'); elseif strcmp(options_mom_.mom.mom_method,'GMM') @@ -106,10 +108,10 @@ for i = 1:length(options_mom_.optimizer_vec) end end if options_mom_.order > 0 - fprintf('\n - stochastic simulations with perturbation order: %d', options_mom_.order) + fprintf('\n - stochastic simulations with perturbation order: %d', options_mom_.order); end if options_mom_.order > 1 && options_mom_.pruning - fprintf(' (with pruning)') + fprintf(' (with pruning)'); end if strcmp(options_mom_.mom.mom_method,'GMM') || strcmp(options_mom_.mom.mom_method,'SMM') if strcmp(options_mom_.mom.mom_method,'GMM') && options_mom_.mom.analytic_standard_errors diff --git a/matlab/+mom/run.m b/matlab/+mom/run.m index 3109e7d720ee695aa700deed0b1eae5afa30ddbd..182011c0b4af9c7dc787f5a69f285f5c4fbce6a6 100644 --- a/matlab/+mom/run.m +++ b/matlab/+mom/run.m @@ -122,7 +122,7 @@ function [oo_, options_mom_, M_] = run(bayestopt_, options_, oo_, estim_params_, % - enable first moments despite prefilter % - do "true" Bayesian GMM and SMM not only penalized -fprintf('\n==== Method of Moments Estimation (%s) ====\n\n',options_mom_.mom.mom_method) +fprintf('\n==== Method of Moments Estimation (%s) ====\n\n',options_mom_.mom.mom_method); % ------------------------------------------------------------------------- @@ -130,18 +130,18 @@ fprintf('\n==== Method of Moments Estimation (%s) ====\n\n',options_mom_.mom.mom % ------------------------------------------------------------------------- if isempty(estim_params_) % structure storing the info about estimated parameters in the estimated_params block if ~(isfield(estim_params_,'nvx') && (size(estim_params_.var_exo,1)+size(estim_params_.var_endo,1)+size(estim_params_.corrx,1)+size(estim_params_.corrn,1)+size(estim_params_.param_vals,1))==0) - error('method_of_moments: You need to provide an ''estimated_params'' block!') + error('method_of_moments: You need to provide an ''estimated_params'' block!'); else - error('method_of_moments: The ''estimated_params'' block must not be empty!') + error('method_of_moments: The ''estimated_params'' block must not be empty!'); end end if strcmp(options_mom_.mom.mom_method,'GMM') || strcmp(options_mom_.mom.mom_method,'SMM') if ~isfield(M_,'matched_moments') || isempty(M_.matched_moments) % structure storing the moments used for GMM and SMM estimation - error('method_of_moments: You need to provide a ''matched_moments'' block for ''mom_method=%s''!',options_mom_.mom.mom_method) + error('method_of_moments: You need to provide a ''matched_moments'' block for ''mom_method=%s''!',options_mom_.mom.mom_method); end end if (~isempty(estim_params_.var_endo) || ~isempty(estim_params_.corrn)) && strcmp(options_mom_.mom.mom_method, 'GMM') - error('method_of_moments: GMM estimation does not support measurement error(s) yet. Please specify them as a structural shock!') + error('method_of_moments: GMM estimation does not support measurement error(s) yet. Please specify them as a structural shock!'); end doBayesianEstimation = [estim_params_.var_exo(:,5); estim_params_.var_endo(:,5); estim_params_.corrx(:,6); estim_params_.corrn(:,6); estim_params_.param_vals(:,5)]; if all(doBayesianEstimation~=0) @@ -149,10 +149,10 @@ if all(doBayesianEstimation~=0) elseif all(doBayesianEstimation==0) doBayesianEstimation = false; else - error('method_of_moments: Estimation must be either fully Frequentist or fully Bayesian. Maybe you forgot to specify a prior distribution!') + error('method_of_moments: Estimation must be either fully Frequentist or fully Bayesian. Maybe you forgot to specify a prior distribution!'); end if ~isfield(options_,'varobs') - error('method_of_moments: VAROBS statement is missing!') + error('method_of_moments: VAROBS statement is missing!'); end check_varobs_are_endo_and_declared_once(options_.varobs,M_.endo_names); @@ -258,7 +258,7 @@ if strcmp(options_mom_.mom.mom_method,'GMM') || strcmp(options_mom_.mom.mom_meth not_observed_variables=setdiff(oo_.dr.inv_order_var([M_.matched_moments{:,1}]),options_mom_.mom.obs_var); if ~isempty(not_observed_variables) skipline; - error('method_of_moments: You specified moments involving %s, but it is not a varobs!',M_.endo_names{oo_.dr.order_var(not_observed_variables)}) + error('method_of_moments: You specified moments involving %s, but it is not a varobs!',M_.endo_names{oo_.dr.order_var(not_observed_variables)}); end end @@ -342,7 +342,7 @@ else BoundsInfo.lb = lb; BoundsInfo.ub = ub; if options_mom_.mom.penalized_estimator - fprintf('Penalized estimation turned off as you did not declare priors\n') + fprintf('Penalized estimation turned off as you did not declare priors\n'); options_mom_.mom.penalized_estimator = 0; end end @@ -355,7 +355,7 @@ if options_mom_.use_calibration_initialization try check_prior_bounds(xparam0,BoundsInfo,M_,estim_params_,options_mom_,bayestopt_); catch last_error - fprintf('Cannot use parameter values from calibration as they violate the prior bounds.') + fprintf('Cannot use parameter values from calibration as they violate the prior bounds.'); rethrow(last_error); end else @@ -391,8 +391,8 @@ if doBayesianEstimation % check value of prior density [~,~,~,info]= priordens(xparam0,bayestopt_.pshape,bayestopt_.p6,bayestopt_.p7,bayestopt_.p3,bayestopt_.p4); if any(info) - fprintf('The prior density evaluated at the initial values is Inf for the following parameters: %s\n',bayestopt_.name{info,1}) - error('The initial value of the prior is -Inf!') + fprintf('The prior density evaluated at the initial values is Inf for the following parameters: %s\n',bayestopt_.name{info,1}); + error('The initial value of the prior is -Inf!'); end end @@ -405,7 +405,7 @@ if strcmp(options_mom_.mom.mom_method,'GMM') || strcmp(options_mom_.mom.mom_meth % Check if datafile has same name as mod file [~,name] = fileparts(options_mom_.datafile); if strcmp(name,M_.fname) - error('method_of_moments: ''datafile'' and mod file are not allowed to have the same name; change the name of the ''datafile''!') + error('method_of_moments: ''datafile'' and mod file are not allowed to have the same name; change the name of the ''datafile''!'); end dataset_ = makedataset(options_mom_); % set options for old interface from the ones for new interface @@ -421,7 +421,7 @@ if strcmp(options_mom_.mom.mom_method,'GMM') || strcmp(options_mom_.mom.mom_meth % Get data moments for the method of moments [oo_.mom.data_moments, oo_.mom.m_data] = mom.get_data_moments(dataset_.data, options_mom_.mom.obs_var, oo_.dr.inv_order_var, M_.matched_moments, options_mom_); if ~isreal(dataset_.data) - error('method_of_moments: The data moments contain complex values!') + error('method_of_moments: The data moments contain complex values!'); end end @@ -470,7 +470,7 @@ else end [oo_.steady_state, info, steady_state_changes_parameters] = check_steady_state_changes_parameters(M_, estim_params_, oo_, options_mom_, steadystate_check_flag_vec); if info(1) - fprintf('\nThe steady state at the initial parameters cannot be computed.\n') + fprintf('\nThe steady state at the initial parameters cannot be computed.\n'); print_info(info, 0, options_mom_); end if steady_state_changes_parameters && strcmp(options_mom_.mom.mom_method,'GMM') && options_mom_.mom.analytic_standard_errors @@ -496,9 +496,9 @@ try [fval, info] = feval(objective_function, xparam0, oo_.mom.data_moments, weighting_info, options_mom_, M_, estim_params_, bayestopt_, BoundsInfo, oo_.dr, oo_.steady_state, oo_.exo_steady_state, oo_.exo_det_steady_state); elapsed_time = toc(tic_id); if isnan(fval) - error('method_of_moments: The initial value of the objective function with identity weighting matrix is NaN!') + error('method_of_moments: The initial value of the objective function with identity weighting matrix is NaN!'); elseif imag(fval) - error('method_of_moments: The initial value of the objective function with identity weighting matrix is complex!') + error('method_of_moments: The initial value of the objective function with identity weighting matrix is complex!'); end if info(1) > 0 disp('method_of_moments: Error in computing the objective function for initial parameter values') @@ -513,10 +513,10 @@ try catch last_error % if check fails, provide info on using calibration if present if estim_params_.full_calibration_detected %calibrated model present and no explicit starting values skipline(1); - fprintf('There was an error in computing the moments for initial parameter values.\n') - fprintf('If this is not a problem with the setting of options (check the error message below),\n') - fprintf('you should try using the calibrated version of the model as starting values. To do\n') - fprintf('this, add an empty estimated_params_init-block with use_calibration option immediately before the estimation\n') + fprintf('There was an error in computing the moments for initial parameter values.\n'); + fprintf('If this is not a problem with the setting of options (check the error message below),\n'); + fprintf('you should try using the calibrated version of the model as starting values. To do\n'); + fprintf('this, add an empty estimated_params_init-block with use_calibration option immediately before the estimation\n'); fprintf('command (and after the estimated_params-block so that it does not get overwritten):\n'); skipline(2); end @@ -569,16 +569,12 @@ if strcmp(options_mom_.mom.mom_method,'SMM') || strcmp(options_mom_.mom.mom_meth % display comparison of model moments and data moments mom.display_comparison_moments(M_, options_mom_, oo_.mom.data_moments, oo_.mom.model_moments); end - +fprintf('\n==== Method of Moments Estimation (%s) Completed ====\n\n',options_mom_.mom.mom_method); % ------------------------------------------------------------------------- % clean up % ------------------------------------------------------------------------- -fprintf('\n==== Method of Moments Estimation (%s) Completed ====\n\n',options_mom_.mom.mom_method) - -%reset warning state -warning_config; - +warning_config; %reset warning state if isoctave && isfield(options_mom_, 'prior_restrictions') && ... isfield(options_mom_.prior_restrictions, 'routine') % Octave crashes if it tries to save function handles (to the _results.mat file) diff --git a/matlab/+mom/set_correct_bounds_for_stderr_corr.m b/matlab/+mom/set_correct_bounds_for_stderr_corr.m index 1bfac50a8bfa3c95a4e215c97ed7ac09b84ef7ef..c8299c3cf70b9bf5b6af40b5ad65c139b283c178 100644 --- a/matlab/+mom/set_correct_bounds_for_stderr_corr.m +++ b/matlab/+mom/set_correct_bounds_for_stderr_corr.m @@ -1,18 +1,19 @@ function BoundsInfo = set_correct_bounds_for_stderr_corr(estim_params_,BoundsInfo) -% function BoundsInfo = set_correct_bounds_for_stderr_corr(estim_params_,BoundsInfo) +% BoundsInfo = set_correct_bounds_for_stderr_corr(estim_params_,BoundsInfo) % ------------------------------------------------------------------------- % Set correct bounds for standard deviation and corrrelation parameters -% ========================================================================= +% ------------------------------------------------------------------------- % INPUTS % o estim_params_ [struct] information on estimated parameters % o BoundsInfo [struct] information on bounds % ------------------------------------------------------------------------- % OUTPUT -% o BoundsInfo [struct] updated bounds +% o BoundsInfo [struct] updated information on bounds % ------------------------------------------------------------------------- % This function is called by % o mom.run -% ========================================================================= +% ------------------------------------------------------------------------- + % Copyright © 2023 Dynare Team % % This file is part of Dynare. @@ -29,7 +30,7 @@ function BoundsInfo = set_correct_bounds_for_stderr_corr(estim_params_,BoundsInf % % 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 = estim_params_.nvx+estim_params_.nvn+estim_params_.ncx+estim_params_.ncn+estim_params_.np; % set correct bounds for standard deviations and corrrelations diff --git a/matlab/+mom/transform_prior_to_laplace_prior.m b/matlab/+mom/transform_prior_to_laplace_prior.m index f2cdf7cd20b644c1f4f56848f0f9f047f41fe41c..db6be256aa79204be81a66580d07965307cc9611 100644 --- a/matlab/+mom/transform_prior_to_laplace_prior.m +++ b/matlab/+mom/transform_prior_to_laplace_prior.m @@ -13,7 +13,8 @@ function bayestopt_ = transform_prior_to_laplace_prior(bayestopt_) % ------------------------------------------------------------------------- % This function is called by % o mom.run -% ========================================================================= +% ------------------------------------------------------------------------- + % Copyright © 2023 Dynare Team % % This file is part of Dynare. @@ -30,7 +31,8 @@ function bayestopt_ = transform_prior_to_laplace_prior(bayestopt_) % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -% ========================================================================= + + if any(setdiff([0;bayestopt_.pshape],[0,3])) fprintf('\nNon-normal priors specified. Penalized estimation uses a Laplace type of approximation:'); fprintf('\nOnly the prior mean and standard deviation are relevant, all other shape information, except for the parameter bounds, is ignored.\n\n');