```Hi Donald and Helmut,

Thank you for your useful comments - they were very useful. I just wanted to get back to you with a quick summary of what we ended up doing for our within-subject 2*2*2 design.

Guillaume explained that just outputting the interaction [2 3 4] already models the main effect - so no need to also output the main effect explicitly (I believe that ordinary multiple regression analyses do require that main effects are entered in the model for a proper interpretation of the interaction effect). The main effect can then be examined as usual (e.g. [1 1 1 -1 -1 -1 -1].

We agree that the eye contrast can be used to extract the parameter estimate in each condition (leaving the question of its statistical validity aside). However Guillaume explained that with the subject effect in the design matrix, the design matrix is over-parameterised so that eye(N) is not estimable. Instead, for a 2*2*2 design it could be entered like this:

eye(8)-ones(8)/8

Thank you again!
Deborah

Sent: 30 April 2015 17:00
To: Deborah Talmi
Cc: SPM
Subject: Re: [SPM] Flexible factorial inclusion of subject effect

See inline responses below.

Dear SPM experts and Donald especially,

Thank you for taking the time to try to  help with this matter. We are still struggling and would appreciate further advice.

Recap:
We have an A*B*C within-subject design. Each factor (A,B,C) has 2 levels. We modelled this with flexible factorial design, which Guillaume adapted so that we can include all of our three experimental factors as well as the subject factor. We modelled the main effect of subject (the 'hidden' first factor, by specifying main effect of [1]) and the 3-way interaction (A*B*C, specifying [2 3 4]). We had N subjects. The resulting design  matrix has 8+N regressors. We planned to examine the 3-way interaction by specifying, at the second level, the contrast [1 -1 -1 1 -1 1 1 -1]. We also planned to examine the main effect of factor A, for example, by speficying, at the second level, the contrast [1 1 1 1 -1 -1 -1 -1].

Is this correct?

These should be correct. I guess the subject terms never appear in the model, but are part of the model. Do you know how SPM treats the "hidden" factor?

Donald's response below suggests that it is not, but it's hard for us to follow the logic fully, even after consulting the Gitelman tutorial. Is there any additional source of information on what the design matrix represents as a function of what is modelled? For example, the logic of the design matrix resulting from modelling each of the 3 main effects is difficult to follow/difficult to form 2nd level contrasts on it.

Donald explains that we cannot examine the 3-way interaction without including the main effects in the model. But intuitively, the main effect *is* included in the model in the form of the contrast [1 1 1 1 -1 -1 -1 -1]. Any help in understanding this point is much appreciated!

If I said that you "examine the 3-way interaction without including the main effects", then I misspoke. When I learned statistics and all statistics models that I see outside of imaging, when an interaction term is included in the model, the main effects of each factor from the interaction needs to be included in the model. There may be statisticians that will tell you that you can have the interaction with out the main effects in your model. I won't dispute their view. In that light, you might not need the main effects. It all depends on if the reviewer thinks that they should have been included in the model. In practice it does change the statistics; however, any effect that changes from significant to insignificant or vice versa is likely a weak effect.

Once we understand the design matrix better, perhaps the invalidity of the eye(8) contrast will become clearer, too. Donald explains that "The eye contrast wasn't valid in the original model as it was testing if their was any effect of any regressor" - but we normally use the eye contrast in a fully factorial design exactly for that purpose? He was also concerned about between subject effects - but all subject-specific regressors are weighted zero in the eye(8) contrast.

The invalidity of the eye contrast is due to what it is testing. The null hypothesis for the eye contrast is (for simplicity, I'm only showing 4 conditions):
Ho: A=B=C=D=0
This becomes --> Ho: A=0 or B=0 or C=0 or D=0

This means that each regressor is being tested against 0. This is a between-subject effect. Thus, it is invalid because in any model with repeated-measures in the GLM framework has only one error term and that error term is the within-subject error term. It doesn't matter if you used the full factorial or flexible factorial.

In a purely between-subject model, where you only have 1 measure per subject, the error term is the between-subject error and you can test one regressor against 0 and the eye contrast would be valid.

As the betas for each condition are dependent on the other conditions, I'm not sure how SPM can estimate the contrast correctly. Perhaps due to how the "hidden" factor is treated? Nevertheless, the error term is wrong and its the error term that makes the contrast invalid.

To be clear:
A between-subject effect is an effect comparing one measure across subjects.
A within-subject effect is an effect comparing two measures within subjects.

Finally, we can use the eye(8) contrast by using the contrast manager tool of excluding some of the regressors from the design - but does that remove the modelling of subject effects all together?

There are three parts to the analysis:
(1) Creation of the design matrix;
(2) Estimation of the parameters of the design matrix;
(3) Contrast creation.

Although the eye contrast is invalid for statistical interpretation, it can be used to generate the mean of each condition - potentially. The contrasts do not change how the subjects were modeled in the design matrix.

The question is whether or not you need the subject means need to be part of the contrast. If Guillaume has add the subject means to each condition as part of hiding the subject factor, then the eye contrast will be fine for getting the estimates of each condition. If the subject means aren't included, then the eye contrast will give the mean of each condition relative to the mean of all conditions, rather than relative to baseline.  The contrast is statistically invalid, but can be used to get the weights of each condition. There are two parts to each contrast: (1) The statistic; and (2) con/ess image. SPM can also plot the each condition accurately from an accurate contrast of A=B=C=D=0.

Hope this clears up some of the confusion.

Again, any help would be much appreciated!

Cheers, Deborah

```