Design matrix creation with different stimulus durations

Hi everyone,
I am working on an event-related design with fNIRS and I am preparing the design matrix for GLM analysis. By following the great examples given on the website, I am now at the design matrix creation step.
The events in my design are of variable durations which are specified in the annotation object of my data (for example, the events 3,4,5 are of duration 2.9s and the events 13,14,15 of 6s etc…).
I am then using the mne_nirs.experimental_design.make_first_level_design_matrix() function that requires a stim_dur specification.
The function thus generates a design matrix where all the events from my annotations are of the same duration.
What I would expect is a design matrix where each event duration woud be taken into account.
So I’m afraid that the following GLM won’t take into account the fact that my events have variable durations.
Maybe I’m just not understanding the function properly, but if someone would be able to help with that, that would be amazing :slight_smile:

Hi again, I allow myself to tag @rob-luke because it is a NIRS specific question, hope I am not out of line doing this :slight_smile:

1 Like

Hi there,
In the end I managed to copy and modify the make_first_level_design_matrix() function by replacing the stim_dur argument by my data’s annotation (raw.annotation.duration) and it works perfectly, each of my design matrix regressor is specific to the annotation’s durations.
I saw that in the native Nilearn function, it was possible to do so. Maybe it might be something that would be easy to specify as an argument in a future version?
Sorry for disturbing you, but maybe it would be a topic that would interest people who encountered the same problem, so I’ll mark this commentary as the solution.
Best to everyone
Jérémie

1 Like