From 560d9719db4114e34044a2e38a3525737faa6943 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Fri, 24 Jul 2015 15:59:40 +0200
Subject: [PATCH] Correct copy and paste mistake in prior_draw.m for inverse
 gamma II

In case of bound violations, it was instead sampled from inverse gamma I
---
 matlab/prior_draw.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/matlab/prior_draw.m b/matlab/prior_draw.m
index 8923be87c5..9a22dc39ca 100644
--- a/matlab/prior_draw.m
+++ b/matlab/prior_draw.m
@@ -139,7 +139,7 @@ if inverse_gamma_2_draws
     out_of_bound = find( (pdraw(inverse_gamma_2_index)'>ub(inverse_gamma_2_index)) | (pdraw(inverse_gamma_2_index)'<lb(inverse_gamma_2_index)));
     while ~isempty(out_of_bound),
         pdraw(inverse_gamma_2_index(out_of_bound)) = ...
-            sqrt(1./gamrnd(p7(inverse_gamma_2_index(out_of_bound))/2,2./p6(inverse_gamma_2_index(out_of_bound))))+p3(inverse_gamma_2_index(out_of_bound));
+            1./gamrnd(p7(inverse_gamma_2_index(out_of_bound))/2,2./p6(inverse_gamma_2_index(out_of_bound)))+p3(inverse_gamma_2_index(out_of_bound));
         out_of_bound = find( (pdraw(inverse_gamma_2_index)'>ub(inverse_gamma_2_index)) | (pdraw(inverse_gamma_2_index)'<lb(inverse_gamma_2_index)));
     end
 end
-- 
GitLab