Hi everyone,
For my resting state data I’ve done the preprocessing with fMRIPrep
and calculated connectivity coefficients using nilearn.connectome
. Now I need to do the second level GLM to compare two groups. Amazingly, despite there being lots of great nilearn
tutorials and documentation on running a GLM for contrasting two task based conditions, I found zero guidance on doing it for connectivity coefficients. I also searched github and found no examples there either. I tried following the tutorial for task based GLM and adapted this piece of code with my connectivity coefficients which are in a subject by paired regions dataframe (so one row of coefficients per subject, and one columns for each set of paired regions):
from nilearn.glm.second_level import SecondLevelModel
second_level_model = SecondLevelModel(n_jobs=2).fit(
connectivity_coefficients, design_matrix=design_matrix
)
z_map = second_level_model.compute_contrast(output_type="z_score")
But this doesn’t work because the input data is not in the same format.
Does anyone have some experience with this, or does anyone even have a python piece of code they would share that takes a design matrix and a dataframe with one row per subject which then runs a GLM?
Many thanks in advance!