sur gibbs: add plots, save parameter values

time-shift
Houtan Bastani 2017-07-12 18:12:26 +02:00
parent 92be7a6b27
commit 8c24b5210c
1 changed files with 16 additions and 1 deletions

View File

@ -131,4 +131,19 @@ for i = 1:ndraws
Sigma_upper_chol = chol(Omegabar, 'upper');
beta = rand_multivariate_normal(betabar', Sigma_upper_chol, nvars)';
oo_.surgibbs.betadraws(i, :) = beta';
end
end
% save parameter values
oo_.surgibbs.beta = (sum(oo_.surgibbs.betadraws)/ndraws)';
figure
nrows = 5;
ncols = floor(nvars/nrows);
if mod(nvars, nrows) ~= 0
ncols = ncols + 1;
end
for j = 1:length(pnamesall)
M_.params(strmatch(pnamesall{j}, M_.param_names, 'exact')) = oo_.surgibbs.beta(j);
subplot(nrows, ncols, j)
histogram(oo_.surgibbs.betadraws(:, j))
title(pnamesall{j}, 'Interpreter', 'none')
end