Dear Nia,

Thank you for your feedback, again.
I tried and it worked with B as a 4 x 4 x 2 and C as a 4 x 2 matrix. However, in this case, I had to fix some part of the DCM batch as following:

DCM.U.u    = [SPM.Sess.U(1).u(33:end,1) ...
              SPM.Sess.U(2).u(33:end,1)];
DCM.delays = repmat(SPM.xY.RT,4,1);


One thing I wanted to make sure is that condition 1 is equal to the regressor that I put into the first column of my design matrix?
(e.g. In the spm example,
condition(factor) 1 is equal to "Photic", condition2 is "Motion", and condition3 is "Attention". 
Is this right?)

Thank you in advance.

Regards,
Sarah

2012/5/1 Nia Goulden <[log in to unmask]>
Hi Sarah

The dimensions of your B and C matrices are incompatible, you should either have B as a 4 x 4 x 4 matrix and C as a 4 x 4 or B as a 4 x 4 x 2 and C as a 4 x 2 matrix (which is what I think you want).
I think the problem is that you are modelling a different number of conditions in your B and C matrices.

Hope this helps
Nia

On Mon, Apr 30, 2012 at 6:44 AM, Sarah Han <[log in to unmask]> wrote:

Dear SPM experts,


I’m performing DCM using SPM 8. In my fMRI design, there are 4 VOIs and 2 conditions(factors) per subject. There are 26 models in each subject, so I used a DCM batch file. However, I got some error messages during running the DCM batch.

 

This is my DCM script.

 

load(fullfile(data_path,'GLM','SPM.mat'));

 

load(fullfile(data_path,'GLM','VOI_01_1.mat'),'xY');

DCM.xY(1) = xY;

load(fullfile(data_path,'GLM','VOI_02_1.mat'),'xY');

DCM.xY(2) = xY;

load(fullfile(data_path,'GLM','VOI_03_1.mat'),'xY');

DCM.xY(3) = xY;

load(fullfile(data_path,'GLM','VOI_04_1.mat'),'xY');

DCM.xY(3) = xY;

 

DCM.n = length(DCM.xY);      % number of regions

DCM.v = length(DCM.xY(1).u); % number of time points

 

DCM.Y.dt  = SPM.xY.RT;

DCM.Y.X0  = DCM.xY(1).X0;

for i = 1:DCM.n

    DCM.Y.y(:,i)  = DCM.xY(i).u;

    DCM.Y.name{i} = DCM.xY(i).name;

end

 

DCM.Y.Q    = spm_Ce(ones(1,DCM.n)*DCM.v);

 

DCM.U.dt   =  SPM.Sess.U(1).dt;

DCM.U.name = [SPM.Sess.U.name];

DCM.U.u    = [SPM.Sess.U(1).u(33:end,1) ...

              SPM.Sess.U(2).u(33:end,1) ...

              SPM.Sess.U(3).u(33:end,1)];

 

DCM.delays = repmat(SPM.xY.RT,3,1);

DCM.TE     = 0.04;

 

DCM.options.nonlinear  = 0;

DCM.options.two_state  = 0;

DCM.options.stochastic = 0;

DCM.options.nograph    = 1;

 

DCM.a = [1 1 1 1; 1 1 1 1; 1 1 1 1; 1 1 1 1];

DCM.b = zeros(4,4,2);  DCM.b(1,3,1) = 1;

DCM.c = [1 0 0 0; 0 0 0 0; 0 0 0 0; 0 0 0 0];

 

save(fullfile(data_path,'GLM','DCM_model1.mat'),'DCM');

 

% SPECIFICATION DCM "attentional modulation of forward connection"

%--------------------------------------------------------------------------

DCM.b = zeros(4,4,2);  DCM.b(3,1,2) = 1;

 

save(fullfile(data_path,'GLM','DCM_model2.mat'),'DCM');

 

% ESTIMATION

%--------------------------------------------------------------------------

DCM_model1 = spm_dcm_estimate(fullfile(data_path,'GLM','DCM_model1.mat'));

DCM_model2 = spm_dcm_estimate(fullfile(data_path,'GLM','DCM_model2.mat'));

 

 

These are error messages.

-------------------------------------------------------------------------------------------------------------

Error using inlineeval (line 15)

Error in inline expression ==> spm_int(P,M,U)

 Inner matrix dimensions must agree.

 

Error in inline/feval (line 34)

        INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr,

        INLINE_OBJ_.expr);

 

Error in spm_diff (line 80)

    f0    = feval(f,x{:});

 

Error in spm_nlsi_GN (line 253)

    [dfdp f] = spm_diff(IS,Ep,M,U,1,{V});

 

Error in spm_dcm_estimate (line 172)

[Ep,Cp,Eh,F] = spm_nlsi_GN(M,U,Y);

---------------------------------------------------------------------------------------------------------------

 

I think there’s something wrong in DCM.b, however, I don’t know how to fix it.


I would appreciate any help in this regard.

Thank you in advance.

 

Best,

Sarah