diff --git a/matlab/estimation/prior_posterior_statistics.m b/matlab/estimation/prior_posterior_statistics.m index 36349dc6b872f26b5fad5b60dd1e6b8b39b5dec5..a0fb6128cc73a382992d562163771867004122db 100644 --- a/matlab/estimation/prior_posterior_statistics.m +++ b/matlab/estimation/prior_posterior_statistics.m @@ -141,9 +141,9 @@ if options_.filter_covariance filter_covariance=1; end -smoothed_state_uncertainty=0; +smoothed_state_uncertainty=false; if options_.smoothed_state_uncertainty - smoothed_state_uncertainty=1; + smoothed_state_uncertainty=true; end % Store the variable mandatory for local/remote parallel computing. @@ -327,6 +327,9 @@ if options_.smoother varlist,'UpdatedVariables',DirectoryName, ... '_update',dispString); if smoothed_state_uncertainty + if isfield(oo_,'Smoother') && isfield(oo_.Smoother,'State_uncertainty') + oo_.Smoother=rmfield(oo_.Smoother,'State_uncertainty'); %needs to be removed as classical smoother field has a different format + end oo_=pm3(M_,options_,oo_,endo_nbr,endo_nbr,ifil(13),B,'State Uncertainty',... varlist,M_.endo_names_tex,M_.endo_names,... varlist,'StateUncertainty',DirectoryName,'_state_uncert',dispString); diff --git a/tests/occbin/filter/NKM.mod b/tests/occbin/filter/NKM.mod index 07166af5dbf19a864953602ae93b753da010d6ae..96f0250fe4720a500ebd3f909bd91c53e86d5120 100644 --- a/tests/occbin/filter/NKM.mod +++ b/tests/occbin/filter/NKM.mod @@ -389,13 +389,22 @@ varobs yg inom pi; else disp('smoother redux successfully recovers full k-step ahead variables results!') end + + //run PKF with MCMC + options_.smoother_redux=false; + estimation( + datafile=dataobsfile2, mode_file=NKM_mh_mode_saved, + mode_compute=0, nobs=120, first_obs=1, + mh_replic=50, plot_priors=0, smoother, + consider_all_endogenous,heteroskedastic_filter,filter_step_ahead=[1:8],smoothed_state_uncertainty); + // use inversion filter (note that IF provides smoother together with likelihood) occbin_setup(likelihood_inversion_filter,smoother_inversion_filter); estimation( datafile=dataobsfile2, mode_file=NKM_mh_mode_saved, mode_compute=0, nobs=120, first_obs=1, - mh_replic=0, plot_priors=0, smoother, + mh_replic=50, plot_priors=0, smoother, consider_all_endogenous,heteroskedastic_filter,filter_step_ahead=[1:8],smoothed_state_uncertainty); // show initial condition effect of IF @@ -420,7 +429,7 @@ varobs yg inom pi; estimation( datafile=dataobsfile2, mode_file=NKM_mh_mode_saved, mode_compute=0, nobs=120, first_obs=1, - mh_replic=10, plot_priors=0, smoother, + mh_replic=50, plot_priors=0, smoother, consider_all_endogenous,heteroskedastic_filter,filter_step_ahead=[1:8],smoothed_state_uncertainty); write_latex_dynamic_model;