Dear Patrick,
I think I would keep the constant term in X. Note that K are the low
frequency confounds, not the whitening matrix. I don't think you should
use the covariance components SPM.xVi.Vi but the covariance matrix V is
only available in SPM.xVi.V after seeing data so what you can do is
impose its shape (eg use spm_Q); I see this is what they do in
Neurodesign where the assumed autocorrelation coefficient 'rho' is a
user-specified input:
https://www.biorxiv.org/content/biorxiv/early/2017/03/23/119594.full.pdf
Best regards,
Guillaume.
On 20/01/18 15:51, Patrick Sadil wrote:
> I'm looking for some help in calculating the efficiency of a design. I'm unsure about some of the components of an SPM.mat file. If I generate an SPM structure using:
>
> SPM = spm_run_fmri_spec(matlabbatch{1}.spm.stats.fmri_design);
>
> where, matlabbatch is, say, a structure generated from entering a design into the gui and saving the job script. Is it true that I'll still need to whiten and detrend the design given in SPM.xX.X? So, If I were calculating a- and d-optimality does the following look correct?
>
> % design matrix convolved with hrf. exclude the intercept (does this need to be done, or can I just have a contrast matrix that excludes the final column?)
> X = SPM.xX.X(:,1:end-1);
>
> % autocorrelation to remove
> V1 = SPM.xVi.Vi{1};
> V2 = SPM.xVi.Vi{2};
>
> % set of contrasts (if want to detect each condition)
> % no derivatives used, so each column is a beta of interest
> n_contrasts = size(X,2);
> C = eye(n_contrasts);
>
> % whitening filter
> K = SPM.xX.K.X0;
>
> % detrended and whitened design
> IPvs = eye(size(K,1)) - ...
> ((V1 * inv(V1' * V1) * V1') * (V2 * inv(V2' * V2) * V2') * (K * inv(K' * K) * K'));
> M = (X' * V' * IPvs * V * X );
>
> a_optimality = n_contrasts / trace(M);
> d_optimality = det(C * M * C') ^ (1/n_contrasts);
>
> Thanks,
> Patrick
>
--
Guillaume Flandin, PhD
Wellcome Trust Centre for Neuroimaging
University College London
12 Queen Square
London WC1N 3BG
|