I am in a technical pickle. I am trying to replicate an analysis from a study that uses 600ms epochs to estimate the fronto-parietal weighted phase lag index (wPLI) in the theta range (5-8Hz).
Upon doing this using MNE (spectral_connectivity_epochs), I get a runtime warning saying that the data is too short and that spectral estimates will be unreliable (pasted below).
RuntimeWarning: fmin=5.000 Hz corresponds to 3.000 < 5 cycles based
on the epoch length 0.600 sec, need at least 1.000 sec epochs or fmin=8.333.
Spectrum estimate will be unreliable.
wpli_temp = spectral_connectivity_epochs(dat, sfreq = 250, indices=ind, method='wpli', fmin=freq[0], fmax=freq[1],
Is there any way to circumvent this? Maybe by padding the data? Or is the only way to get reliable connectivity values to have data at least 1s long? (That would be unreasonable for many analyses)
Since the study I am trying to replicate has estimated this, I should be able to too?
padding the data will probably make the warning go away but won’t make the estimate any more reliable. I tried to look at the paper but the full-text link is not working this morning so it’s hard to say whether the original authors were doing something clever or doing something wrong
My instinct would be to make the epochs longer to begin with (with adjacent data, not padding with zeros) — as long as this is possible given the experimental design (i.e., you don’t want to include an extra 400ms if the next trial is already starting by then). If it’s not possible, you may just have to accept that the spectral estimates will be noisy.
I really appreciate your quick reply. I would ideally like to use smaller windows than 1s since other contaminating information from other events (within the same trial) could come into the data.
The authors do use Morelet wavelets for their spectrogram analyses and also to get the phase. My guess is this is what they use in the wPLI analysis? Because they don’t specify a separate method for getting the phase (or cross-spectra) for that analysis. I have pasted what I think is the relevant paragraph from the Methods although I am still sufficiently confused. Will this give better and more accurate spectral estimates?
Subsequentially, we implemented time-frequency analysis by convolving the time series data with a set of complex Morlet wavelets (whose cycles increased between three and eleven cycles as a function of frequency), defined as complex sine waves tapered by a Gaussian. Convolution was performed via frequency-domain multiplication, in which the Fourier-derived spectrum of the EEG data was multiplied by the spectrum of the wavelet, and the inverse Fourier transform was taken. Then, we obtained the phase extracting the angle relative to the positive real axis and the amplitude by extracting the absolute value of the resulting complex time series.
I think zero padding for frequency analysis is a common thing to do, but I guess I’m unsure how it affects downstream connectivity analysis. I don’t want to give you the wrong answer
I think you can try both and if there are results indicating that zero-padding does not affect the wPLI, then feel free to open a GH issue/PR where we can suggest the user zero-pad. Maybe even we can use your minimal-working-example (if you have one at that time) as an example/tutorial.