Nilearn prewhitening task fMRI data

Dear experts,

I have run the preprocessing using fMRIPrep on my MRI and fMRI data. Then I would like to run the first and second level analysis (univariate analysis and MVPA) using nilearn. I learned that I need to use prewhitening to make sure that our data behaves according to the assumptions of the Gauss-Markov theorem. I know fsl, spm, and afni do this. It seems like that nilearn does not achieve this automatically if I understand correctly.

I wonder which code I should use to do the prewhitening using nilearn.

Many thanks for your help.

Xiuyi

Dear Xiuyi,
What is called “pre-whitening” is equivalent to modeling the temporal correlation in fMRI data. This is implemented in the GLM fit of Nilearn: the noise_model parameter of nilearn.glm.first_level.FirstLevelModel. defaults to ‘ar1’, which is probably a good choice for serial correlation modeling.
HTH,
Bertrand

I see. Many thanks for your help. It’s very helpful.