Regarding your question about the meaning of the fields in DCM.U...
DCM.U.dt - In your experiment you may only get a volume every 2 or 3 seconds, but in DCM we want to model a finer time resolution than this. So the software splits each of your volumes into a number of time bins (giving us 'microtime'). So for example, if you want 16 time bins per volume, then dt = 1/16 = 0.0625 .
>>> got it....
DCM.U.u - Your input regressor(s), e.g. timecourse of a stimulus switching on and off, in microtime, i.e. using the above dt.
>>> got it
OK, so the key part of the error is:
> DCM.U.dt = SPM.Sess.U(1).dt;
>
> ??? Reference to non-existent field 'U'.
This tells you that either DCM.U or SPM.Sess.U does not exist, when it is expected to. The latter is the more likely cause. So, here's what to investigate...
If you look at the SPM structure loaded into the workspace, has it got a structure within that called Sess, and a structure within that called U? If not, then SPM is not an estimated model created with SPM version 8 or above.
>>> yes i did as you stated and it worked. I understood what Sess file means and what U.u and U.name and U.dt means.
Did you script the creation of the SPM structure too or use the GUI?
>>> No, i didnt script SPM GLM structure. I did that in GUI. I am scripting starting from extracting VOI's. But i did understand those three lines which i asked you for. But I did understand the structure of that file and I can make to work for my design models
>>> One last query about same topic but one step down.
when I extract VOI's, I am asked for 'Adjust data','Which session' and 'Expression' in GUI and Batch.
1) What does it mean by adjust data? Is it trying to adjust data across all the four sessions (my experiment has four sessions).
2) Rather than 'Which session', Can I do it over all the sessions. Because i am looking for effect of a condition which is basically based on activation from sum of all four sessions. My activation list is from t-contrast.
3) Why does it asks for 'Expression'?
I figured this VOI issue which i was mentioning DCM.U.dt file as they are based of SPM.Sess. Please let me know
Thanks
----- Original Message -----
From: "Peter Zeidman" <[log in to unmask]>
To: "Kushal Kapse" <[log in to unmask]>
Cc: [log in to unmask]
Sent: Thursday, July 25, 2013 10:48:14 AM
Subject: RE: DCM.U.dt = SPM.Sess.U(1).dt;
Regarding your question about the meaning of the fields in DCM.U...
DCM.U.dt - In your experiment you may only get a volume every 2 or 3 seconds, but in DCM we want to model a finer time resolution than this. So the software splits each of your volumes into a number of time bins (giving us 'microtime'). So for example, if you want 16 time bins per volume, then dt = 1/16 = 0.0625 .
DCM.U.u - Your input regressor(s), e.g. timecourse of a stimulus switching on and off, in microtime, i.e. using the above dt.
OK, so the key part of the error is:
> DCM.U.dt = SPM.Sess.U(1).dt;
>
> ??? Reference to non-existent field 'U'.
This tells you that either DCM.U or SPM.Sess.U does not exist, when it is expected to. The latter is the more likely cause. So, here's what to investigate...
If you look at the SPM structure loaded into the workspace, has it got a structure within that called Sess, and a structure within that called U? If not, then SPM is not an estimated model created with SPM version 8 or above. Did you script the creation of the SPM structure too or use the GUI?
Best,
P.
> -----Original Message-----
> From: Kushal Kapse [mailto:[log in to unmask]]
> Sent: 25 July 2013 15:15
> To: Zeidman, Peter
> Cc: [log in to unmask]
> Subject: Re: DCM.U.dt = SPM.Sess.U(1).dt;
>
> Hi Peter,
>
> Thanks for your reply. I am using the same dcm__spm8_batch script to
> run my DCM experiment. I did make one model in GUI and went into
> workspace to understand how DCM.U is defined. Following is what my
> error states and below that is what my model (which i made in GUI and
> then looked into workspace) looks like. I am not able to understand
> what the workspace structure of DCM.U means. Please take a look below
> and let me know where am I wrong.
>
> ERROR------------------------------------------------------------------
> -----------------------------------------------------------------
>
>
> ??? Field reference for multiple structure elements that is followed by
> more reference blocks is an error.
>
> Error in ==> script at 80
> DCM.U.dt = SPM.Sess.U(1).dt;
>
> ??? Reference to non-existent field 'U'.
>
> DCM.U structure--------------------------% this is when i did one model
> in GUI and checked it in workspace
>
>
> DCM.U <1x1 struct>
> dt 0.1563 % i didnt understand where this number comes from
> name <1x1 cell> %this is my condition called pictures
> u <1808x1 double> % i didnt understand this at all
> (124,1) 1
> .
> .
> .
> .
> (1747x1) 1
>
> -----------------------------------------------------------------------
> ----------------------------------------------------------------------
>
> my doubts:
>
> 1- i theoretically understand that dt is time bin (sec), but how is it
> calculated? How can i calculate that specifically for my experiment
> 2- DCM.U.u is stimulus function matrix. But where does those matrix
> numbers come from
>
> I am changing the dcm_spm8_batch.m script starting from extracting
> VOI's. Following is the script where i have made the changes so far.
>
> -------------------------------Changes made to dcm__spm8_batch.m for
> replicating my experiment----------------------------------------------
> ---
>
>
>
> % Directory containing the attention data
> %----------------------------------------------------------------------
> ----
> data_path='Z:\datapath\';
>
> % Initialise SPM
> %----------------------------------------------------------------------
> ----
> spm('Defaults','fMRI');
> spm_jobman('initcfg');
> spm_get_defaults('cmdline',1);
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %%%%
> % VOLUMES OF INTEREST
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %%%%
>
> % EXTRACTING TIME SERIES: A
> %----------------------------------------------------------------------
> ----
> clear matlabbatch
> matlabbatch{1}.spm.util.voi.spmmat =
> cellstr(fullfile(data_path,'SPM.mat'));
> matlabbatch{1}.spm.util.voi.adjust = 0; % "effects of ...." F-contrast
> matlabbatch{1}.spm.util.voi.session = 1; % session 1
> matlabbatch{1}.spm.util.voi.name = 'A';
> matlabbatch{1}.spm.util.voi.roi{1}.spm.spmmat = {''}; % using SPM.mat
> above matlabbatch{1}.spm.util.voi.roi{1}.spm.contrast = 3; % "pic
> minus scrambled" T-contrast
> matlabbatch{1}.spm.util.voi.roi{1}.spm.threshdesc = 'none';
> matlabbatch{1}.spm.util.voi.roi{1}.spm.thresh = 0.001;
> matlabbatch{1}.spm.util.voi.roi{1}.spm.extent = 0;
> matlabbatch{1}.spm.util.voi.roi{2}.sphere.centre = [-63 -27 21] %
> arbitrary matlabbatch{1}.spm.util.voi.roi{2}.sphere.radius = 5;
> %matlabbatch{1}.spm.util.voi.roi{2}.sphere.move.global.spm = 1; %
> global max %matlabbatch{1}.spm.util.voi.roi{2}.sphere.move.global.mask
> = ''; % none matlabbatch{1}.spm.util.voi.expression = 'i1 & i2';
> spm_jobman('run',matlabbatch);
>
> % EXTRACTING TIME SERIES: B
> %----------------------------------------------------------------------
> ----
> clear matlabbatch
> matlabbatch{1}.spm.util.voi.spmmat =
> cellstr(fullfile(data_path,'SPM.mat'));
> matlabbatch{1}.spm.util.voi.adjust = 0; % "effects of ...." F-contrast
> matlabbatch{1}.spm.util.voi.session = 2; % session 1
> matlabbatch{1}.spm.util.voi.name = 'B';
> matlabbatch{1}.spm.util.voi.roi{1}.spm.spmmat = {''}; % using SPM.mat
> above matlabbatch{1}.spm.util.voi.roi{1}.spm.contrast = 3; % "pic
> minus scrambled" T-contrast
> matlabbatch{1}.spm.util.voi.roi{1}.spm.thresh = 0.001;
> matlabbatch{1}.spm.util.voi.roi{1}.spm.extent = 0;
> matlabbatch{1}.spm.util.voi.roi{2}.sphere.centre = [21 -6 42] %
> arbitrary matlabbatch{1}.spm.util.voi.roi{2}.sphere.radius = 5;
> %matlabbatch{1}.spm.util.voi.roi{2}.sphere.move.global.spm = 1; %
> global max %matlabbatch{1}.spm.util.voi.roi{2}.sphere.move.global.mask
> = ''; % none matlabbatch{1}.spm.util.voi.expression = 'i1 & i2';
> spm_jobman('run',matlabbatch);
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %%%%
> % DYNAMIC CAUSAL MODELLING
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %%%%
>
> clear DCM
>
> % SPECIFICATION DCM "A to B"
> %----------------------------------------------------------------------
> ----
> load(fullfile(data_path,'SPM.mat'));
>
> load(fullfile(data_path,'VOI_A_1.mat'),'xY');
> DCM.xY(1) = xY;
> load(fullfile(data_path,'VOI_B_1.mat'),'xY');
> DCM.xY(2) = xY;
>
> DCM.n = length(DCM.xY); % number of regions
> DCM.v = length(DCM.xY(1).u); % number of time points
> matlabbatch{1}.spm.stats.fmri_spec.timing.RT = 2.5;
> 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(1)];
> DCM.U.u = [SPM.Sess.U(1).u(33:end,1)];
>
> DCM.delays = repmat(SPM.xY.RT,2,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];
> DCM.b = zeros(2,2); DCM.b(1,1) = 1; DCM.b(1,1) = 0; DCM.c = [0
> 0;1,0]; DCM.d = zeros(2,2);
>
> save(fullfile(data_path,'model-1.mat'),'DCM');
>
>
> % SPECIFICATION DCM "B to A"
> %----------------------------------------------------------------------
> ----
> DCM.b = zeros(2,2); DCM.b(1,1) = 0; DCM.b(1,1) = 1; DCM.c = [1 0;0,0]
> save(fullfile(data_path,'model-2.mat'),'DCM');
>
> % ESTIMATION
> %----------------------------------------------------------------------
> ----
> DCM_model1 = spm_dcm_estimate(fullfile(data_path,'model-1.mat'));
> DCM_model2 = spm_dcm_estimate(fullfile(data_path,'model-2.mat'));
>
>
>
> Please advice me on how to understand DCM.U structure and where am i
> misleading so that i can make those changes.
>
>
> Thanks a lot
>
>
>
> ----- Original Message -----
> From: "Peter Zeidman" <[log in to unmask]>
> To: "Kushal Kapse" <[log in to unmask]>
> Cc: [log in to unmask]
> Sent: Thursday, July 25, 2013 5:29:25 AM
> Subject: RE: DCM.U.dt = SPM.Sess.U(1).dt;
>
> Dear Kushal,
> Sorry, I don't fully understand the problem you're facing.
>
> It seems you're trying to create a DCM by writing a script. I suggest
> you look at the example script at:
>
> http://www.fil.ion.ucl.ac.uk/spm/data/attention/dcm_spm8_batch.m
>
> Alternatively, if you're unsure of the format to use DCM.U, I suggest
> generating a DCM model using the GUI, then loading it into the Matlab
> workspace and having a look at what's inside it.
>
> Feel free to ask again if you're still stuck.
>
> Best,
> Peter.
>
> > -----Original Message-----
> > From: Kushal Kapse [mailto:[log in to unmask]]
> > Sent: 24 July 2013 22:38
> > To: Zeidman, Peter
> > Cc: [log in to unmask]
> > Subject: DCM.U.dt = SPM.Sess.U(1).dt;
> >
> > Hi peter and other SPM users,
> >
> > I am going through same issue for DCM. But my experiment is
> different.
> > I am not able to understand how would i change code(see below), for
> my
> > experiment. I went through spm_get_ons.m and spm_dcm_estimate.m to
> > figure this out. but wasnt successful.
> >
> > DCM.U.dt = SPM.Sess.U(1).dt;
> > DCM.U.name = [SPM.Sess.U.name(1)];
> > DCM.U.u = [SPM.Sess.U(1).u(33:end,1)];
> >
> > I saw one more post on this which stated
> > https://www.jiscmail.ac.uk/cgi-
> >
> bin/webadmin?A2=ind1004&L=SPM&F=&S=&X=61A0FC0F022B49A505&Y=analysisthr
> > e
> > ad%40gmail.com&P=580450
> >
> > "The DCM.U.u field contains the inputs (i.e., input vectors and
> > modulatory vectors resampled into microtime). Microtime is the number
> > of bins each TR is split into, and is specified by
> > defaults.stats.fmri.fmri_t. The offset is specified in spm_get_ons.
> > See around line 238. Therefore, if you you are using a design that
> has
> > been setup by SPM, you should index it exactly as shown in the code
> > you listed below: SPM.Sess.U(k).u(33:end,1) and so on, where k =
> > condition you are indexing."
> >
> >
> > BUT, I am still not able to figure out how i change those three lines
> > for my experiment.
> > I am changing the SPM-DCM code for first time for my experiment and
> > hence if anyone of you guys can give me feedback on this, it would be
> > helpful.
> >
> >
> > Thanks in advance
> > Kushal
> >
> >
> > ----- Original Message -----
> > From: "Peter Zeidman" <[log in to unmask]>
> > To: [log in to unmask]
> > Sent: Monday, April 15, 2013 10:17:00 AM
> > Subject: Re: [SPM] DCM - batch
> >
> > Hi Carmen,
> > (I'm CC'ing the mailing list in case anyone else is following this
> > question.)
> >
> > Your models are different because the one produced using the batch
> > editor has mean-centring switched on, and the one using the GUI does
> > not. Not only will this change your DCM.U.u (changing the mean to
> > zero), but it also alters the interpretation of your DCM results. See
> > the previous message I have pasted below from Karl.
> >
> > (I can't guarantee there are no other differences in your models, but
> > that's the most obvious one!)
> >
> > All the best,
> > Peter.
> >
> > ...
> > If you centre the input, it will have a mean of zero. This means that
> > the modulating input will increase and decrease the extrinsic
> > connectivity (A parameter); as opposed to just increasing it, if the
> > input is always positive. The interpretation of the B parameter
> > therefore changes in a subtle way, and becomes closer to a classical
> > interaction.
> >
> > I hope that this helps.
> > With very best wishes,
> > Karl
> >
> > > -----Original Message-----
> > > From: SPM (Statistical Parametric Mapping)
> > [mailto:[log in to unmask]]
> > > On Behalf Of carmen
> > > Sent: 15 April 2013 09:29
> > > To: [log in to unmask]
> > > Subject: [SPM] DCM - batch
> > >
> > > Dear SPM-list,
> > > I still don’t understand what exactly DCM.U.u is and why the values
> > > differ between a DCM-model created by GUI and the same model
> created
> > > by the batch code. Probably resulting from the differences here,
> the
> > > values for DCM.Ep.A, DCM.Ep.B and DCM.Ep.C differ as well.
> > > This is the code I use (model with 4 VOIs and two conditions as
> > input):
> > >
> > >
> >
> load(fullfile('D:\fMRI\Cannabis\Auswertung_Cannabis\Drona_R30\DCM\DCM_
> > > 3
> > > \GLM','SPM.mat'));
> > >
> > >
> >
> load(fullfile('D:\fMRI\Cannabis\Auswertung_Cannabis\Drona_R30\DCM\DCM_
> > > 3
> > > \GLM','VOI_Thalamus_R_1.mat'),'xY');
> > > DCM.xY(1) = xY;
> > >
> >
> load(fullfile('D:\fMRI\Cannabis\Auswertung_Cannabis\Drona_R30\DCM\DCM_
> > > 3
> > > \GLM','VOI_S2_R_1.mat'),'xY');
> > > DCM.xY(2) = xY;
> > >
> >
> load(fullfile('D:\fMRI\Cannabis\Auswertung_Cannabis\Drona_R30\DCM\DCM_
> > > 3
> > > \GLM','VOI_Amygdala_L_1.mat'),'xY');
> > > DCM.xY(3) = xY;
> > >
> >
> load(fullfile('D:\fMRI\Cannabis\Auswertung_Cannabis\Drona_R30\DCM\DCM_
> > > 3 \GLM','VOI_Hippocampus_R_1.mat'),'xY');
> > > DCM.xY(4) = xY;
> > >
> > > DCM.n = length(DCM.xY);
> > > DCM.v = length(DCM.xY(1).u);
> > >
> > > 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 = cellstr([SPM.Sess.U(1).name, SPM.Sess.U(2).name]);
> > > 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,DCM.n,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 0 0 0 ; 1 1 0 0 ; 1 1 1 0 ; 0 0 1 1 ]; DCM.b =
> > > zeros(4,4,2); DCM.b(3,1,2) = 1; DCM.c = [1 0 ; 0 0; 0 0; 0 0DCM.d
> =
> > > zeros(4,4,0);
> > >
> > >
> >
> save(fullfile('D:\fMRI\Cannabis\Auswertung_Cannabis\Drona_R30\DCM\DCM_
> > > 3
> > > \GLM','DCM_Model1_batch.mat'),'DCM');
> > >
> > >
> > > Thanks a lot!!
> >
>
|