3dMEMA for 2x2 model

I have been using 3dMEMA to calculate group statistics for a 2 group (Patient, Control) x 1 condition (Task) model and have yielded the best results using this method (vs 3dttest++ or 3dMVM), as my groups have a small N and unequal variances. I would now like to build this model to include 2 groups x 2 conditions (Task v1, Task v2). Both groups performed both tasks. Although I can do this in 3dMVM or 3dANOVA2, I would prefer to continue these analyses in 3dMEMA.

After looking through the 3dMEMA help document, it seems from Example 3 that I need to contrast my 2 conditions using 3dREML. Thus far, I have pre-processed my conditions separately using afni_proc.py and so only have stats corresponding to Task-Rest for each condition, but no stats maps for TaskV1-TaskV2. These tasks are essentially 2 different stimulus types, but were carried out in separate runs.

I am a novice AFNI user - but it seems as though I can use 3dDeconvolve to generate an input matrix file for 3dREMLfit to generate these statistical maps. I believe my script for the first step should look something like this, but am unsure what my input files should be or whether I should be concatenating these runs. The tasks have equivalent timing but were completed in separate runs (and have been pre-processed separately thus far). I have been using slide 3 from this document for guidance: https://afni.nimh.nih.gov/pub/dist/doc/misc/Decon/3dDecon_Apr2007.pdf but am still unsure what my input files should be given that I am including 2 runs/stimulus types.

3dDeconvolve -input ? -concat ?
-num_stimts 2
-stim_times 1 ‘1D: 24 72 120 168 216’ BLOCK(24,1)
-stim_label 1 VF.20
-stim_times 1 ‘1D: 24 72 120 168 216’ BLOCK(24,1)
-stim_label 2 VF.60
-glt sym ‘SYM: VF.20 -VF.60’ glt_label 1 20v60
-fout -tout -x1D X.xmat.1D -xjpeg X.jpg
-x1D_uncensored X.nocensor.xmat.1D
-fitts fitts.$subj
-errts errts.${subj}
-bucket stats.$subj

Can anyone provide guidance as to whether these runs should be concatenated prior entering into 3dDeconvolve and if so, if this is an automated step that can be incorporated into my afni_proc.py scripts or whether this needs to be done separately.

Thank you!

I have been using 3dMEMA to calculate group statistics for a 2 group (Patient, Control) x 1 condition (Task) model and
have yielded the best results using this method (vs 3dttest++ or 3dMVM), as my groups have a small N and unequal variances.

Nice to hear this.

unsure what my input files should be or whether I should be concatenating these runs.

You can concatenate those two runs as input, but you have two options to provide the stimulus timing files: 1) adjust the stimulus onset times for the second run so that its onset times are relative to beginning of the first run, or 2) use option -local_times to let 3dDeconvolve know that the stimulus onset times are relative to the beginning of each run.

Thanks for your response, Gang. I ended up just putting both runs for each participant into afni_proc.py, with a unique timing file for each and entered my glt into the model there.

Is it correct that I will need to run 3 separate 3dMEMA analyses to get all respective t-tests, given Groups (1, 2) x Stimuli (A, B)?

Model 1:
3dMEMA
-groups Group1 Group2
-set Group1_AvB
s1 A-B

-set Group2_AvB
s15 A-B
…/

My understanding is that this first model will give me the equivalent of a paired t-test for each group (Group1 mean, Group2 mean) + the interaction term (Group2 - Group1). Is this correct?

And then to examine main effects:
3dMEMA
-groups Group1 Group2
-set Group1_A
s1 A

-set Group2_A
s15 A
…/

And a subsequent analogous model for Stimulus B.

Alternatively, is there a way to enter all of this into one model? The multiple groups example provided here [afni.nimh.nih.gov/MEMA] seems to indicate there is, if I dummy code my group variables and enter this file as a covariate, but it’s unclear what data to input for each of my subjects.

Thank you!

I ended up just putting both runs for each participant into afni_proc.py, with a unique timing file for each and entered my glt into the model there.

Check out the design matrix from afni_proc.py and make sure the data are modeled as you expected.

Is it correct that I will need to run 3 separate 3dMEMA analyses to get all respective t-tests, given Groups (1, 2) x Stimuli (A, B)?

Yes, that seems right for your situation.

is there a way to enter all of this into one model?

Yes, it’s possible to dummy-code the two groups and directly obtain two of the three tests (which two depends on the specific coding strategy), and you would still have to derive the third one either based on the two available from 3dMEMA or through a separate 3dMEMA command.