Hey folks,
I’m interested in the difference between calib_smoother output in SmoothedVariables and occbin_solver output in simul. Specifically, I’m conducting a counterfactual exercise as follows:
- Estimate a NK model with OBC on the short-term nominal interest rate
- Use calib_smoother to get SmoothedShocks conditional on posterior mode from step 1)
- Use occbin_setup then occbin_solver to get the piecewise simulation given the SmoothedShocks from step 2)
- Specify an alternative sequence of shocks for the counterfactual and redo step 3.
I don’t want to share the whole mod file since this is all preliminary stuff, but here’s the last part of the mod for steps 2-4 above:
calib_smoother(datafile = data_est_full,filtered_vars);
shocks_epsGamma = oo_.SmoothedShocks.epsGamma;
shocks_epstheta = oo_.SmoothedShocks.epstheta;
shocks_epsz = oo_.SmoothedShocks.epsz;
shocks_epsnu = oo_.SmoothedShocks.epsnu;
shocks_epsqe = oo_.SmoothedShocks.epsqe;
shocks_epsmp = oo_.SmoothedShocks.epsmp;shocks(surprise,overwrite);
var epsGamma;
periods 1:240;
values (shocks_epsGamma);
var epstheta;
periods 1:240;
values (shocks_epstheta);
var epsz;
periods 1:240;
values (shocks_epsz);
var epsnu;
periods 1:240;
values (shocks_epsnu);
var epsqe;
periods 1:240;
values (shocks_epsqe);
var epsmp;
periods 1:240;
values (shocks_epsmp);
end;occbin_setup;
occbin_solver;for ivar = 1:M_.endo_nbr
eval([‘oo_.simqe.’,M_.endo_names{ivar},’ = oo_.occbin.simul.piecewise(:,ivar);']);
endshocks_epsqe_cf = [oo_.SmoothedShocks.epsqe(1:194); -shock_size*ones([46,1])];
shocks(surprise,overwrite);
var epsGamma;
periods 1:240;
values (shocks_epsGamma);
var epstheta;
periods 1:240;
values (shocks_epstheta);
var epsz;
periods 1:240;
values (shocks_epsz);
var epsnu;
periods 1:240;
values (shocks_epsnu);
var epsqe;
periods 1:240;
values (shocks_epsqe_cf);
var epsmp;
periods 1:240;
values (shocks_epsmp);
end;occbin_setup;
occbin_solver;for ivar = 1:M_.endo_nbr
eval([‘oo_.simnoqe.’,M_.endo_names{ivar},’ = oo_.occbin.simul.piecewise(:,ivar);']);
end
What I noticed is that some observable variables in oo_.occbin.simul neither match the data nor oo_.SmoothedVariables (from calib_smoother). E.g., here is some code to plot a comparison of oo_.SmoothedVariables to oo_.occbin.simul:
figure;
subplot(3,1,1); hold on; grid on; box on;
plot(data.date,data.data_r,‘k-’)
plot(data.date,oo_.SmoothedVariables.R,‘b-.’)
plot(data.date,oo_.simqe.R,‘r–’)
title(‘R’)
legend(‘data’,‘calib smoother’,‘OccBin simul’)
subplot(3,1,2); hold on; grid on; box on;plot(data.date,data.data_r,‘k-’)
plot(data.date,oo_.SmoothedVariables.Rn,‘b-.’)
plot(data.date,oo_.simqe.Rn,‘r–’)
title(‘Rn’)
legend(‘data’,‘calib smoother’,‘OccBin simul’)subplot(3,1,3); hold on; grid on; box on;
plot(data.date,data.data_dshare,‘k-’)
plot(data.date,oo_.SmoothedVariables.data_dshare,‘b-.’)
plot(data.date,oo_.simqe.data_dshare,‘r–’)
title(‘data_dshare’)
legend(‘data’,‘calib smoother’,‘OccBin simul’)
generating the following figure
My final question: does anyone have any ideas what might explain the level shift between oo_.SmoothedVariables and oo_.occbin.simul across the whole sample for the last panel (and the small differences at the beginning of the sample in the first two panels)? The parameterization, steady state, model, and the sequences of shocks are all identical, so it must be something else.
Thanks in advance for any help; I appreciate you very much!