Task fmri second level analysis nilearn anova post hoc

Summary of what happened:

Hi, neuroimaging experts, I’m performing group analysis using nilearn. I have three groups and wondering how to use nilearn to perform the ANOVA and then post hoc analysis? I was trying to detect the difference in brain activation under specific conditions among three groups. I have design matrix like this:
groupA groupB groupC Intercept
0 1 0 0 1
1 0 1 0 1
2 1 0 0 1
3 1 0 0 1
4 1 0 0 1
5 1 0 0 1
I tried the methods posted previously: Nilearn Second Level ANOVA,

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

group = np.array([[ 1, -1, 0], [0, 1, -1]])
z_map = model.compute_contrast(group, output_type=‘z_score’, second_level_stat_type=‘F’)
it turns out that the function needs single vector, and if i enumerate the contrast vector in group, it will turn out to compare any two groups in the three groups. Any one have any idea how to design the design matrix and how to perform the post hoc analysis? Any help will be really appreciated! thank you very much! :man_bowing:


nilearn version 0.10.2

Environment (Docker, Singularity / Apptainer, custom installation):