Nipype/SPM second level with subject weights


I have a first level analysis in nipype (with the SPM interface) and I’d like to take it to a second level analysis adding weights for participants based on behaviour. Does someone know how I can do this?


Ahoi hoi @ayab,

could you maybe elaborate a bit more on what you trying to do?
Do you mean add a regressor that entails some behavioral variable (e.g., test score, etc.)
to the model?
Also, make sure that the analyses, that is the model, you want to run is implemented in nipype’s spm model interface.

Cheers, Peer

Hey Peer,

I want to take betas from the first level analysis (which is indeed using nipype’s spm model interface) and then add a a behavioural predictor for each subject (memory performance) to identify regions in which overall activity is correlated with this performance measure across subjects.


Hi @ayab,

I think nipype’s SPM multiple regression interface could be useful.
If you don’t depend on/need SPM, why not give regression in nistats or nilearn (example on how to run it, doesn’t need to be an SVR, could also be any other sklearn GLM functionality) a try?

HTH, cheers, Peer

with nilearn this would be very easy to do.

an additional pointer if you want to stay with spm:

Thanks Peer and Satra, I’ll try both the multiple regression interface and nilearn/nistats
I was using SPM only because that’s the only interface that seemed to be able to concatenate runs when creating a model, but I’ll check how to adapt it.