Nilearn Second Level ANOVA

I have computed a contrast for each subject in first level, and now I’d like to run the second level analysis. I have three groups and I’m trying to run an ANOVA to compare the three groups:

design_matrix =
 groupA  groupB   groupC 
   1        0       0
   1        0       0
   1        0       0
   0        1       0
   0        1       0
   0        1       0
   0        0       1
   0        0       1
   0        0       1

model = SecondLevelModel()
model.fit(contrast_map_filenames, design_matrix=design_matrix)

z_map = model.compute_contrast('group', output_type='z_score', second_level_stat_type='F')

Is this correct?

Hi,
I’m afraid that the contrast parser cannot interpret the ‘group’ strong; you probably want to specify the contrast numerically, using something loke:

group = np.array([[ 1, -1, 0], [0, 1, -1]])
z_map = model.compute_contrast(group, output_type='z_score', second_level_stat_type='F')

HTH,
Bertrand