Dear Pia,
I finally had a look at this and could reproduce the errors you report.
Problem is, spm_fmri_concatenate is a hack. I couldn't find a
satisfactory change to make to the code that would work with both
standard SPM.mat and those modified by this function.
So go ahead with your changes; I was initially surprised by the second
one and instead padded the contrast vector with as many 0s as there are
constant terms (ie length(SPM.xX.iB)) but this is effectively doing the
same.
Note that the VB scheme then assumes there is a single session and the
AR coefficients are therefore not session specific (as they would be
with classical inference).
All in all, you might be better off not using spm_fmri_concatenate and
specify covariates for session-specific effects by hand. The only
difference will be the high pass filter.
Best regards,
Guillaume.
On 16/01/18 16:18, Pia Schröder wrote:
> Dear all,
>
> I am trying to run a Bayesian 1st level GLM analysis.
>
> Due to some experimental details, I have manually concatenated each
> participant's sessions and used the spm_fmri_concatenate function to add
> session regressors and to adjust the high-pass filter and non-sphericity
> estimates.
>
> For my standard GLM analyses this has worked fine. However, when I do
> the same for the Bayesian analysis, I get errors in spm_spm_vb because
> the size of the created HPF matrix does not match my data. I am assuming
> that the spm_spm_vb function has not been adjusted for concatenated
> sessions,yet, and so I thought I'd try it myself.
>
> In spm_spm_vb I have changed two lines of code:
>
> line 829 R0Y = hpf(s).R0*Y(SPM.Sess(s).row,:);
> -----> replaced by: R0Y = spm_filter(SPM.xX.K,Y);
> (the spm_filter function then filters the concatenated sessions separately)
>
> line 888 CC=[CC(SPM.Sess(s).col) ; 0];
> -----> removed
> (to have the correct number of session regressor weights in my contrast
> vector)
>
> It seems to work (at least I don't get any error messages) but I was
> wondering if there is anything else I should change or if I might get
> wrong results this way (especially regarding non-sphericity estimates).
>
> Thanks a lot for any help!
>
> Best,
> Pia
--
Guillaume Flandin, PhD
Wellcome Trust Centre for Neuroimaging
University College London
12 Queen Square
London WC1N 3BG
|