From 947ac4281a7b3322ed5e6454dfb905476dc06521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Gpm=29?= Date: Mon, 2 May 2011 12:33:46 +0200 Subject: [PATCH] Added an error message when the declared mean of beta shaped priors is outside the domain of the beta density. --- matlab/set_prior.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/matlab/set_prior.m b/matlab/set_prior.m index c2e388d9a..0d072dfa5 100644 --- a/matlab/set_prior.m +++ b/matlab/set_prior.m @@ -166,6 +166,9 @@ bayestopt_.p3(k(k1)) = zeros(length(k1),1); k1 = find(isnan(bayestopt_.p4(k))); bayestopt_.p4(k(k1)) = ones(length(k1),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 between the lower (' num2str(bayestopt_.p3(k(i))) ') and upper (' num2str(bayestopt_.p4(k(i))) ') bounds of the beta prior density!']); + end mu = (bayestopt_.p1(k(i))-bayestopt_.p3(k(i)))/(bayestopt_.p4(k(i))-bayestopt_.p3(k(i))); stdd = bayestopt_.p2(k(i))/(bayestopt_.p4(k(i))-bayestopt_.p3(k(i))); bayestopt_.p6(k(i)) = (1-mu)*mu^2/stdd^2 - mu ;