Longitudinal analysis

Hello experts in statistics,

I would like to measure with seed base analysis and nistats the effect of aging on a resting-state longitudinal dataset.

So if I understood correctly the idea is to use either the seed base correlation or GLM for the first level analysis and then create a design matrix for the second-level analysis in which I add age, sex…

https://nistats.github.io/auto_examples/04_low_level_functions/plot_design_matrix.html#sphx-glr-auto-examples-04-low-level-functions-plot-design-matrix-py

The problem is that with the function make_second_level_design_matrix I can’t repeat the same subjects_label name. That is why I am not sure how to proceed for the different sessions of a given subject.

So my question would be what is the best way to proceed with this longitudinal data?

Do I have to consider subjects_label as each MRI session and add Subject in the confounds with the age?

Or do I have to create for each subject a contrast based on their repeated sessions (all seed based z-map of a given subject) with the age in confounds and then create a “third level analysis” with a one sample test?

Or something else?

Thank you very much for your help!!!

Dough