From 3d9f12d769b4ad81b46b1d6d17c75ed08914db48 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Fri, 24 Jul 2015 15:08:52 +0200 Subject: [PATCH] Add check whether prior mean violates Generalized (Inverse) Gamma Performs check as for generalized beta distribution --- matlab/set_prior.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/matlab/set_prior.m b/matlab/set_prior.m index a72a6204d..16e27f3f3 100644 --- a/matlab/set_prior.m +++ b/matlab/set_prior.m @@ -196,6 +196,9 @@ k2 = find(isnan(bayestopt_.p4(k))); bayestopt_.p3(k(k1)) = zeros(length(k1),1); bayestopt_.p4(k(k2)) = Inf(length(k2),1); for i=1:length(k) + if (bayestopt_.p1(k(i))bayestopt_.p4(k(i))) + error(['The prior mean of ' bayestopt_.name{k(i)} ' has to be above the lower (' num2str(bayestopt_.p3(k(i))) ') bound of the Gamma prior density!']); + end if isinf(bayestopt_.p2(k(i))) error(['Infinite prior standard deviation for parameter ' bayestopt_.name{k(i)} ' is not allowed (Gamma prior)!']) end @@ -224,6 +227,9 @@ k2 = find(isnan(bayestopt_.p4(k))); bayestopt_.p3(k(k1)) = zeros(length(k1),1); bayestopt_.p4(k(k2)) = Inf(length(k2),1); for i=1:length(k) + if (bayestopt_.p1(k(i))bayestopt_.p4(k(i))) + error(['The prior mean of ' bayestopt_.name{k(i)} ' has to be above the lower (' num2str(bayestopt_.p3(k(i))) ') bound of the Inverse Gamma prior density!']); + end [bayestopt_.p6(k(i)),bayestopt_.p7(k(i))] = ... inverse_gamma_specification(bayestopt_.p1(k(i))-bayestopt_.p3(k(i)),bayestopt_.p2(k(i)),1,0) ; bayestopt_.p5(k(i)) = compute_prior_mode([ bayestopt_.p6(k(i)) , bayestopt_.p7(k(i)) , bayestopt_.p3(k(i)) ], 4) ; @@ -246,6 +252,9 @@ k2 = find(isnan(bayestopt_.p4(k))); bayestopt_.p3(k(k1)) = zeros(length(k1),1); bayestopt_.p4(k(k2)) = Inf(length(k2),1); for i=1:length(k) + if (bayestopt_.p1(k(i))bayestopt_.p4(k(i))) + error(['The prior mean of ' bayestopt_.name{k(i)} ' has to be above the lower (' num2str(bayestopt_.p3(k(i))) ') bound of the Inverse Gamma II prior density!']); + end [bayestopt_.p6(k(i)),bayestopt_.p7(k(i))] = ... inverse_gamma_specification(bayestopt_.p1(k(i))-bayestopt_.p3(k(i)),bayestopt_.p2(k(i)),2,0); bayestopt_.p5(k(i)) = compute_prior_mode([ bayestopt_.p6(k(i)) , bayestopt_.p7(k(i)) , bayestopt_.p3(k(i)) ], 6) ;