# Design matrix of group level analysis resting-state fMRI in Nilearn

Hi everyone,

I am in the process of analyzing resting-state functional connectivity of the amygdala in two groups (treatment vs control) at two different timepoints (baseline vs follow-up). The first level, seed-based analyses have been completed, meaning I have the z-transformed correlation coefficients of the amygdala with all other voxels in the brain, averages across timepoints of the functional scan.

Now, I want to statistically test whether there is a difference between the groups in how functional connectivity changed after treatment (Time x Treatment) interaction - while controlling for Age and Sex. I’m having trouble with how to implement this using the NiLearn package as examples shown on this website are more simple (8.3. Second level models - Nilearn). Would it be possible to test this interaction effect in a repeated measured design using NiLearn, and how would I got about testing this? Will it come down to specifying a more complex design matrix, and then using the Second Level GLM model with the right contrast I am interested in? This would mean I would have to find a way to have one column in my design matrix representing the interaction term Time*Treatment if I am not mistaken.

Thanks a lot!

Hi,
You get it right: the right approach with Nilearn is to design the interaction manually.
Your design matrix Could be something like:
[Age, Sex, treatment, measurement, interaction, intercept], where

• treatment is binary and indicates whether you have a treated case or not
• measurement is binary and is one for second measurement, zero for first measurement,
• interaction is the product of treatment and measurement,
• intercept is only ones.
And your interaction contrast would then be
[0, 0, 0, 0, 1, 0]
HTH,
Bertrand

Hi Bertrand,

Thank you very much. I imagine that the specific columns of the design matrix I would be making will be 1 and -1 for treatment, 1 and -1 for measurement, idem for interaction - rather than 1s and 0s, given the fact I want to find the direction of effect, and not just whether there is an effect? And do I also need to specify in my design matrix somehow what datapoints belong to which participants (in this repeated measures design), or is that taken care of by the subject numbers as a first column indicating the rows?

Second, I hope that you can help me with this as well: NiLearn NiftiMasker gives me the possibility of spatial smoothing (FWHM) at the individual level - when you create a whole brain mask to voxel-wise correlate timecourses with the amygdala seed. It also gives me the option to do this at the group level analysis (SecondLevelModel), when you do the group-based GLM for which I will make the design matrix. I can’t find a lot of literature on when you employ this spatial smoothing. However the following paper (Effects of spatial smoothing on fMRI group inferences - ScienceDirect) highlights that you will get similar outputs spatial smoothing at the individual and group level. This would mean you only spatially smooth your data at either one of the options - individual level or group level - and not both. Is this the main approach in the field?

Thanks a lot!

You can use 1 and -1, it won’t make a difference on the final stat.

Regarding the assignment of data points to participants, I’d do that manually to be sure.

Regarding smoothing at first vs second level, I’m not fully sure in your case, because the input of second level analyses are correlations that are not a linear function of the input. Hence it may make a difference. My intuition is that you rather want to smooth at the first level to have better correlation estimates, and then not smooth at second level. It is possible that this barely makes any difference.

HTH,
Bertrand