OccBin: improve consistency - Make name of opts_simul subfield homogeneous for likelihood computation and smoother - fill the new field opts_regime with init_binding_indicator init_regime_history, to avoid possible conflics with simulations done in realtime filtering steps - smoother: use init_binding_indicator and init_regime_history options set in options_.occbin.smoother

covariance-quadratic-approximation
Johannes Pfeifer 2023-12-18 14:03:52 +01:00
parent ac346ef83d
commit d7ae0d0039
5 changed files with 26 additions and 28 deletions

View File

@ -119,9 +119,9 @@ opts_simul.piecewise_only = options_.occbin.smoother.piecewise_only;
occbin_options = struct();
occbin_options.first_period_occbin_update = options_.occbin.smoother.first_period_occbin_update;
occbin_options.opts_regime = opts_simul; % this builds the opts_simul options field needed by occbin.solver
occbin_options.opts_regime.binding_indicator = options_.occbin.likelihood.init_binding_indicator;
occbin_options.opts_regime.regime_history=options_.occbin.likelihood.init_regime_history;
occbin_options.opts_simul = opts_simul; % this builds the opts_simul options field needed by occbin.solver
occbin_options.opts_regime.binding_indicator = options_.occbin.smoother.init_binding_indicator;
occbin_options.opts_regime.regime_history=options_.occbin.smoother.init_regime_history;
error_indicator=false;
try
@ -133,7 +133,7 @@ catch ME
for iter = 1:numel(ME.stack)
ME.stack(iter)
end
end
end
if error_indicator || isempty(alphahat0)
etahat= oo_.occbin.linear_smoother.etahat;
alphahat0= oo_.occbin.linear_smoother.alphahat0;
@ -506,5 +506,5 @@ if (~is_changed || occbin_smoother_debug) && nargin==12
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fclose(fidTeX);
end
end
end
end

View File

@ -85,7 +85,7 @@ if isempty(nk)
end
nk=max(nk,1);
opts_simul = occbin_options.opts_regime;
opts_simul = occbin_options.opts_simul;
options_.occbin.simul=opts_simul;
base_regime = struct();
if M_.occbin.constraint_nbr==1

View File

@ -906,7 +906,5 @@ occbin_options.opts_simul.restrict_state_space = options_.occbin.likelihood.rest
occbin_options.opts_simul.full_output = options_.occbin.likelihood.full_output;
occbin_options.opts_simul.piecewise_only = options_.occbin.likelihood.piecewise_only;
if ~isempty(options_.occbin.smoother.init_binding_indicator)
occbin_options.opts_simul.init_binding_indicator = options_.occbin.likelihood.init_binding_indicator;
occbin_options.opts_simul.init_regime_history=options_.occbin.likelihood.init_regime_history;
end
occbin_options.opts_regime.init_binding_indicator = options_.occbin.likelihood.init_binding_indicator;
occbin_options.opts_regime.init_regime_history=options_.occbin.likelihood.init_regime_history;

View File

@ -109,8 +109,8 @@ if occbin_.status
M_=occbin_.info{6};
occbin_options=occbin_.info{7};
occbin_options.opts_simul.SHOCKS = [];
opts_regime.regime_history = occbin_options.opts_simul.init_regime;
opts_regime.binding_indicator = occbin_options.opts_simul.init_binding_indicator;
opts_regime.regime_history = occbin_options.opts_regime.init_regime_history;
opts_regime.binding_indicator = occbin_options.opts_regime.init_binding_indicator;
if t>1
first_period_occbin_update = max(t+1,options_.occbin.likelihood.first_period_occbin_update);
else

View File

@ -348,7 +348,7 @@ if isoccbin
first_period_occbin_update = max(t+2,occbin_options.first_period_occbin_update);
% kalman update is not yet robust to accommodate diffuse steps
end
if occbin_options.opts_regime.waitbar && first_period_occbin_update<smpl
if occbin_options.opts_simul.waitbar && first_period_occbin_update<smpl
hh_fig = dyn_waitbar(0,'Occbin: Piecewise Kalman Filter');
set(hh_fig,'Name','Occbin: Piecewise Kalman Filter.');
waitbar_indicator=1;
@ -381,7 +381,7 @@ while notsteady && t<smpl
if waitbar_indicator
dyn_waitbar(t/smpl, hh_fig, sprintf('Period %u of %u', t,smpl));
end
occbin_options.opts_regime.waitbar=0;
occbin_options.opts_simul.waitbar=0;
if t==1
if isqvec
Qt = cat(3,Q,Qvec(:,:,t:t+1));
@ -532,7 +532,7 @@ while notsteady && t<smpl
end
aK(1,:,t+1) = a1(:,t+1);
if ~isempty(nk) && nk>1 && isoccbin && (t>=first_period_occbin_update || isinf(first_period_occbin_update))
opts_simul = occbin_options.opts_regime;
opts_simul = occbin_options.opts_simul;
opts_simul.SHOCKS = zeros(nk,M_.exo_nbr);
if smoother_redux
tmp=zeros(M_.endo_nbr,1);