Queries regarding nilearn.mass_univariate.permuted_ols

Moving the conversation from Brainhack Discord server

@Assunta asked on 21st June 14:21:

Hello Nilearn experts,

I have a few questions about the implementation of the permute_ols function and TFCE correction. The first regards the computation of the FWE corrected p-values. Is your implementation equivalent to a maximum statistics? i.e., the p-values are computed from the distribution of maximum t-values obtained at each permutation step?

Gonsidering this note in the function:
‘’’

tested_vars : array-like, shape=(n_samples, n_regressors)
    Explanatory variates, fitted and tested independently from each others.

‘’’

Is it the OLS implementation equivalent to the pseudo-inverse? Why are the tested variables fitted separately instead of building a full model including all predictors and covariates?

Regarding the building of a design matrix, in case I have N subjects and M conditions per subject and I want to build a random effect model, shall I create M dummy predictors for the conditions and add N-1 dummy predictors as covariates for the subject random effect?

@bthirion responded on 22nd June 10:19:

Is your implementation equivalent to a maximum statistics? i.e., the p-values are computed from the distribution of maximum t-values obtained at each permutation step? → Yes

Regarding the next question, what is computed amounts to considering different models, each one with a different tested_var

I think that it is possible to add covariates as much as needed.

@Assunta asked on 22nd June 10:27:

So in my case ( I have N subjects and M conditions per subject and I want to build a random effect model) I would like to build a model that considers the tested vars all together, so from what you said that is not what’s currently implemented. Did I understand correctly?
Additionally I was wondering whether your tfce implemetation was compared to the FSL one. Many thanks :slightly_smiling_face:

Awaiting you response to last questions @bthirion. Thanks!

When you say you want to “build a model that considers the tested vars all together”, so you mean that you want to have a single test for all variables (aka F test) ? If yes, I’m afraid it’s not implemented.
If you want to have all covariates in the model, but what to test only one of them, then you need to handle the non-test ones as confounding_vars. Does that make sense ?
Best,
Bertrand

Dear Bertrand,

many thanks for your answer. Yes indeed, I would like to have all variables and confounds in one model to account for potential shared variance and compute both an F contrast for all of them and single contrasts. Your work around solution of adding the other tested variables as confounds every time might be an idea but I also saw that they are ortogonalised with respect to tested variable, which would result in a different model for each tested variable. So probably I could just build my model outside and use your framework for permutations and TFCE computation instead. Just a last think… is the TFCE implementation the same as the FSL one regarding models parameters (was it compared)?