[FieldTrip] Mitigating boundary effects with Morlet wavelets

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Wed Mar 27 11:31:00 CET 2024


Dear Erik,

I hate to be a party pooper, but I don’t think that there is very much that can be done in this case. Indeed, as you already mentioned, the U-shape is caused by the fact that the FieldTrip routines only return a valid TF-power estimate for time points that are at least half the corresponding wavelet's (with its frequency specific length) length away from the input epochs’ boundaries. This is just a basic algorithmic limitation. The only way in which the ‘U’ can be widened, is by having longer epochs in the input, which as I understand from your clear description, cannot be easily changed in your case.

Best wishes,
Jan-Mathijs


On 22 Mar 2024, at 13:52, Erik Samuel Nickel via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:


Hello everyone,

My name is Erik Nickel, I am currently working at the University of Tartu. I need advice regarding time-frequency analysis of EEG data in the context of language development research with children diagnosed with developmental language disorder (DLD), specifically focusing on Estonian-speaking children.

We have been conducting an auditory oddball paradigm study, where we collected EEG data using a 32-channel BioSemi system. Prior to analysis, we preprocessed the data using the MADE pipeline, which is based on EEGLAB. The preprocessing steps included highpass filtering at 0.3Hz, lowpass filtering at 50Hz, and baseline correction using a baseline period of [-100 0] ms. The epochs were defined from -1500 ms to 2300 ms around the stimulus onset, with our primary time of interest being [0 700] ms post-stimulus onset.

To perform time-frequency analysis, we have imported the preprocessed data into the FieldTrip format and applied Morlet wavelets using the following code snippet:

```
cfg           = [];
cfg.method    = 'wavelet';
cfg.output    = 'pow';
cfg.foi       = 2:1:30;
cfg.width     = 3;
cfg.pad       ='nextpow2';
cfg.toi       = -1.5:0.02:2.28;
ft_data_dev   = ft_freqanalysis(cfg, ft_data_dev);
```


Our aim is to investigate power spectrum, phase, and connectivity analysis in the context of language development, particularly focusing on low frequencies ranging from 2 to 3 Hz up to 30 Hz.

However, I have encountered challenges in obtaining meaningful data for low frequencies, especially at 2 and 3 Hz, where the resulting values are NaN as well as in higher frequencies but not over all time point. The resulting time frequency representation has the the U shape described before in resources mentioning boundary effect. I suspect that this issue may be related to boundary effects, as our epochs may not adequately capture the low-frequency oscillatory patterns.

To me it seems like the cfg.width plus epoch length should not have these strong boundary effects.

Do you have any advise what I can change in order to get data in the low frequencies?

Best
Erik S. Nickel


**PS:**
I am aware of these resources which discuss this topic:
- https://www.fieldtriptoolbox.org/faq/why_does_my_tfr_contain_nans/<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.fieldtriptoolbox.org%2Ffaq%2Fwhy_does_my_tfr_contain_nans%2F&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Cfdbddbab1ae144515b8608dc4e48ff52%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638471322617404984%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=UAoUp%2FNz%2Bf9oMMTErBlTeKzhq023QJgLN8DlQOku3KI%3D&reserved=0>
- https://www.fieldtriptoolbox.org/tutorial/cluster_permutation_freq/<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.fieldtriptoolbox.org%2Ftutorial%2Fcluster_permutation_freq%2F&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Cfdbddbab1ae144515b8608dc4e48ff52%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638471322617404984%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=Fh4zcWCh2lnx62JUKSclHqMJYv%2BXhioJ6GriBiO%2BcNE%3D&reserved=0>
- https://mailman.science.ru.nl/pipermail/fieldtrip/2012-June/018208.html<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fpipermail%2Ffieldtrip%2F2012-June%2F018208.html&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Cfdbddbab1ae144515b8608dc4e48ff52%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638471322617404984%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=F1F4d9Hd5mPcM8wfEnsS5fGk1d2KmS%2F8HODmjjWxmhI%3D&reserved=0>

--
Erik Samuel Nickel
er/ihm (he/him)
Deutsch, English
M.Sc. Cognitive Science


_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Cfdbddbab1ae144515b8608dc4e48ff52%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638471322617404984%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=fdHgD5qFiwXyVQAnp7LxKis3kf9yEsyuun9wTMbXhzw%3D&reserved=0>
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20240327/28031ea8/attachment.htm>


More information about the fieldtrip mailing list