help > Contrast question
Showing 1-11 of 11 posts
Display:
Results per page:
Feb 16, 2018  10:02 PM | Alex Rainer
Contrast question
Hi Donald,

I have a design with, say, 4 conditions: A, B, C, D. Normally, when I set up the contrast for gPPI, I would try contrasts like A_minus_B, or C_minus_D, etc. Is there any way to construct a more complex contrasts like (A_minus_B) minus (C_minus_D)?

AR
Feb 16, 2018  11:02 PM | Donald McLaren
RE: Contrast question
Hi Alex,

Yes.

For any contrast, you can simply build the components of each and subtract them. So, for this case:

0=(A-B)-(C-D)

if we distribute the subtract sign, we get:

0=A-B-C+D

resulting in the contrast vector:
1 -1 -1 1

===============================================================
Now, lets form the two contrasts separately, then subtract them.

0=A-B, gives the contrast vector 1 -1 0 0
0=C-D, gives the contract vector 0 0 1 -1

If we now subtract the C-D vector from the A-B vector, we get:
1 -1 -1 1

These are the two ways to generate any contrast and they both generate the same result.

Best,
Donald


Originally posted by Alex Rainer:
Hi Donald,

I have a design with, say, 4 conditions: A, B, C, D. Normally, when I set up the contrast for gPPI, I would try contrasts like A_minus_B, or C_minus_D, etc. Is there any way to construct a more complex contrasts like (A_minus_B) minus (C_minus_D)?

AR
Feb 21, 2018  07:02 PM | Alex Rainer
RE: Contrast question
Thank you, Donald. I have a related question. As I was running gPPI (this is just for simple contrasts, e.g, A>B; B>A, etc.), I received this message (please note that I added the "..." in the contrast vectors to shorten the number of lines):

Warning:
c is not a proper contrast in +c->Tsp in spm_SpUtil
!!! projecting...
> In spm_SpUtil (line 327)
In spm_FcUtil (line 219)
In spm_contrasts_PPI (line 159)
In PPPI (line 885)
In gPPI_setup (line 133)

from

c=
0
...
0.2500
0
0
...
0
0
0
0.2500
0
0
0
...
0
0
0
0
0
0
-1.0000
0
...
0
0.2500
0
...
0
0
0.2500
0
...
0
0
0

to

c=

0
...
0
0
0
0.2500
0
0
-0.2500
0
...
0
0
0.2500
0
0
-0.2500
0
0
...
0
0.2500
0
0
-0.2500
0
...
0
0
0
-0.0658
-0.0000
-0.0290
0
0
...
0
0
0.2500
0
0
-0.0235
-0.0125
0
0
...
0
0
0.0002 

In the original contrasts when I built my GLM, due to the different numbers of sessions for different conditions, I weighed the vectors so the sum within each vector would be 0. For instance, for an event that appears in 4 sessions, the value would be 0.25 while for another event that appears in 1 session, the value would be 1. It looks like the contrast vectors have been changed when I ran PPI. Does this look problematic to you?

AR
Mar 1, 2018  04:03 AM | Donald McLaren
RE: Contrast question
Hi Alex,

Something does not look correct. Could you upload the P structure and the SPM.mat for the gPPI analysis. There is something that is being forced to change for an unknown reason.

Did you manually define these contrast vectors or did they get generated by the script?

I can't tell if its do to the column naming or if the columns are too dependent on each other or if something has gone horribly wrong for another reason.

I'll first check the initial contrast, then I'll try to work out why it was changed and what the change means for the interpretation.


Best,
Donald
Mar 6, 2018  12:03 AM | Alex Rainer
RE: Contrast question
Hi Donald,

Please see the attached for the files.

edit: SPM file is too big. I'll find another way to share it.

Thanks,

AR
Attachment: P.mat
Mar 6, 2018  02:03 AM | Donald McLaren
RE: Contrast question
Hi Alex,

Which of the 12 contrasts did this odd behavior happen?

Best,
Donald
Mar 6, 2018  03:03 PM | Alex Rainer
RE: Contrast question
Hi Donald,

It looks like it starts with the first contrast. I've uploaded here the updated P (the last one I sent you may have been incorrect). I'll upload the SPM through FileShare (thank you for initiating the request).

Best,

AR
Attachment: P.mat
Mar 6, 2018  04:03 PM | Donald McLaren
RE: Contrast question
Hi Alex,

As far as I can tell, I think you should be fine with the current contrasts. If you wanted to check a few manually, you could simply take the beta maps and compute the contrast by hand and make sure it matches.

The change to c is never saved as far as I can tell.

However, you may want to consider the concatenation option for these models as session 5 only has 2 trials for GS_5cent. This will cause the PPI columns to be collinear with the non-PPI columns, which will lead to unstable estimates. This is also why the c+ warning was issued.

Best,
Donald
Mar 6, 2018  10:03 PM | Alex Rainer
RE: Contrast question
Thank you, Donald! That's very helpful.

AR
May 31, 2018  10:05 PM | Alex Rainer
RE: Contrast question
Hi Donald,

Sorry for digging up my previous old post. I finally got around to working on this again. Regarding the contrasts, I have8 conditions: cond1, cond2,.., cond8. I'd like to examine connectivity in contrast [(Cond1 - Cond2) > (Cond3 - Cond4)]. Below is the setup I have following the manual. Please let me know if the Contrast setup section looks right?

P.equalroi=0;
P.FLmask=1;
P.subject=char(subj_ID});
P.directory=pwd;

P.VOI=roi_dir;
P.Region=VOI_ID;
P.Estimate=1;
P.contrast=0;
P.extract='eig';
P.Tasks={'0' 'Cond1' 'Cond2' 'Con3' 'Cond4'...
'Cond5' 'Cond6' 'Cond7' 'Cond8'};

P.Weights=[];
P.analysis='psy';
P.method='cond';
P.CompContrasts=1;
P.Weighted=0;
P.outdir=outdir1;
P.GroupDir=outdir2;

% Contrast setup
P.Contrasts(1).left={'Con1' 'Cond2};
P.Contrasts(1).right={'Cond3' 'Cond4'};
P.Contrasts(1).STAT='T';
P.Contrasts(1).Weighted=[1 -1 -1 1];
P.Contrasts(1).MinEvents=4;
P.Contrasts(1).name='Cond1>Cond2_minus_Cond3>Cond4';

Thank you!

AR
Jun 8, 2018  06:06 PM | Donald McLaren
RE: Contrast question
Hi Alex,

The weighted parameter should be a single value that indicates if the contrast is weighted by the number of trials or not. If the value is 0, then the contrast is not weighted by the number of trials. If the value is non-zero, then events where all the duration's are less than the value, then those events are weighted by the number of events.

For the contrast, you want
P.Contrasts(1).left={'Con1' 'Cond4};
P.Contrasts(1).right={'Cond2' 'Cond3'};

The reason behind this due to how we rearrange the equation:
(Cond1 - Cond2) = (Cond3 - Cond4)

becomes

Cond1 + Cond4 = Cond3 + Cond2

when we eliminate the negatives to get the left and right sides.