From 9e99eed6da7642dfdc873710361448e9bcf5ad72 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx,de>
Date: Mon, 27 Jan 2014 10:34:13 +0100
Subject: [PATCH] Fix sample on which Geweke convergence diagnostics is
 computed

Was only correct for mh_drop of 0.5
---
 matlab/McMCDiagnostics.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/matlab/McMCDiagnostics.m b/matlab/McMCDiagnostics.m
index b4604e1eff..1091dbc036 100644
--- a/matlab/McMCDiagnostics.m
+++ b/matlab/McMCDiagnostics.m
@@ -78,8 +78,8 @@ if nblck == 1 % Brooks and Gelman tests need more than one block
         options_.convergence.geweke.geweke_interval=[0.2 0.5];
     end
     first_obs_begin_sample = max(1,ceil(options_.mh_drop*options_.mh_replic));
-    last_obs_begin_sample = first_obs_begin_sample+round(options_.convergence.geweke.geweke_interval(1)*options_.mh_replic*options_.mh_drop);
-    first_obs_end_sample = first_obs_begin_sample+round(options_.convergence.geweke.geweke_interval(2)*options_.mh_replic*options_.mh_drop);
+    last_obs_begin_sample = first_obs_begin_sample+round(options_.convergence.geweke.geweke_interval(1)*options_.mh_replic*(1-options_.mh_drop));
+    first_obs_end_sample = first_obs_begin_sample+round(options_.convergence.geweke.geweke_interval(2)*options_.mh_replic*(1-options_.mh_drop));
     param_name=[];
     for jj=1:npar
         param_name = strvcat(param_name,get_the_name(jj,options_.TeX,M_,estim_params_,options_));
-- 
GitLab