JoramSoch / MACS

MACS – a new SPM toolbox for model assessment, comparison and selection
GNU General Public License v3.0
23 stars 6 forks source link

cvBMS with Gibbs Sampling Question #13

Closed BAshinoff closed 1 year ago

BAshinoff commented 1 year ago

Hi again,

I have gotten nearly all analyses in the toolbox to work! But I have run into one (hopefully!) final issue.

When running cvBMS (automatic) with Gibbs Sampling, I get an "Unrecognized function or variable" error for "exp_prob" on line 253 of "MS_BMS_group"

I looked through the code and I couldn't find where that variable was defined, and I couldn't find it as a function or datafile on google.

Below is the section of code in question and I have indicated where the code crashes. Any suggestions would be appreciated! Is it possible that it is supposed to be exp_freq on that line?

And thank you again for this toolbox!

Cheers, Brandon

% Random Effects Inference (Gibbs Sampling) %-------------------------------------------------------------------------% if strcmp(method,'RFX-GS') % prior and posterior if isempty(family) prior = ones(1,M); else prior = 1./Mj; end; alpha = NaN(M,V); % alpha parameter maps EFM = NaN(M,V); % expected frequency maps EPM = NaN(M,V); % exceedance probabilties maps % voxel-wise sampling spm_progress_bar('Init', 100, 'Sample posterior distribution...', ''); for j = 1:v [alpha_post, exp_freq, exc_prob] = ME_BMS_RFX_GS(LME(:,:,m_ind(j)), prior);
alpha(:,m_ind(j)) = alpha_post'; EFM(:,m_ind(j)) = exp_prob'; HERE EPM(:,m_ind(j)) = exc_prob'; if mod(j,d) == 0, spm_progress_bar('Set',(j/v)*100); end; end; end;

JoramSoch commented 1 year ago

Dear Brandon,

thanks for pointing this out! The line EFM(:,m_ind(j)) = exp_prob'; should have been EFM(:,m_ind(j)) = exp_freq'; in order to correctly reference the variable created two lines earlier. This was solved with commit 5050225, now it should work.

Please note that I don't recommend Gibbs Sampling (but suggest Variational Bayes) for voxel-wise analysis, since completing the RFX BMS for all voxels in a sampling-based manner may take very long. But you can try out and decide based on your available resources and time.

Cheers, Joram.