Dear Guillaume,

Thank you again for your reply!

I am using SPM12. And yes, you are right - the subject effects are on the right hand side. Sorry for the confusion.

spm_make_contrasts([3 3]) outputs 4 contrast matrices. Aside from the interaction and the two main effects, there is the 'Average effect of condition'. What does this one mean? The contrast matrix for this effect is simply a row of 1s: [1,1,1,1,1,1,1,1,1]. And when I enter this into the contrast manager, it tells me this is invalid. Any ideas how I should fix this?

Many thanks,
Judy

On Wed, 11 Dec 2019 at 03:26, Flandin, Guillaume <[log in to unmask]> wrote:
Dear Judy,

Which version of SPM are you using? I would expect the subject effects
to be on the right hand side of the design matrix.

No need to test for the subject effects and consider them as nuisance
variables. Provided they match the order of the regressors in the design
matrix, the contrasts look ok; they are the ones given by:

  c = spm_make_contrasts([3 3]);

Best regards,
Guillaume.


On 09/12/2019 06:22, Judy Zhu wrote:
> Dear Guillaume,
>
> Thank you very much for your response!
>
> I've now specified my model as you described, adding the main effect of
> "Subject" and removing the main effects of A and B (leaving only the [2
> 3] interaction in there). In the "design matrix", I now have 24 columns
> on the left (representing the 24 subjects in the dataset), and 9 columns
> on the right (A1B1, A1B2, A1B3, A2B1, A2B2, A2B3, A3B1, A3B2, A3B3 ).
>
> My questions are as follows:
>
> 1. Do I need to explicitly test for the subject effect? If so, what
> should the contrast matrix look like? (I am not interested in the
> difference between individual subjects. I would like to look at them
> collectively as my experimental stimuli were counterbalanced /across
> /subjects.)
>
> 2. Based on my understanding so far, I've created the following contrast
> matrices to test the main effects of A and B, and the A*B interaction.
> Do these look correct to you?
>
> To test for main effect of A:
> zeros(1,24)  1 1 1 -1 -1 -1 0 0 0
> zeros(1,24)  0 0 0 1 1 1 -1 -1 -1
>
> To test for main effect of B:
> zeros(1,24)  1 -1 0 1 -1 0 1 -1 0
> zeros(1,24)  0 1 -1 0 1 -1 0 1 -1
>
> To test for A*B interaction (3x3):
> zeros(1,24)  1 -1 0 -1 1 0 0 0 0
> zeros(1,24)  0 1 -1 0 -1 1 0 0 0
> zeros(1,24)  0 0 0 1 -1 0 -1 1 0
> zeros(1,24)  0 0 0 0 1 -1 0 -1 1
>
> Many thanks for your helpful advice!
>
> Kind regards,
> Judy
>
> On Fri, 6 Dec 2019 at 21:28, Flandin, Guillaume <[log in to unmask]
> <mailto:[log in to unmask]>> wrote:
>
>     Dear Judy,
>
>     Your design is unnecessary overparameterised and does not model subject
>     effects. Instead define three factors: subject (independent, equal), A,
>     B (dependent, equal, for both), and specify Main effect: 1, and
>     Interaction: [2 3]. Testing for main effect of A and B, and AxB
>     interaction will require F-contrasts (i.e. multidimensional contrasts)
>     because you have more than two levels per factor.
>
>     Best regards,
>     Guillaume.
>
>
>     On 06/12/2019 05:09, Judy Zhu wrote:
>     > Hello Everyone,
>     >
>     > I am analysing repeated-measures data in a 3x3 design (i.e. two
>     factors,
>     > each with 3 levels). I am using a flexible-factorial model and
>     have done
>     > the steps of "Specify 2nd-level" and "Estimate". When specifying the
>     > model, I included the 2 main effects & their interaction (hence, there
>     > are 15 columns: A1, A2, A3, B1, B2, B3, A1B1, A1B2, A1B3, A2B1, A2B2,
>     > A2B3, A3B1, A3B2, A3B3). 
>     >
>     > Now I am at the "Results" step and am prompted to enter contrast
>     > matrices. I have searched through the forums but have not found an
>     > example of how to test a 3x3 design. I have constructed the following
>     > contrast matrices based on my understanding so far, and would like to
>     > check with you if they are correct:
>     >
>     > Main effect of Factor A:
>     >
>     > 1 -1 0 0 0 0 1/3 1/3 1/3 -1/3 -1/3 -1/3 0 0 0
>     >
>     > 0 1 -1 0 0 0 0 0 0 1/3 1/3 1/3 -1/3 -1/3 -1/3
>     >
>     >
>     > Main effect of Factor B:
>     >
>     > 0 0 0 1 -1 0 1/3 -1/3 0 1/3 -1/3 0 1/3 -1/3 0
>     >
>     > 0 0 0 0 1 -1 0 1/3 -1/3 0 1/3 -1/3 0 1/3 -1/3
>     >
>     >  
>     >
>     > 3x3 Interaction (A*B):
>     >
>     > 0 0 0 0 0 0 1 -1 0 -1 1 0 0 0 0
>     >
>     > 0 0 0 0 0 0 0 1 -1 0 -1 1 0 0 0
>     >
>     > 0 0 0 0 0 0 0 0 0 1 -1 0 -1 1 0
>     >
>     > 0 0 0 0 0 0 0 0 0 0 1 -1 0 -1 1
>     >
>     >
>     > When there are multiple rows in a contrast matrix, does that mean
>     > multiple tests are being conducted to test that effect? Does SPM
>     > automatically take care of the multiple comparison problem in this
>     case?
>     >
>     >
>     > Any advice would be greatly appreciated. Thank you very much in
>     advance!
>     >
>     >
>     > Kind regards,
>     >
>     > Judy
>     >
>     > ---
>     >
>     > Judy D. Zhu
>     > PhD Candidate
>     > Department of Cognitive Science 
>     > Macquarie University, Sydney, Australia
>
>     --
>     Guillaume Flandin, PhD
>     Wellcome Centre for Human Neuroimaging
>     UCL Queen Square Institute of Neurology
>     London WC1N 3BG
>

--
Guillaume Flandin, PhD
Wellcome Centre for Human Neuroimaging
UCL Queen Square Institute of Neurology
London WC1N 3BG