Nilearn mean centering

Hi,
I was following this tutorial for my second level analysis Example of generic design in second-level models - Nilearn

It works ok, but I was wondering are the covariates centered around zero? I cannot find any specific function to do so in nilearn and the tutorial does not address this.

Thank you for your answers :slight_smile:

Hi @Vytautas_Labanauskas, and welcome to Neurostars!

You can see in the tutorial that the covariates here are not centered around zero.

However, z-scoring is a simple way to center columns around zero (and also make all columns have unit variance, which is also nice for running models). That can be applied easily with

from scipy.stats import zscore
df.apply(zscore)

where df is a pandas dataframe that contains your design matrix.

Best,
Steven