nipype
nipype copied to clipboard
How to correctly enter covariates for the 2nd level fMRI model?
I'm using SPM functions for the 2nd level analysis and would like to use a covariate.
For example, OneSampleTTestDesign
has an optional covariate argument:
covariates: (a list of items which are a dictionary with keys which
are 'vector' or 'name' or 'interaction' or 'centering' and with
values which are any value)
covariate dictionary {vector, name, interaction, centering}
Description is fairly vague on how the values should look like. From the source code it is also not clear to me. I searched on various forums and Internet but couldn't find any example. Can anyone provide more detailed explanation and share some example code?
UPDATE:
class MultipleRegressionDesign(FactorialDesign):
part of the code is a bit more informative, gives mapping to the SPM object. Digging a bit into the SPM, this suggests the following format:
[{'centering': 1,
'name': 'performance_mean',
'vector': [1,2,3,...nsubjects]}]
where 1 in the centering variable should map to "Overall mean" in the SPM. Strangely, this part of the code does not exist in OneSampleTTestDesign
, so I'm wondering whether covariates are taken into account there?
Also, how to make sure these variables are associated to a correct subject/session?
@hstojic - this is quite old at this point and for a two sample t-test, but may help:
https://github.com/satra/sad/blob/master/spm_2lvl.py#L13
Thanks for the update @hstojic. It helped a lot in getting my multiple regression model working!
Thanks for the update @hstojic.