From fe000c1497d3772d9b71130b027ed7a934bf4631 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Karam=C3=A9?=
 <frederic.karame@univ-lemans.fr>
Date: Thu, 17 Oct 2024 15:34:27 +0200
Subject: [PATCH] Bug fixes.

---
 matlab/estimation/GetAllPosteriorDraws.m             | 5 ++---
 matlab/estimation/GetPosteriorParametersStatistics.m | 4 +++-
 matlab/estimation/set_number_of_subdraws.m           | 3 +--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/matlab/estimation/GetAllPosteriorDraws.m b/matlab/estimation/GetAllPosteriorDraws.m
index d2b891651..b2c591f58 100644
--- a/matlab/estimation/GetAllPosteriorDraws.m
+++ b/matlab/estimation/GetAllPosteriorDraws.m
@@ -53,8 +53,7 @@ if issmc(options_)
         end
     elseif isonline(options_)
         % Load draws from the posterior distribution
-        pfiles = dir(sprintf('%s/online/particles-*.mat', dname));
-        posterior = load(sprintf('%s/online/particles-final.mat', dname, length(pfiles), length(pfiles)));
+        posterior = load(sprintf('%s/online/parameters_particles_final.mat', dname));
         if column>0 || strcmp(column,'all')
             if strcmp(column,'all')
                 draws = transpose(posterior.param);
@@ -62,7 +61,7 @@ if issmc(options_)
                 draws = transpose(posterior.param(column,:));
             end
         else
-            draws = posterior.tlogpostkernel;
+%            draws = posterior.tlogpostkernel;
         end
     elseif isdime(options_)
         posterior = load(sprintf('%s%s%s%schains.mat', dname, filesep(), 'dime', filesep()));
diff --git a/matlab/estimation/GetPosteriorParametersStatistics.m b/matlab/estimation/GetPosteriorParametersStatistics.m
index 63a40adcb..ebaf93666 100644
--- a/matlab/estimation/GetPosteriorParametersStatistics.m
+++ b/matlab/estimation/GetPosteriorParametersStatistics.m
@@ -55,9 +55,11 @@ skipline(2)
 disp('ESTIMATION RESULTS')
 skipline()
 
-if ishssmc(options_) || isonline(options_)
+if ishssmc(options_) 
     dprintf('Log data density is %f.', oo_.MarginalDensity.hssmc);
     hpd_draws = round((1-options_.mh_conf_sig)*num_draws);
+elseif isonline(options_)
+    hpd_draws = num_draws;
 elseif isdime(options_)
     hpd_draws = round((1-options_.mh_conf_sig)*num_draws);
 else
diff --git a/matlab/estimation/set_number_of_subdraws.m b/matlab/estimation/set_number_of_subdraws.m
index fd3bdec20..0241b3205 100644
--- a/matlab/estimation/set_number_of_subdraws.m
+++ b/matlab/estimation/set_number_of_subdraws.m
@@ -59,8 +59,7 @@ else
         NumberOfDrawsPerChain=NumberOfDraws;
     elseif isonline(options_)
         % Load draws from the posterior distribution
-        pfiles = dir(sprintf('%s/online/particles-*.mat', M_.dname));
-        posterior = load(sprintf('%s/online/particles-%u-%u.mat', M_.dname, length(pfiles), length(pfiles)));
+        posterior = load(sprintf('%s/online/parameters_particles_final.mat', M_.dname));
         NumberOfDraws = size(posterior.param,2);
         NumberOfDrawsPerChain=NumberOfDraws;
     elseif isdime(options_)
-- 
GitLab