diff --git a/matlab/get_prior_info.m b/matlab/get_prior_info.m
index daabe6be1..2bcc30c3e 100644
--- a/matlab/get_prior_info.m
+++ b/matlab/get_prior_info.m
@@ -92,8 +92,8 @@ function get_prior_info(info)
end
M_.dname = M_.fname;
-
- if info% Prior simulations.
+
+ if info==1% Prior simulations.
results = prior_sampler(0,M_,bayestopt_,options_,oo_);
disp(['Prior mass = ' num2str(results.prior.mass)])
disp(['BK indeterminacy share = ' num2str(results.bk.indeterminacy_share)])
@@ -106,7 +106,52 @@ function get_prior_info(info)
disp(['Analytical steady state problem share = ' num2str(results.ass.problem_share)])
end
-
+ if info==2% Prior optimization.
+
+ k = find(~isnan(bayestopt_.p5));
+ xparam1(k) = bayestopt_.p5(k);
+
+ look_for_admissible_initial_condition = 1;
+ scale = 1.0;
+ iter = 0;
+
+ while look_for_admissible_initial_condition
+ xinit = xparam1+scale*randn(size(xparam1));
+ if all(xinit>bayestopt_.p3) && all(xinit.
+
+ number_of_estimated_parameters = length(iparams);
+ H0 = 1e-4*eye(number_of_estimated_parameters);
+ crit = 1e-7;
+ nit = 1000;
+ verbose = 2;
+ gradient_method = 2;
+
+ [lpd,xparams,grad,hessian,itct,fcount,retcodehat] = ...
+ csminwel('minus_logged_prior_density',iparams,H0,[],crit,nit,gradient_method, ...
+ prior_shape, prior_hyperparameter_1, prior_hyperparameter_2, prior_inf_bound, prior_sup_bound);
+
+ lpd = -lpd;
+
\ No newline at end of file
diff --git a/matlab/minus_logged_prior_density.m b/matlab/minus_logged_prior_density.m
new file mode 100644
index 000000000..92a37b287
--- /dev/null
+++ b/matlab/minus_logged_prior_density.m
@@ -0,0 +1,32 @@
+function [f,fake] = minus_logged_prior_density(xparams,pshape,p6,p7,p3,p4)
+% Evaluates minus the logged prior density.
+%
+% INPUTS
+% xparams [double] vector of parameters.
+% pshape [integer] vector specifying prior densities shapes.
+% p6 [double] vector, first hyperparameter.
+% p7 [double] vector, second hyperparameter.
+% p3 [double] vector, prior's lower bound.
+% p4 [double] vector, prior's upper bound.
+%
+% OUTPUTS
+% f [double] value of minus the logged prior density.
+
+% Copyright (C) 2009 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare. If not, see .
+ fake = 1;
+ f = - priordens(xparams,pshape,p6,p7,p3,p4);
\ No newline at end of file