[FieldTrip] NaNs in TFR power spectra resulting from partial artifact rejection

Hans Revers J.T.W.Revers at tilburguniversity.edu
Tue Nov 29 14:17:30 CET 2022


Dear FieldTrip community,

My name is Hans Revers. I am a PhD student in the Cognitive Neuropsychology department at Tilburg University, working on decoding emotions from EEG patterns.
I would appreciate your insight on how to handle NaNs in TFR power spectra resulting from partial artifact rejection.

We have trials of 90 seconds duration, with artifacts marked from pre-processing in Brain Vision Analyzer. We wish to do a time-frequency analysis (montecarlo cluster analysis) and a classification (mvpa-light). We would want to exclude only the artefact parts per trial while retaining the non-artifact parts and the temporal information. Partial rejection of artifacts appears to be the way to achieve this (https://mailman.science.ru.nl/pipermail/fieldtrip/2018-May/012138.html).

     % reject artefact cfg
     cfg_artifact = [];
     cfg_artifact.artfctdef.reject = 'partial';
     % remove artifacts
     cfg_artifact.artfctdef.xxx.artifact = formatArtifactList(Dairy_per_pp(pp_i).cfg);
     % The formatArtifactList() function returns an Nx2 matrix containing
     % the start/end samples of each 'Bad Interval'.
     ConditionA_per_pp(pp_i) = ft_rejectartifact(cfg_artifact, ConditionA _per_pp(pp_i));

This works as expected. Artifact intervals are stored in the cfg of the data in artfcdef.xxx.artifact. Next, ft_freqanalysis results in NaNs in the power spectrum for these intervals with a half taper width before and after. Baseline normalization with ft_freqbaseline seems to handle these NaNs just fine. So far, so good. (I guess we need to make sure that the baseline does not consist of solely NaNs.)
However, when we average over participants with ft_freqgrandaverage, the GA results in a NaN for each time bin that has a NaN for one (or more) of the participants. We had expected a nanmean result.

This could be easily fixed by calculating our own nanmean GA powerspectrum, but I am hesitant to alter the intended workings of FieldTrip and I have the following concerns:
Question 1)  Are there reasons not to use a nanmean GA?

ft_freqstatistics appears to run unaffected by the presence of NaNs in the per-pp power spectra. We are using non-parametric montecarlo cluster analysis with depsamplesT test. ft_statfun_depsamplesT seems to use a nanmean in the calculation of the statistics.
Question 2)   Can we assume that the statistics are reliable? Or do the NaNs compromise the statistics?

And similarly
Question 3) Will mvpa classification results be reliable?

Any help would be appreciated.

Kind regards,
Hans Revers
Department of Cognitive Neuropsychology<https://www.tilburguniversity.edu/about/schools/socialsciences/organization/departments/cognitive-neuropsychology.htm>
Tilburg University



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20221129/254d450b/attachment.htm>


More information about the fieldtrip mailing list