Lab Talk

Pitfalls of Filtering the EEG Signal

Filtering of the EEG signal to remove artifacts is a common pre-processing step but introduces temporal distortions in the signal. How do you chose a filter for your particular analysis goals?

Digital filtering is a common preprocessing step when analyzing EEG data. The typical practice in EEG signal processing is to apply a high-pass filter to filter out slow frequencies less than 0.1 Hz or often even 1 Hz and a low-pass filter to filter out frequencies above 40 or 50 Hz Hz.  Although filters (and there are many types of them!) can be extremely useful in reducing and/or separating noise from the signal of interest, they are not entirely harmless. Numerous studies demonstrate that filtering can affect and distort the shape/temporal structure of EEG signals or event related potential (ERP) data (1-4). So, are they a necessary evil for EEG signal processing? Or can we do without them?

Some Basics of Digital Filtering

Filters can be designed to have a Finite Impulse Response (FIR) or Infinite Impulse Response (IIR).   An impulse response is simply how the filter handles a unit impulse signal in the time domain (what it does to the signal structure) and its Fourier transform is known as the frequency response. Knowing the impulse response can tell you what you need to know to characterize the behavior of the filter.

An FIR filter, as the name suggests, has an impulse response for a finite duration, after which the output goes to zero and produces equal delays at all frequencies (also known as linear phase response). In contrast, IIR filters (also known as recursive filters) have an infinite impulse response where part of the output of the filter is used as feedback. This produces unequal delays at different frequencies (nonlinear phase characteristics). This means that the output signal is shifted in time with respect to the input with some frequency components shifted more than others.  The main advantage of IIR filters, however, is that they are computationally more efficient.

Another aspect of filter design is the direction of the signal used as input.  Filters that include only past and present information are known as causal filters while filters that depend on the past and future input are known as an acausal or noncausal filters. Causal filter produces response after the onset (t=0). Non-causal filters produce a response even before the onset due to backward filtering and also produce larger side lobes.  The figure below from Rousselet [5] illustrates the difference between causal and non-causal filter via their impulse responses. Acausal filtering is achieved in practice by filtering the data once forward and then again backward and can help in minimizing the introduction of phase delays in the signal. Since acausal or non-causal filter requires the full data, this cannot be done online or real-time (like causal filter) but is an offline operation, done after data acquisition.

 

The figure below, from Acunzo et al [7], provides a demonstration of how a causal filter distorts the shape of the signal, whereas acausal or non-causal filter is very good at preserving the shape of the signal, but it introduces differences in the signal even before its onset at t=0 , due to backward filtering.

Another important parameter of filters is the order which depends on how much of the past  information is included and therefore determines how steeply the amplitude of frequencies beyond the cut-off of the filter decrease or ‘roll off’.  As filter order is increased, the sharpness of the roll-off increases. This would appear a good thing, but it comes with a price – it results in a greater computational cost and introduces time delays in the data.

Thus there are many criteria and trade-offs to consider in the design and selection of a digital filter.

Filter Choice in EEG Analysis

The type of filter to choose depends on the type of analysis one is performing with the EEG data. This is particularly important for analysis where elements of temporal structure are being analyzed such as in ERPs where filter choice can dramatically alter results.

A study by Vanrullen using simulated data [8] demonstrates that the onset latency in the ERP can be affected by tens to hundreds of milliseconds due to smoothing effects of low-pass filtering, an outcome that arises most prominently with the use of non-causal filters [6].  Although non-causal filters provide the desirable property of zero-phase delay, it introduces side lobes even before the impulse response (this is due to backward filtering, see the figure above), which can cause the ERP onset to appear earlier than it is, which can lead to false interpretations in ERP studies. Thus, his suggestion was to use causal filters to study ERP onsets.

There is however, considerable debate on the specifics. In contrast to the study by Vanrullen, Rousselet [5] found that low-pass filtering had no effect on the ERP onsets on his data, but rather that high-pass filtering was more problematic, suggesting the use of a causal high-pass filter.  In another study Wildman and Schröger [6] compared the effects on signal latency and shape and artifacts of different filter choices using Vanrullen’s simulated data.  They report that the effects reported by Vanrullen and colleagues are overestimated by an order of magnitude and that the use of asymmetric “causal” FIR filters, more often referred to as minimum-phase filters can reduce the delay in causal filtering to a few milliseconds [6].

Using real rather than simulated data Acunzo and colleagues [7] present the issues with non-causal high pass filtering (high pass filtering) on the estimation of ERP latencies. As the cut-off frequency is increased, we see that the later components of ERP related to face (neutal, fearful and emotional) stimuli disappears and the earlier ERP components are pushed downwards. At the cut-off frequency of 0.1 Hz this effect is less dramatic. As the cut-off frequency is increased, effects get worse.

Other measures that involve temporal structure and can be affected as well are entropy and DFA measures.

Thus it is important to keep in mind that filtering will change your data and this should be considered while interpreting the results. Although filtering cannot be avoided altogether, the less filtering done, the better!

Some suggested guidelines

  • High-pass filtering, preferably only in cases where large drifts in the data are present.
  • Setting a proper cut-off frequency for high-pass filtering is crucial. Lower values in the range of 0.01-0.05 is preferred. Higher cut-off may distort the data considerably.
  • Playing around with few cut-off frequencies for high-pass filtering and seeing how it affects the data might be useful.
  • Causal or non-causal? This depends on your goal. As mentioned before, acausal filtering can cause the ERP onset to be earlier than it actually is. So if you are interested in the timing of earliest event avoid non-causal filtering.
  • Most of all, know what kind of filter your software package uses. EEGLAB uses a zero phase FIR filter as a default (it uses the filtfilt() function in MATLAB). FieldTrip (a MATLAB toolbox for EEG and MEG uses a Butterworth filter (IIR) as default. Butterworth filters typically provide flat passband, but this comes at a price of broad transition band. Other IIR filter types include Chebyshev and Elliptic filters, which provide a narrow transition band at the cost of ripples in in passband .

see related post Factors that impact Power Spectral Density estimation

References

  1. Lyons R. G. (2004). Understanding Digital Signal Processing. Upper Saddle River, NJ: Prentice Hall PTR
  1. Luck S. J. (2005). An Introduction to the Event-Related Potential Technique. Cambridge
  2. Kappenman ES, Luck SJ (2010) The effects of electrode impedance on data quality and statistical significance in ERP recordings.
  1. May PJ, Tiitinen H (2010) Mismatch negativity (MMN), the deviance-elicited auditory deflection, explained.
  1. Rousselet (2012) Does Filtering Preclude Us from Studying ERP Time-Courses?
  1. Andreas Widmann and Erich Schröger (2012) Filter Effects and Filter Artifacts in the Analysis of Electrophysiological Data
  1. Acunzo, Mackenzie and van Rossum (2012) Systematic biases in early ERP and ERF components as a result of high-pass filtering
  1. Vanrullen R. (2011). Four common conceptual fallacies in mapping the time course of recognition.

 

 

One thought on “Pitfalls of Filtering the EEG Signal

  1. I would argue that one should never use a HP filter. The only reason that people still use HP filters is historical. In the last century amplifiers had to be ac-coupled to get enough gain to lift the EEG signal up. With the advent of 24 bit ADCs, DC stable electrodes and low bias Instrumentation amplifiers, HP filtering is a non-issue unless you have noise from the trans-epithelia potential that you are trying to hide (i.e.,dry electrodes).

Leave a Reply