From 6293a9f3dc1100f0e982b8285d0f098774b05ebb Mon Sep 17 00:00:00 2001 From: John Ashburner Date: Mon, 21 Sep 2020 14:11:48 +0100 Subject: [PATCH] Bug fix Fixed the beta distribution in updatehyperpars. --- spm_gmm_lib.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spm_gmm_lib.m b/spm_gmm_lib.m index 4a17e8e..b11de25 100644 --- a/spm_gmm_lib.m +++ b/spm_gmm_lib.m @@ -1502,12 +1502,12 @@ alpha0 = b0_priors{1}; beta0 = b0_priors{2}; b0(k) = 0; - alph = N*S; - bet = 1; + alph = 0.5*N*S+1; + bet = 0; for s=1:S [m,b,V,n] = get_posteriors(cluster,s); m1 = m(:,k) - m0(:,k); - bet = bet + m1.' * (n(k)*V(:,:,k)) * m1 + N/b(k); + bet = bet + 0.5*(m1.' * (n(k)*V(:,:,k)) * m1 + N/b(k)); end b0(k) = (alph+alpha0-1)/(bet+beta0); % ---------------------------------------------------------------------