diff --git a/matlab/check_bounds_and_definiteness_estimation.m b/matlab/check_bounds_and_definiteness_estimation.m index 88b3f8460..8876664dd 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 d43988af6..917ef8bfb 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 69e64899c..596136ce8 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 e4f6714aa..90e04c92f 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 1c4694af9..2af54fac8 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