From 27ac2cfe2030c9263f2bab6f0f6b0ff348cc1759 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Thu, 3 Oct 2024 11:27:33 +0200
Subject: [PATCH] SMC/DIME: allow posterior smoothing at first order

---
 matlab/estimation/dynare_estimation_1.m        | 16 ++++++----------
 matlab/estimation/prior_posterior_statistics.m |  2 +-
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/matlab/estimation/dynare_estimation_1.m b/matlab/estimation/dynare_estimation_1.m
index 23436980c..a2e9ffd8c 100644
--- a/matlab/estimation/dynare_estimation_1.m
+++ b/matlab/estimation/dynare_estimation_1.m
@@ -542,17 +542,13 @@ if issmc(options_) || (any(bayestopt_.pshape>0) && options_.mh_replic) ||  (any(
                 oo_ = compute_moments_varendo('posterior',options_,M_,oo_,estim_params_,var_list_);
             end
             if options_.smoother || ~isempty(options_.filter_step_ahead) || options_.forecast
-                if ~ishssmc(options_) && ~isdime(options_)
-                    if error_flag
-                        error('%s: I cannot compute the posterior statistics!',dispString)
-                    end
-                    if options_.order==1 && ~options_.particle.status
-                        oo_=prior_posterior_statistics('posterior',dataset_,dataset_info,M_,oo_,options_,estim_params_,bayestopt_,dispString); %get smoothed and filtered objects and forecasts
-                    else
-                        error('%s: Particle Smoothers are not yet implemented.',dispString)
-                    end
+                if error_flag
+                    error('%s: I cannot compute the posterior statistics!',dispString)
+                end
+                if options_.order==1 && ~options_.particle.status
+                    oo_=prior_posterior_statistics('posterior',dataset_,dataset_info,M_,oo_,options_,estim_params_,bayestopt_,dispString); %get smoothed and filtered objects and forecasts
                 else
-                    fprintf('%s: SMC does not yet support the smoother and forecast options. Skipping computation.\n',dispString);
+                    error('%s: Particle Smoothers are not yet implemented.',dispString)
                 end
             end
         else
diff --git a/matlab/estimation/prior_posterior_statistics.m b/matlab/estimation/prior_posterior_statistics.m
index 8b98c63db..519a58296 100644
--- a/matlab/estimation/prior_posterior_statistics.m
+++ b/matlab/estimation/prior_posterior_statistics.m
@@ -22,7 +22,7 @@ function oo_=prior_posterior_statistics(type,dataset_,dataset_info,M_,oo_,option
 % See the comments in the posterior_sampler.m funtion.
 
 
-% Copyright © 2005-2023 Dynare Team
+% Copyright © 2005-2024 Dynare Team
 %
 % This file is part of Dynare.
 %
-- 
GitLab