From b762f010cd3d2b0fd2fde886ccf33e0a6bb0f327 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stephane.adjemian@ens.fr>
Date: Thu, 18 Feb 2010 16:59:26 +0100
Subject: [PATCH] Fix the inconsistency between mh_drop and the number of mh
 draws discarded when computing the Brooks and Gelman convergence diagnostics.

---
 matlab/McMCDiagnostics.m      | 1 +
 matlab/McMCDiagnostics_core.m | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/matlab/McMCDiagnostics.m b/matlab/McMCDiagnostics.m
index 5763d8ed13..997422bc76 100644
--- a/matlab/McMCDiagnostics.m
+++ b/matlab/McMCDiagnostics.m
@@ -91,6 +91,7 @@ localVars.nblck = nblck;
 localVars.NumberOfMcFilesPerBlock = NumberOfMcFilesPerBlock;
 localVars.Origin = Origin;
 localVars.StepSize = StepSize;
+localVars.mh_drop = options_.mh_drop;
 localVars.NumberOfDraws = NumberOfDraws;
 localVars.NumberOfLines = NumberOfLines;
 localVars.time = time;
diff --git a/matlab/McMCDiagnostics_core.m b/matlab/McMCDiagnostics_core.m
index 9729f2f1b1..c566646cf5 100644
--- a/matlab/McMCDiagnostics_core.m
+++ b/matlab/McMCDiagnostics_core.m
@@ -65,7 +65,7 @@ for j=fpar:npar,
     ligne   = 0;
     for iter  = Origin:StepSize:NumberOfDraws
         ligne = ligne+1;
-        linea = ceil(0.5*iter);
+        linea = ceil(mh_drop*iter);
         n     = iter-linea+1;
         cinf  = round(n*ALPHA/2);
         csup  = round(n*(1-ALPHA/2));
-- 
GitLab