Use new wrapper for optimization algorithms when maximizing the prior density.
parent
bd39ff34f6
commit
fac1d206ab
|
@ -1,5 +1,5 @@
|
||||||
function [xparams,lpd,hessian] = ...
|
function [xparams,lpd,hessian] = ...
|
||||||
maximize_prior_density(iparams, prior_shape, prior_hyperparameter_1, prior_hyperparameter_2, prior_inf_bound, prior_sup_bound,DynareOptions,DynareModel,EstimatedParams,DynareResults)
|
maximize_prior_density(iparams, prior_shape, prior_hyperparameter_1, prior_hyperparameter_2, prior_inf_bound, prior_sup_bound,DynareOptions,DynareModel,BayesInfo,EstimatedParams,DynareResults)
|
||||||
% Maximizes the logged prior density using Chris Sims' optimization routine.
|
% Maximizes the logged prior density using Chris Sims' optimization routine.
|
||||||
%
|
%
|
||||||
% INPUTS
|
% INPUTS
|
||||||
|
@ -15,7 +15,7 @@ function [xparams,lpd,hessian] = ...
|
||||||
% lpd [double] scalar, value of the logged prior density at the mode.
|
% lpd [double] scalar, value of the logged prior density at the mode.
|
||||||
% hessian [double] matrix, Hessian matrix at the prior mode.
|
% hessian [double] matrix, Hessian matrix at the prior mode.
|
||||||
|
|
||||||
% Copyright (C) 2009-2012 Dynare Team
|
% Copyright (C) 2009-2015 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -32,15 +32,10 @@ function [xparams,lpd,hessian] = ...
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
number_of_estimated_parameters = length(iparams);
|
[xparams, lpd, exitflag, hessian]=dynare_minimize_objective('minus_logged_prior_density', ...
|
||||||
H0 = 1e-4*eye(number_of_estimated_parameters);
|
iparams, DynareOptions.mode_compute, DynareOptions, [prior_inf_bound, prior_sup_bound], ...
|
||||||
crit = 1e-7;
|
BayesInfo.name, BayesInfo, [], ...
|
||||||
nit = 1000;
|
prior_shape, prior_hyperparameter_1, prior_hyperparameter_2, prior_inf_bound, prior_sup_bound, ...
|
||||||
gradient_method = 2;
|
DynareOptions,DynareModel,EstimatedParams,DynareResults);
|
||||||
gradient_epsilon = 1e-6;
|
|
||||||
|
|
||||||
[lpd,xparams,grad,hessian,itct,fcount,retcodehat] = ...
|
|
||||||
csminwel1('minus_logged_prior_density',iparams,H0,[],crit,nit,gradient_method, gradient_epsilon, ...
|
|
||||||
prior_shape, prior_hyperparameter_1, prior_hyperparameter_2, prior_inf_bound, prior_sup_bound,DynareOptions,DynareModel,EstimatedParams,DynareResults);
|
|
||||||
|
|
||||||
lpd = -lpd;
|
lpd = -lpd;
|
||||||
|
|
|
@ -46,7 +46,7 @@ function [opt_par_values,fval,exitflag,hessian_mat,options_,Scale]=dynare_minimi
|
||||||
%% set bounds and parameter names if not already set
|
%% set bounds and parameter names if not already set
|
||||||
n_params=size(start_par_value,1);
|
n_params=size(start_par_value,1);
|
||||||
if isempty(bounds)
|
if isempty(bounds)
|
||||||
if minimizer_algorithm==10
|
if minimizer_algorithm==10
|
||||||
error('Algorithm 10 (simpsa) requires upper and lower bounds')
|
error('Algorithm 10 (simpsa) requires upper and lower bounds')
|
||||||
else
|
else
|
||||||
bounds=[-Inf(n_params,1) Inf(n_params,1)];
|
bounds=[-Inf(n_params,1) Inf(n_params,1)];
|
||||||
|
|
Loading…
Reference in New Issue