stock parameter values, steady state values and log-posterior values for sensitivity analysis purposes
git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@733 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
282204481d
commit
e3c3a878cc
|
@ -1,4 +1,4 @@
|
|||
function PosteriorSmoother(Y,gend)
|
||||
function PosteriorSmoother(Y,gend, type)
|
||||
% stephane.adjemian@ens.fr [09-25-2005]
|
||||
global options_ estim_params_ oo_ M_
|
||||
|
||||
|
@ -63,8 +63,12 @@ ifil5 = 1;
|
|||
h = waitbar(0,'Bayesian smoother...');
|
||||
if B <= MAX_nruns
|
||||
stock_param = zeros(B, npar);
|
||||
stock_logpo = zeros(B,1);
|
||||
stock_ys = zeros(B,endo_nbr);
|
||||
else
|
||||
stock_param = zeros(MAX_nruns, npar);
|
||||
stock_logpo = zeros(MAX_nruns,1);
|
||||
stock_ys = zeros(MAX_nruns,endo_nbr);
|
||||
end
|
||||
if options_.smoother
|
||||
if B <= MAX_nsmoo
|
||||
|
@ -85,19 +89,19 @@ if options_.smoother
|
|||
end
|
||||
if options_.filter_step_ahead ~= 0
|
||||
if B <= MAX_naK
|
||||
stock_filter = zeros(naK,endo_nbr,gend+1,B);
|
||||
stock_filter = zeros(naK,endo_nbr,gend+options_.filter_step_ahead(end),B);
|
||||
else
|
||||
stock_filter = zeros(naK,endo_nbr,gend+1,MAX_naK);
|
||||
stock_filter = zeros(naK,endo_nbr,gend+options_.filter_step_ahead(end),MAX_naK);
|
||||
end
|
||||
end
|
||||
for b=1:B
|
||||
%deep = GetOneDraw(NumberOfDraws,FirstMhFile,LastMhFile,FirstLine,MAX_nruns,DirectoryName);
|
||||
deep = GetOneDraw('posterior');
|
||||
[deep, logpo] = GetOneDraw(type);
|
||||
set_all_parameters(deep);
|
||||
dr = resol(oo_.steady_state,0);
|
||||
[alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK] = DsgeSmoother(deep,gend,Y);
|
||||
|
||||
stock_smooth(:,:,irun1) = alphahat;
|
||||
stock_smooth(:,:,irun1) = alphahat(1:endo_nbr,:);
|
||||
if nvx
|
||||
stock_innov(:,:,irun2) = etahat;
|
||||
end
|
||||
|
@ -105,9 +109,11 @@ for b=1:B
|
|||
stock_error(:,:,irun3) = epsilonhat;
|
||||
end
|
||||
if naK
|
||||
stock_filter(:,:,:,irun4) = aK;
|
||||
stock_filter(:,:,:,irun4) = aK(options_.filter_step_ahead,1:endo_nbr,:);
|
||||
end
|
||||
stock_param(irun5,:) = deep;
|
||||
stock_logpo(irun5,1) = logpo;
|
||||
stock_ys(irun5,:) = SteadyState';
|
||||
|
||||
irun1 = irun1 + 1;
|
||||
irun2 = irun2 + 1;
|
||||
|
@ -158,9 +164,11 @@ for b=1:B
|
|||
if irun5 > MAX_nruns | b == B
|
||||
if b == B
|
||||
stock_param = stock_param(1:irun5-1,:);
|
||||
stock_logpo = stock_logpo(1:irun5-1,1);
|
||||
stock_ys = stock_ys(1:irun5-1,:);
|
||||
end
|
||||
stock = stock_param;
|
||||
save([DirectoryName '/' M_.fname '_param' int2str(ifil5)],'stock');
|
||||
save([DirectoryName '/' M_.fname '_param' int2str(ifil5)],'stock','stock_logpo','stock_ys');
|
||||
ifil5 = ifil5 + 1;
|
||||
irun5 = 1;
|
||||
end
|
||||
|
@ -169,3 +177,6 @@ for b=1:B
|
|||
end
|
||||
close(h)
|
||||
|
||||
stock_gend=gend;
|
||||
stock_data=Y;
|
||||
save([DirectoryName '/' M_.fname '_data'],'stock_gend','stock_data');
|
||||
|
|
Loading…
Reference in New Issue