I would need to define contrast and find statistical differences between two groups patients and controls during finger tapping task. Is there a tutorial to do this? I found how to analyze the differences between two conditions here

@mlrocca I think this is a pretty general statistics question, and not really specific to MNE-Python (or MNE-NIRS for that matter). What youâ€™re looking for is a two-sample test of some sort. Whether to do it with a scipy.stats.ttest_ind or something like a linear mixed-effects model is up to you, both are possible. Iâ€™d recommend looking into some statsmodels tutorials (esp. for mixed effects models) to see if people talk about use cases like yours

Actually, my question was not about the type of statistical test to choose but how to define a contrast between two groups for a certain condition in MNE. In other words how it is possible in MNE to define the design matrix and compute the GLM contrast for two groups.

In MNE you can pass any stat_fun and threshold that you want. So given that API, to me the two things you mention above are effectively the same thing â€“ you need to choose the statistical test to yield a test staistic (e.g., t or Z or F) value, and that alongside a reasonable threshold (or set of thresholds with TFCE) will allow you to do clustering.