Creating events-based design matrix for continuous regressors

I’m attempting to perform a first level GLM in nilearn for a study where the motivation is to examine ROI signal fluctuations with continuous independent variables (in this case, distance from moving object in a maze setting). Before, I was using FSL’s FEAT with the Custom (1 entry per volume) feature where you specify a single value (i.e. distance measurement) for each timepoint in the design matrix. I’m trying to shift this analysis to nilearn, but the documentation says that “To create an event-based design matrix, information about the trial type, onset time and duration of the events in the experiment are necessary”.

Given the irregular timing nature of this study, is there a way to create a design matrix similar to FSL’s custom timing format, or does nilearn have a different implementation strategy?

Just to clarify- it’s not really that the timing is irregular, but rather that you want to include continuous regressors without any kind of HRF convolution directly in the design matrix, right?

If you just want to incorporate your own regressors into the design matrix, I think you could just include them as confounds. I don’t believe that Nilearn will prevent you from building contrasts that use “confound” regressors. An alternative might be to generate the design matrix before running the FirstLevelModel, then adding your own regressors as new columns to the design matrix, and then fitting the model to the updated design matrix. WDYT?

Correct, I didn’t word that clearly. I’ve edited the title of this post to reflect that.

If I’m understanding you correctly, then I would first set up the design matrix using make_first_level_design_matrix, create the 1st level model with FirstLevelModel and then fit the model (.fit) using the created design matrix. Presumably I would set hrf_model=None when creating the design matrix and first level model.

Yes, that sounds like the way to go. I think I misunderstood your original question- I assumed you wanted to include the continuous regressors with other sparse events, in which case you would need to directly merge the continuous and convolved design matrices. The approach you’re proposing should work as long as you only have continuous regressors you don’t want convolved with an HRF.