Commit e692185c authored by MichelJuillard's avatar MichelJuillard
Browse files

storing oo_.prior.mean oo_.prior.variance

oo_.posterior.optimization.mode oo_.posterior.optimization.variance
oo_.posterior.metropolis.mean oo_.posterior.metropolis.variance as
aggregate arrays in addition to previous storage variable by variable
parent 61b45386
......@@ -384,10 +384,13 @@ if options_.mode_check == 1 && ~options_.mh_posterior_mode_estimation
mode_check(objective_function,xparam1,hh,dataset_,options_,M_,estim_params_,bayestopt_,oo_);
end
oo_.posterior.optimization.mode = xparam1;
oo_.posterior.optimization.variance = [];
if ~options_.mh_posterior_mode_estimation
if options_.cova_compute
invhess = inv(hh);
stdh = sqrt(diag(invhess));
oo_.posterior.optimization.variance = invhess;
end
else
variances = bayestopt_.p2.*bayestopt_.p2;
......@@ -474,8 +477,8 @@ if any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation
k2 = estim_params_.corrx(i,2);
name = [deblank(M_.exo_names(k1,:)) ',' deblank(M_.exo_names(k2,:))];
NAME = [deblank(M_.exo_names(k1,:)) '_' deblank(M_.exo_names(k2,:))];
disp(sprintf('%-*s %7.3f %8.4f %7.4f %7.4f %4s %6.4f', name, ...
header_width,bayestopt_.p1(ip),xparam1(ip),stdh(ip),tstath(ip), ...
disp(sprintf('%-*s %7.3f %8.4f %7.4f %7.4f %4s %6.4f', ...
header_width,name,bayestopt_.p1(ip),xparam1(ip),stdh(ip),tstath(ip), ...
pnames(bayestopt_.pshape(ip)+1,:), bayestopt_.p2(ip)));
M_.Sigma_e(k1,k2) = xparam1(ip)*sqrt(M_.Sigma_e(k1,k1)*M_.Sigma_e(k2,k2));
M_.Sigma_e(k2,k1) = M_.Sigma_e(k1,k2);
......@@ -493,8 +496,8 @@ if any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation
k2 = estim_params_.corrn(i,2);
name = [deblank(M_.endo_names(k1,:)) ',' deblank(M_.endo_names(k2,:))];
NAME = [deblank(M_.endo_names(k1,:)) '_' deblank(M_.endo_names(k2,:))];
disp(sprintf('%-*s %7.3f %8.4f %7.4f %7.4f %4s %6.4f', name, ...
header_width,bayestopt_.p1(ip),xparam1(ip),stdh(ip),tstath(ip), ...
disp(sprintf('%-*s %7.3f %8.4f %7.4f %7.4f %4s %6.4f', ...
header_width,name,bayestopt_.p1(ip),xparam1(ip),stdh(ip),tstath(ip), ...
pnames(bayestopt_.pshape(ip)+1,:), bayestopt_.p2(ip)));
eval(['oo_.posterior_mode.measurement_errors_corr.' NAME ' = xparam1(ip);']);
eval(['oo_.posterior_std.measurement_errors_corr.' NAME ' = stdh(ip);']);
......@@ -882,6 +885,8 @@ if (any(bayestopt_.pshape >0 ) && options_.mh_replic) || ...
[marginal,oo_] = marginal_density(M_, options_, estim_params_, oo_);
oo_ = GetPosteriorParametersStatistics(estim_params_, M_, options_, bayestopt_, oo_);
oo_ = PlotPosteriorDistributions(estim_params_, M_, options_, bayestopt_, oo_);
[oo_.posterior.metropolis.mean,oo_.posterior.metropolis.variance] ...
= GetPosteriorMeanVariance(M_,options_.mh_drop);
else
load([M_.fname '_results'],'oo_');
end
......
......@@ -166,6 +166,10 @@ else% If estim_params_ is empty...
estim_params_.np = 0;
end
% storing prior parameters in results
oo_.prior.mean = bayestopt_.p1;
oo_.prior.variance = diag(bayestopt_.p2.^2);
% Is there a linear trend in the measurement equation?
if ~isfield(options_,'trend_coeffs') % No!
bayestopt_.with_trend = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment