


Maximizes the logged prior density using Chris Sims' optimization routine. INPUTS iparams [double] vector of initial parameters. prior_shape [integer] vector specifying prior densities shapes. prior_hyperparameter_1 [double] vector, first hyperparameter. prior_hyperparameter_2 [double] vector, second hyperparameter. prior_inf_bound [double] vector, prior's lower bound. prior_sup_bound [double] vector, prior's upper bound. OUTPUTS xparams [double] vector, prior mode. lpd [double] scalar, value of the logged prior density at the mode. hessian [double] matrix, Hessian matrix at the prior mode.


0001 function [xparams,lpd,hessian] = ... 0002 maximize_prior_density(iparams, prior_shape, prior_hyperparameter_1, prior_hyperparameter_2, prior_inf_bound, prior_sup_bound) 0003 % Maximizes the logged prior density using Chris Sims' optimization routine. 0004 % 0005 % INPUTS 0006 % iparams [double] vector of initial parameters. 0007 % prior_shape [integer] vector specifying prior densities shapes. 0008 % prior_hyperparameter_1 [double] vector, first hyperparameter. 0009 % prior_hyperparameter_2 [double] vector, second hyperparameter. 0010 % prior_inf_bound [double] vector, prior's lower bound. 0011 % prior_sup_bound [double] vector, prior's upper bound. 0012 % 0013 % OUTPUTS 0014 % xparams [double] vector, prior mode. 0015 % lpd [double] scalar, value of the logged prior density at the mode. 0016 % hessian [double] matrix, Hessian matrix at the prior mode. 0017 0018 % Copyright (C) 2009-2011 Dynare Team 0019 % 0020 % This file is part of Dynare. 0021 % 0022 % Dynare is free software: you can redistribute it and/or modify 0023 % it under the terms of the GNU General Public License as published by 0024 % the Free Software Foundation, either version 3 of the License, or 0025 % (at your option) any later version. 0026 % 0027 % Dynare is distributed in the hope that it will be useful, 0028 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0029 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0030 % GNU General Public License for more details. 0031 % 0032 % You should have received a copy of the GNU General Public License 0033 % along with Dynare. If not, see <http://www.gnu.org/licenses/>. 0034 0035 number_of_estimated_parameters = length(iparams); 0036 H0 = 1e-4*eye(number_of_estimated_parameters); 0037 crit = 1e-7; 0038 nit = 1000; 0039 verbose = 2; 0040 gradient_method = 2; 0041 gradient_epsilon = 1e-6; 0042 0043 [lpd,xparams,grad,hessian,itct,fcount,retcodehat] = ... 0044 csminwel1('minus_logged_prior_density',iparams,H0,[],crit,nit,gradient_method, gradient_epsilon, ... 0045 prior_shape, prior_hyperparameter_1, prior_hyperparameter_2, prior_inf_bound, prior_sup_bound); 0046 0047 lpd = -lpd;