Nilearn second level design matrix - 2 group, 1 primary outcome, 1 covariate example

Summary of what happened:

I have about ~75 fMRI scans, all of which have been analysed with nilearn first level analysis (very easy to use!). I then take 1 contrast (let’s call it contrast X) from this analysis for the below:

  1. Prior to fitting, I create a design matrix using make_second_level_design_matrix.
  2. I then fit SecondLevelModel, supplying it with the runs and design matrix.
  3. I then use second_level_model.compute_contrast. Easy for one-sample tests, however I am quite confused as to how interactions are represented. I think for my sake and the documentation, having straightforward examples with various scenarios would be very helpful. However, the case I’m interested in is: 2 groups (healthy v. schizophrenia), 1 covariate (age), 1 variable of interest (for this example, let’s use number of cigarettes smoked per month).

Command used (and if a helper script was used, a link to the helper script or the command generated):

1. 
design_matrix = make_second_level_design_matrix(alldat['subject_label'], alldat[['subject_label','group','age','n_cigs']]), This produces a matrix where group.healthy == 1, and group.smoker == -1, age is continuous, n_cigs is continuous, and intercept == 1.
2. 
second_level_model = SecondLevelModel(smoothing_fwhm=12, mask_img=mask)
second_level_model = second_level_model.fit(
    runs,
    design_matrix=design_matrix
)
3.
z_map = second_level_model.compute_contrast(
    second_level_contrast=[?],
    output_type='z_score',
)

Now my question is, what should I specify for the contrast in step 3, if I want to compare the relationship between n_cigs and contrast X between groups, while controlling for age. In other words, does the relationship between number of cigarettes and brain activity during task X differ between those with and without schizophrenia? I understand both binary i.e. [0,0,1,-1,0] and string i.e. [‘group’ * ‘n_cigs’] can be used to specify the second level contrast. I would appreciate examples with both.

Version:

Name: nilearn
Version: 0.10.4
Summary: Statistical learning for neuroimaging in Python
Home-page:
Author: Nilearn developers
Author-email:
License: new BSD
Location: /home/mrspecial/anaconda3/lib/python3.11/site-packages
Requires: joblib, lxml, nibabel, numpy, packaging, pandas, requests, scikit-learn, scipy
Required-by: neuromaps, niworkflows


Thank you for any help!

Rami