mne_connectivity.make_surrogate_resting_data#
- mne_connectivity.make_surrogate_resting_data(data, n_shuffles=1000, rng_seed=None, return_generator=True)[source]#
Create surrogate resting-state data for a null hypothesis of connectivity.
- Parameters:
- data
Epochs|EpochsSpectrum|EpochsTFR The time-series or Fourier coefficients to create the null hypothesis surrogate data for. Fourier coefficients can be generated from
mne.Epochs.compute_psd()ormne.Epochs.compute_tfr()withoutput='complex'.Changed in version 0.9: Added support for
mne.Epochsobjects.Note
Storing Fourier coefficients in
mne.time_frequency.EpochsSpectrumobjects requiresmne >= 1.8.- n_shuffles
int(default 1000) The number of surrogate datasets to create.
- rng_seed
int|None(defaultNone) The seed to use for the random number generator. If
None, no seed is specified.- return_generatorbool (default
True) Whether or not to return the surrogate data as a generator object instead of a list. This allows iterating over the surrogates without having to keep them all in memory.
- data
- Returns:
- surrogate_data
listofEpochsArrayorEpochsSpectrumorEpochsTFR The surrogate data for the null hypothesis with
n_shufflesentries. Returned as a generator ifreturn_generator=True.
- surrogate_data
Notes
Use only with non-evoked data
This approach is only suitable for generating surrogate data for a null hypothesis of connectivity from non-evoked data (e.g., resting state, inter-trial period). For working with evoked data, see
make_surrogate_evoked_data().Surrogate data is generated by randomly shuffling the order of epochs, independently for each channel. This destroys the covariance of the data, such that connectivity estimates should reflect the null hypothesis of no genuine connectivity between signals (e.g., only interactions due to background noise) [1].
For the surrogate data to properly reflect a null hypothesis, the data which is shuffled must not have a temporal structure that is consistent across epochs. Examples of this data include evoked potentials, where a stimulus is presented or an action performed at a set time during each epoch. Such data should not be used for generating surrogates, as even after shuffling the epochs, it will still show a high degree of residual connectivity between channels. As a result, connectivity estimates from your surrogate data will capture genuine interactions, instead of the desired background noise. Treating these estimates as a null hypothesis will increase the likelihood of a type II (false negative) error, i.e., that there is no significant connectivity in your data.
Appropriate data for generating surrogates using this approach includes data from a resting state, inter-trial period, or similar. Here, a strong temporal consistency across epochs is not assumed, reducing the chances that genuine connectivity information is captured in your surrogate connectivity estimates.
Finally, it is important to note that you should always compare true and surrogate connectivity estimates from epochs of the same duration. This will ensure that spectral information is captured with the same accuracy in both sets of connectivity estimates. Ideally, you should also compare true and surrogate connectivity estimates from the same number of epochs to avoid biases from noise (fewer epochs gives noisier estimates) or finite sample sizes (e.g., in coherency, phase-locking value, etc… [2]).
Note
make_surrogate_evoked_data()can also be used to generate surrogates from non-evoked data. However, it is computationally more expensive, especially if your end goal is to generate connectivity estimates from non-time-resolved spectral coefficients (e.g., those inEpochsSpectrumobjects).Changed in version 0.9: This function was renamed from
make_surrogate_datato clarify that it is intended for generating surrogate data from non-evoked (e.g., resting state) data, in contrast to the newmake_surrogate_evoked_data()function.References
Examples using mne_connectivity.make_surrogate_resting_data#
Determine the significance of connectivity estimates against baseline connectivity