First and Second Level Modeling

Hi There,

I have a series of questions related to modeling finite impulse response functions ‘fir’ using FirstLevelModeling.

My first question relates to how the ‘duration’ information is used in the stimulus timing file in regards to the number of delays specified. For instance, is it better to specify a duration in the stimulus timing file that assumes a hemodynamic total response (rise and fall maybe on the order of 10-15 seconds) so that something like fir_delays=[0,1, 2, 3,4] will capture information across the model-free response lasting 10-15 seconds?

Or, is it better to have the ‘duration’ of trials organized such that one trial onset and duration lead up to the next trial’s onset?

I am asking as I am working with a fast event-related design where there are varying (and short) intervals between trials all lasting at least one full TR but some lasting longer on the order of 10 TRs maximum.

My second question is related to SecondLevelModel. If I want to compare zmaps from two different groups to determine a difference in activity for a particular condition (zmap) from group A to group B, would I replace the following design matrix (of all 1’s) with -1’s for those with zmaps of a different group or with 2’s for those with zmaps from a different group.

design_matrix = pd.DataFrame([1] * len(list_z_maps), columns=[‘intercept’])

Third, is there an easy or effective way to extract the average value from a .nii.gz file ROI from a zmap? As in, if I wanted to extract the average beta value for each zmap from regionofinterest.nii.gz what would be the best approach?

Thanks in advance and apologies for the potentially lengthy/loaded question(s).