Is there a way to do bootstrapping on epochs to have different evoke ? iter_evoked()

Hello everyone,

I am trying to implement Standardized Measurement Error (Luck et al., 2021) which has a step of doing bootstrapping.

It consists of selecting randomly with replacement a set of n epochs and doing the average on these to have slightly different evoked on which one can calculate peak amplitude and latenciy to estimate the SME.

So I am trying to randomly select n epochs from an evoked object but I have difficulties with using iter_evoked() which iterate sequentially through the epochs of the evoked object (thus disabling random sampling).

More, I am not able to apply average() on the epochs returned by iter_evoked() to constitute new evoked and if I assign the individual epochs retrieved by iter_evoked() to a list I can’t do the average neither.

I want to avoid accessing the data through get_data() as I working with evoked object has the advantage of allowing different manipulations without accessing data directly.

Any help, comment or advice will be greatly appreciated.

Thank you very much.

You can index the epochs object directly:

random_picks = [4, 6, 10, 15, 14]
evoked = epochs[random_picks].average()

Thanks you very much for this solution!