How do you epoch data from one event marker to the next when the events are not equally spaced?

I have EEG data files that each have around 800 events to mark when fixation crosses come on the screen when a trial starts. I need to be able to create epochs that start at the fixation cross event and finish at the next fixation cross event.

The intervals between these markers are all different because they depend on the amount of time it took the participant to respond to the stimulus.

I didn't see a way to epoch the data in this way. The tutorials show how to epoch a time window around each event but does not mention anything for epoching between event markers.

Is there a way to epoch the data between event markers that don't have a fixed amount time between them?

As far as I know the epoched data in Brainstorm should have the same length in time.

A possible solution in your case is to select the largest time window in your data as the epoch duration (largest window time between two fixations cross),
you may have some overlapped data in some epochs.

1 Like

You can either import epochs with the same size, corresponding to the longest response time in your study. Or create extended events between two markers in your files.

See the two threads below:

1 Like

It seems like you would recommend against epoching using extended events and then using the Combine stim/response process judging by the first thread that you linked. Is that correct?

For our project we will be averaging the epochs and then using an SVM classifier to classify certain cognitive representations linked to social attention. Based on this information would you be able to advise for or against a certain epoching technique? Would using a fixed size epoch based on the longest response time be best or maybe epochs based on the longest time between the fixation crosses? Are there major downsides to having epochs that overlap that would be worse than using extended epochs and then reinterpolating on a different duration?

Thank you for the reply!

If you have different epochs length, you can't average them together

1 Like

I don't have a particular opinion, it mostly depend on your research question and your hypotheses.
I recommend you refer to what is done in the literature in your field.

1 Like

It seems like you wouldn't be able to get accurate averaging results with the largest time window either though. I could be missing something but if I have my epochs starting at -100ms from the fixation cross and then all endpoints 3062ms (longest response time) after the fixation cross there will be 810 responses at different times within that interval so there would rarely be very many responses near each other. This is an image of the results when averaging with equal intervals:

All the green events at the top are the different response times. It just seems like at each time point the averaging wouldn't be able to really tell you anything about what's happening with the signals around the time of the event unless the epochs had all the events aligned at t = 0 when they were averaged.

Am I missing something?

there would rarely be very many responses near each other. [...] It just seems like at each time point the averaging wouldn't be able to really tell you anything about what's happening with the signals around the time of the event unless the epochs had all the events aligned at t = 0 when they were averaged.

What you are describing is correct.
This type of averaging based on the stimulus triggers would be adapted only to study the first perceptual components of the brain response, which are (approximately) time-locked to the stimulus delivery.

Alternatives:

  • If you are interested in what is happening just before or just after the response, you can epoch you data based on the response triggers instead.
  • If you are interested in sustained oscillations between the stimulus and the response that might not be aligned in phase between trials: Compute the time-frequency decomposition of each trial (epoched based on the stim or the response) and average the power across trials: https://neuroimage.usc.edu/brainstorm/Tutorials/TimeFrequency#MEG_recordings:_Single_trials
  • Some other questions might be expanding by expanding/shrinking all the epochs in time, so that they all fit in the same time segment. The process Uniform epoch time can do this.

This topic was already discussed here: