Move setting of parameters out of check_bounds_and_definiteness_estimation.m

Increases transparency
time-shift
Johannes Pfeifer 2020-07-17 13:18:39 +02:00
parent 1dbbef9f2e
commit 3b85fea02e
5 changed files with 13 additions and 9 deletions

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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