Added an error message when the declared mean of beta shaped priors is outside the domain of the beta density.

time-shift
Stéphane Adjemian (Gpm) 2011-05-02 12:33:46 +02:00 committed by Stéphane Adjemian (Scylla)
parent 2ad8d2218f
commit 947ac4281a
1 changed files with 3 additions and 0 deletions

View File

@ -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_.p3(k(i))) || (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 ;