3dLME interaction coding

I am using 3dLME to test some group x time interactions in a longitudinal dataset. The data has 2 groups (TMS v. Sham) and 5 time points (wk0, wk1, wk6, wk7, wk12), but a lot of subjects have missing time points.

I would like to run the overall model with all time points (time as a categorical variable), but then use contrasts to test the group x time interaction for specific pairs of timepoints. So for example test the following interaction: (TMS wk6 - TMS wk0) - (Sham wk6 - Sham wk0).

I’ve been able to get the following contrast to run:
-gltLabel 1 'wk6Mwk0_int -gltCode 1 ‘cond : 1tms -1sham time : 1wk6 -1wk0’

but I’m not sure if this is actually testing the interaction I had in mind, or just a strange combination of two main effects.

Is it possible to write a gltCode to test the interaction I want?

For context, here is what my overall command looks like:

Where the table looks like:
Subj time cond InputFile
502FT wk0 sham sub-502FT_ses-pred1_task-rest_space-MNI152NLin2009cAsym_desc-LamySeed_FZ.nii.gz
502FT wk1 sham sub-502FT_ses-wk1_task-rest_space-MNI152NLin2009cAsym_desc-LamySeed_FZ.nii.gz
502FT wk7 sham sub-502FT_ses-wk1p2_task-rest_space-MNI152NLin2009cAsym_desc-LamySeed_FZ.nii.gz
502FT wk6 sham sub-502FT_ses-postd1_task-rest_space-MNI152NLin2009cAsym_desc-LamySeed_FZ.nii.gz
502FT wk12 sham sub-502FT_ses-postd1p2_task-rest_space-MNI152NLin2009cAsym_desc-LamySeed_FZ.nii.gz
503GL wk0 tms sub-503GL_ses-pred1_task-rest_space-MNI152NLin2009cAsym_desc-LamySeed_FZ.nii.gz
503GL wk1 tms sub-503GL_ses-wk1_task-rest_space-MNI152NLin2009cAsym_desc-LamySeed_FZ.nii.gz
506DC wk1 tms sub-506DC_ses-wk1_task-rest_space-MNI152NLin2009cAsym_desc-LamySeed_FZ.nii.gz
507BM wk0 sham sub-507BM_ses-pred1_task-rest_space-MNI152NLin2009cAsym_desc-LamySeed_FZ.nii.gz
507BM wk1 sham sub-507BM_ses-wk1_task-rest_space-MNI152NLin2009cAsym_desc-LamySeed_FZ.nii.gz
507BM wk6 sham sub-507BM_ses-postd1_task-rest_space-MNI152NLin2009cAsym_desc-LamySeed_FZ.nii.gz


-gltLabel 1 'wk6Mwk0_int -gltCode 1 ‘cond : 1tms -1sham time : 1wk6 -1wk0’

This specification assesses the difference between

wk6 - wk0 under the condition tms


wk6 - wk0 under the condition sham

Or the difference between

tms - sham at time wk6


tms - sham at time wk0

Perfect! Thank you!