+ Added comments.
+ Cosmetic changes. git-svn-id: https://www.dynare.org/svn/dynare/trunk@2725 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
a9d7088ced
commit
d67f1ecdb1
|
@ -107,14 +107,13 @@ function get_prior_info(info)
|
||||||
end
|
end
|
||||||
|
|
||||||
if info==2% Prior optimization.
|
if info==2% Prior optimization.
|
||||||
|
% Initialize to the prior mode if possible
|
||||||
k = find(~isnan(bayestopt_.p5));
|
k = find(~isnan(bayestopt_.p5));
|
||||||
xparam1(k) = bayestopt_.p5(k);
|
xparam1(k) = bayestopt_.p5(k);
|
||||||
|
% Pertubation of the initial condition.
|
||||||
look_for_admissible_initial_condition = 1;
|
look_for_admissible_initial_condition = 1;
|
||||||
scale = 1.0;
|
scale = 1.0;
|
||||||
iter = 0;
|
iter = 0;
|
||||||
|
|
||||||
while look_for_admissible_initial_condition
|
while look_for_admissible_initial_condition
|
||||||
xinit = xparam1+scale*randn(size(xparam1));
|
xinit = xparam1+scale*randn(size(xparam1));
|
||||||
if all(xinit>bayestopt_.p3) && all(xinit<bayestopt_.p4)
|
if all(xinit>bayestopt_.p3) && all(xinit<bayestopt_.p4)
|
||||||
|
@ -128,22 +127,20 @@ function get_prior_info(info)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
% Maximization
|
||||||
[xparams,lpd,hessian] = ...
|
[xparams,lpd,hessian] = ...
|
||||||
maximize_prior_density(xinit, bayestopt_.pshape, ...
|
maximize_prior_density(xinit, bayestopt_.pshape, ...
|
||||||
bayestopt_.p6, ...
|
bayestopt_.p6, ...
|
||||||
bayestopt_.p7, ...
|
bayestopt_.p7, ...
|
||||||
bayestopt_.p3, ...
|
bayestopt_.p3, ...
|
||||||
bayestopt_.p4);
|
bayestopt_.p4);
|
||||||
|
% Display the results.
|
||||||
disp(' ')
|
disp(' ')
|
||||||
disp(' ')
|
disp(' ')
|
||||||
disp('------------------')
|
disp('------------------')
|
||||||
disp('PRIOR OPTIMIZATION')
|
disp('PRIOR OPTIMIZATION')
|
||||||
disp('------------------')
|
disp('------------------')
|
||||||
disp(' ')
|
disp(' ')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for i = 1:length(xparams)
|
for i = 1:length(xparams)
|
||||||
disp(['deep parameter ' int2str(i) ': ' get_the_name(i,0) '.'])
|
disp(['deep parameter ' int2str(i) ': ' get_the_name(i,0) '.'])
|
||||||
disp([' Initial condition ....... ' num2str(xinit(i)) '.'])
|
disp([' Initial condition ....... ' num2str(xinit(i)) '.'])
|
||||||
|
|
Loading…
Reference in New Issue