Print

Print


Dear Peter,

Not a problem, it's very kind of you to help at all!

That is indeed the problem, that DCM.U contains 4 inputs, but in my original DCM file, specified 'by hand' (in SPM), I'm only including 3 of the 4 inputs (DCM.U lists only neutral, fear, anger), so it is ok for DCM.b to be 4x4x3, and DCM.c as 4x3.

Somehow when running my automation script, it automatically adds in the 4th input into the DCM.U variable. I don't know if there's a line or two in the automation script that I can change to fix this?

Best wishes,
Raphael
________________________________
From: Zeidman, Peter <[log in to unmask]>
Sent: 04 February 2019 09:15
To: Underwood, Raphael; [log in to unmask]
Subject: RE: [SPM] DCM specification script help


Dear Raphael

Sorry for the delay in getting back to you. Your DCM won’t estimate because DCM.b and DCM.c are the wrong size. You have 4 experimental inputs in DCM.U (neutral, fear, anger, happy) but DCM.b is of size 4x4x3 when it should be 4x4x4 (regions x regions x inputs). The matrix DCM.c is 4 x 3 but it should be 4 x 4 (regions x inputs).



Hope that helps,

Peter



From: Underwood, Raphael <[log in to unmask]>
Sent: 28 January 2019 13:16
To: Zeidman, Peter <[log in to unmask]>; [log in to unmask]
Subject: Re: [SPM] DCM specification script help



Hi Peter,



Thank you for responding, and alas, as you've guessed, I'm locked into using DCM8 currently.



I've attached a zip file with 1. the specification script I'm using 2. the base model for one participant I specified by hand (DCM_Anger_Fear_Family_A_Model_1), and 3. the same model specified for the same participant, but created using my specification script (DCM_DCM_Anger_Fear_Family_A_Model_1_1).



Many, many thanks for helping!



Best wishes,

Raphael

________________________________

From: Zeidman, Peter <[log in to unmask]<mailto:[log in to unmask]>>
Sent: 28 January 2019 10:40:23
To: Underwood, Raphael; [log in to unmask]<mailto:[log in to unmask]>
Subject: RE: [SPM] DCM specification script help



Dear Raphael
If you are using the latest of release of SPM (out last month), there is a simpler scripting interface for specifying fMRI DCMs, via the function spm_dcm_specify. Here's the example script included in the help text of that function:

s = struct();
s.name       = 'test';
s.u          = [1 1]';
s.delays     = [1.2 1.2];
s.TE         = 0.05;
s.nonlinear  = true;
s.two_state  = true;
s.stochastic = true;
s.centre     = true;
s.induced    = 0;
s.a          = a;
s.b          = b;
s.c          = c;
s.d          = d;
DCM = spm_dcm_specify(SPM,xY,s);

Most of these settings recapitulate those in the SPM GUI and can be run in a loop over subjects. There are two settings you should be mindful of:

s.u(i,j) sets whether to include regressor j of condition i from the design matrix in the DCM. If you don't have parametric regressors, then j will always equal one.
xY is a cell array of strings containing the filenames of the VOIs to include.

If for any reason you can't upgrade to the latest DCM, e.g. you're half way through an analysis, feel free to share a broken DCM (zipped, as I can't receive .mat files), and I'll take a look at what's wrong.

Best
Peter

-----Original Message-----
From: SPM (Statistical Parametric Mapping) <[log in to unmask]<mailto:[log in to unmask]>> On Behalf Of Raphael Underwood
Sent: 25 January 2019 18:12
To: [log in to unmask]<mailto:[log in to unmask]>
Subject: [SPM] DCM specification script help

Dear DCM experts,

I have inherited a script that allows you to specify a model for multiple participants, using a template model specified by hand in SPM.

The data is taken from a facial emotion task involving neutral, fearful, angry, and happy faces.

My template model has 3 out of 4 inputs included (Neutral, fear, anger, but not happy), and 2 of those inputs are hypothesised to have modulatory input (fear and anger).

The script runs successfully for all my participants, but when I try to estimate a model created by this script, I get this error:

Error using inlineeval (line 14)
Error in inline expression ==> spm_int(P,M,U)  Inner matrix dimensions must agree.

I've determined that when I open the DCM.U variable, my template model has 3 inputs (Neutral, Fear, Anger) as expected, but the models created by the script show all 4 (Neutral, Fear, Anger, Happy). I'm assuming this is the source of the error, and that my script is not creating the U variable properly.

I've copied the section of my script which gets the inputs below, in the hopes that someone can point out what might need editing.
I've noticed that the code for 'main condition' and 'parametric modulator' are identical, which might be part of the problem? Any help appreciated!

Raphael

% inputs
        %==================================================================
        % get 'causes' or inputs U
        %------------------------------------------------------------------
        Sess   = SPM.Sess(xY(1).Sess);
        U.dt   = Sess.U(1).dt;
        u      = length(Sess.U);
        U.name = {};
        U.u    = [];
        for  i = 1:u
            for j = 1:length(Sess.U(i).name)
                switch j
                    case 1 % main condition
                        U.u             = [U.u Sess.U(i).u(33:end,j)];
                        U.name{end + 1} = Sess.U(i).name{j};
                    case 2 % parametric modulator: probability
                        U.u             = [U.u Sess.U(i).u(33:end,j)];
                        U.name{end + 1} = Sess.U(i).name{j};
                end
            end
            nc     = size(U.u,2);
        end