Skip to content
Snippets Groups Projects
Commit 91035e27 authored by Marco Ratto's avatar Marco Ratto
Browse files

bug fix with non-zero lb bound of invgamma distribution

parent 6d353234
No related branches found
No related tags found
No related merge requests found
......@@ -85,7 +85,7 @@ s = [];
nu = [];
sigma = sqrt(sigma2);
mu2 = mu*mu;
mu2 = (mu-lb)*(mu-lb);
if type == 2 % Inverse Gamma 2
nu = 2*(2+mu2/sigma2);
......@@ -132,10 +132,10 @@ elseif type == 1 % Inverse Gamma 1
end
s = (sigma2+mu2)*(nu-2);
if check_solution_flag
if abs(log(mu)-log(sqrt(s/2))-gammaln((nu-1)/2)+gammaln(nu/2))>1e-7
if abs(log(mu-lb)-log(sqrt(s/2))-gammaln((nu-1)/2)+gammaln(nu/2))>1e-7
error('inverse_gamma_specification:: Failed in solving for the hyperparameters!');
end
if abs(sigma-sqrt(s/(nu-2)-mu*mu))>1e-7
if abs(sigma-sqrt(s/(nu-2)-(mu-lb)*(mu-lb)))>1e-7
error('inverse_gamma_specification:: Failed in solving for the hyperparameters!');
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment