diff --git a/matlab/check_bounds_and_definiteness_estimation.m b/matlab/check_bounds_and_definiteness_estimation.m index 88b3f8460581204bb89f509fbb32502035410a32..8876664dd2163d00a217ba852c665a37d7847854 100644 --- a/matlab/check_bounds_and_definiteness_estimation.m +++ b/matlab/check_bounds_and_definiteness_estimation.m @@ -1,11 +1,10 @@ -function [fval,info,exit_flag,M_,Q,H]=check_bounds_and_definiteness_estimation(xparam1, M_, options_, estim_params_, bayestopt_) -% function [fval,info,exit_flag]=check_bounds_and_definiteness_estimation(xparam1, M_, options_, estim_params_, bayestopt_) +function [fval,info,exit_flag,Q,H]=check_bounds_and_definiteness_estimation(xparam1, M_, estim_params_, bayestopt_) +% function [fval,info,exit_flag]=check_bounds_and_definiteness_estimation(xparam1, M_, estim_params_, bayestopt_) % Checks whether parameter vector satisfies % % INPUTS % - xparam1 [double] n by 1 vector, estimated parameters. % - M_ [struct] Matlab's structure describing the Model. -% - options_ [struct] Matlab's structure describing the options. % - estim_params_ [struct] Matlab's structure describing the estimated_parameters. % - bayestopt_ [struct] Matlab's structure specifying the bounds on the paramater values (initialized by dynare,aka bayesopt_). % @@ -58,8 +57,6 @@ if any(xparam1>bayestopt_.ub) return end -M_ = set_all_parameters(xparam1,estim_params_,M_); - Q = M_.Sigma_e; H = M_.H; diff --git a/matlab/dsge_likelihood.m b/matlab/dsge_likelihood.m index d43988af6665a444f4f35b2330e9244d473132a1..917ef8bfb37f07a64187d8078564b1da157d22f1 100644 --- a/matlab/dsge_likelihood.m +++ b/matlab/dsge_likelihood.m @@ -180,8 +180,9 @@ end %------------------------------------------------------------------------------ % 1. Get the structural parameters & define penalties %------------------------------------------------------------------------------ +Model = set_all_parameters(xparam1,EstimatedParameters,Model); -[fval,info,exit_flag,Model,Q,H]=check_bounds_and_definiteness_estimation(xparam1, Model, DynareOptions, EstimatedParameters, BoundsInfo); +[fval,info,exit_flag,Q,H]=check_bounds_and_definiteness_estimation(xparam1, Model, EstimatedParameters, BoundsInfo); if info(1) return end diff --git a/matlab/dsge_var_likelihood.m b/matlab/dsge_var_likelihood.m index 69e64899c17515ea9938c477b69697b1590edf5f..596136ce860fae2d114315f01c0a2047fc2842a0 100644 --- a/matlab/dsge_var_likelihood.m +++ b/matlab/dsge_var_likelihood.m @@ -101,7 +101,9 @@ mYX = evalin('base', 'mYX'); mXY = evalin('base', 'mXY'); mXX = evalin('base', 'mXX'); -[fval,info,exit_flag,Model,Q]=check_bounds_and_definiteness_estimation(xparam1, Model, DynareOptions, EstimatedParameters, BoundsInfo); +Model = set_all_parameters(xparam1,EstimatedParameters,Model); + +[fval,info,exit_flag,Q]=check_bounds_and_definiteness_estimation(xparam1, Model, EstimatedParameters, BoundsInfo); if info(1) return end diff --git a/matlab/method_of_moments/method_of_moments_objective_function.m b/matlab/method_of_moments/method_of_moments_objective_function.m index e4f6714aaf91e6ae6b9cbe1c22d0756453c7d850..90e04c92fbaa453fc23894d15b123f31b6b0b3b1 100644 --- a/matlab/method_of_moments/method_of_moments_objective_function.m +++ b/matlab/method_of_moments/method_of_moments_objective_function.m @@ -65,7 +65,9 @@ junk2 = []; % 1. Get the structural parameters & define penalties %-------------------------------------------------------------------------- -[fval,info,exit_flag,M_]=check_bounds_and_definiteness_estimation(xparam1, M_, options_mom_, estim_params_, Bounds); +M_ = set_all_parameters(xparam1, estim_params_, M_); + +[fval,info,exit_flag]=check_bounds_and_definiteness_estimation(xparam1, M_, estim_params_, Bounds); if info(1) if options_mom_.vector_output == 1 % lsqnonlin requires vector output fval = ones(size(oo_.mom.data_moments,1),1)*options_mom_.huge_number; diff --git a/matlab/non_linear_dsge_likelihood.m b/matlab/non_linear_dsge_likelihood.m index 1c4694af9ea9101f0ee15beed089e56e5a79fa19..2af54fac8eaf9b558b37cd55fa72eb5e0a756770 100644 --- a/matlab/non_linear_dsge_likelihood.m +++ b/matlab/non_linear_dsge_likelihood.m @@ -63,7 +63,9 @@ end % 1. Get the structural parameters & define penalties %------------------------------------------------------------------------------ -[fval,info,exit_flag,Model,Q,H]=check_bounds_and_definiteness_estimation(xparam1, Model, DynareOptions, EstimatedParameters, BoundsInfo); +Model = set_all_parameters(xparam1,EstimatedParameters,Model); + +[fval,info,exit_flag,Q,H]=check_bounds_and_definiteness_estimation(xparam1, Model, EstimatedParameters, BoundsInfo); if info(1) return end