Digital Filter Design
Digital Filter Design
Basic Neuroscience
h i g h l i g h t s
a r t i c l e i n f o a b s t r a c t
Article history: Background: Filtering is a ubiquitous step in the preprocessing of electroencephalographic (EEG) and mag-
Received 30 May 2014 netoencephalographic (MEG) data. Besides the intended effect of the attenuation of signal components
Received in revised form 30 July 2014 considered as noise, filtering can also result in various unintended adverse filter effects (distortions such
Accepted 1 August 2014
as smoothing) and filter artifacts.
Available online xxx
Method: We give some practical guidelines for the evaluation of filter responses (impulse and frequency
response) and the selection of filter types (high-pass/low-pass/band-pass/band-stop; finite/infinite
Keywords:
impulse response, FIR/IIR) and filter parameters (cutoff frequencies, filter order and roll-off, ripple,
Filtering
Filter distortions
delay and causality) to optimize signal-to-noise ratio and avoid or reduce signal distortions for selected
Filter parameters electrophysiological applications.
Preprocessing Results: Various filter implementations in common electrophysiology software packages are introduced
Electrophysiology and discussed. Resulting filter responses are compared and evaluated.
Conclusion: We present strategies for recognizing common adverse filter effects and filter artifacts and
demonstrate them in practical examples. Best practices and recommendations for the selection and
reporting of filter parameters, limitations, and alternatives to filtering are discussed.
© 2014 Elsevier B.V. All rights reserved.
http://dx.doi.org/10.1016/j.jneumeth.2014.08.002
0165-0270/© 2014 Elsevier B.V. All rights reserved.
Please cite this article in press as: Widmann A, et al. Digital filter design for electrophysiological data – a practical approach. J Neurosci
Methods (2014), http://dx.doi.org/10.1016/j.jneumeth.2014.08.002
G Model
NSM-6995; No. of Pages 13 ARTICLE IN PRESS
2 A. Widmann et al. / Journal of Neuroscience Methods xxx (2014) xxx–xxx
underestimation of onset latency (VanRullen, 2011), artificial com- a black box having two inputs and two outputs (also named four-
ponents (Acunzo et al., 2012), or spurious dependencies of stimulus terminal network or quadripole). We do not go into the details here
detectability on pre-stimulus phase (Zoefel and Heil, 2013). Impor- but simply state that this is a powerful concept for the analysis of
tantly, in many cases these signal distortions are not necessarily a complex situations in analog electronics or signal processing. One
consequence of filtering per se but rather a consequence of poor electrode is fed to one input and the reference to the other. The out-
filter design. We have identified two reasons for the persistence put represents the filtered signal of this electrode against the same
of suboptimal practices: (a) lack of understanding of implications reference. This box representation provides us with a standardized
of filter parameters; (b) lack of investigation of the consequences way of analyzing filter properties: feeding test signals to the input
of data filtering. In summary, researchers are often not aware of and evaluating the output. All temporal filters can be investigated
the signal changes introduced by the application of a filter. As a this way. A further interesting point of the two-port network model
consequence, filtering is not devoted the effort it would deserve is that more complicated filters such as band-pass filters can be eas-
(considering the possible distortions) as it is “just a minor part” ily constructed as a chain of a low-pass and a high-pass filters or
of data preprocessing. We strongly recommend selecting the fil- vice versa.
ters and adjusting their parameters specifically to the needs of
each application to achieve the required attenuation of noise with- 2.1. Filter responses
out biasing the estimated parameters and to avoid the frequent
practice of reusing a previously applied filter without careful con- By convention, filters are tested with a single very sharp pulse as
sideration. Researchers in electrophysiology should investigate the a test signal. The filter response to this input is then the so-called
filter’s impact on the estimates they would like to report. We would impulse response. The frequency response is the Fourier transform
encourage everybody to use filters, but to realize that they are like of the impulse response and consists of two parts, namely the
sharp knives – a very useful tool but to be handled with care. magnitude and the phase response. All these responses are used to
Here, we aim to formalize the filter parameters relevant for elec- characterize properties of the filter. The impulse and the frequency
trophysiological data and to evaluate the filter responses. In order response describe the transfer function of a filter in the time or fre-
to keep this introduction widely accessible, we narrowed down quency domain. That is, they describe the effect of a filter on the
and simplified the complex general concepts of frequency filter- signal input resulting in a filtered output. Therefore, it is essential
ing to the relevant parts for common applications in filter design to understand the filter responses for good filter design.
in electrophysiology, and we avoided formulas where possible. We In the time domain, the filter is described by the filter’s impulse
assume a coarse understanding of the frequency domain represen- response (see Fig. 1A). Sample number (or time in seconds) is usually
tation of signals and the Fourier transform (see, e.g., Smith, 1999 plotted along the abscissa relative to the input signal and amplitude
for introduction and Ifeachor and Jervis, 2002 for further reading). is plotted along the ordinate in linear scale. The impulse response
In the second part, we demonstrate how to adjust filter param- reflects the filter output when filtering an impulse (black dashed
eters in selected implementations in electrophysiology software lines in Fig. 1A). Similar to the impulse response, the step response
and highlight possible caveats. Finally, we examine common signal reflects the filter output when filtering a step signal (e.g., a series
distortions (resulting in the above recommendations) and intro- of zeros followed by a series of ones). Note that DC offset step-like
duce heuristics how to recognize and deal with filter distortions. signals occur in electrophysiology at signal discontinuities result-
In general, we focus on the practical aspects of filter design and fil- ing in DC filter artifacts (often observable at the beginning or end
ter implementations. See, for example, Luck (2005) or Edgar and of epochs or at pauses in the recording). As both impulse and step
colleagues (2005) for a more general and theoretically focused signals have energy across the whole spectrum, they are excellent
introduction on the filtering of electrophysiological data. tools to evaluate possible filter distortions when filtering broad-
band complex signals.
In the frequency domain, the filter’s characteristic is described
2. Part 1: filter design by the Fourier transform of the impulse response, which gives the
magnitude (or amplitude) and the phase responses (see Fig. 1C–E).
Temporal filtering or frequency filtering (in contrast to spatial Frequency is usually plotted along the abscissa in Hertz (from
and other types of filtering) refers to the attenuation of signal com- 0 Hz/DC to half the sampling rate/Nyquist frequency) or normal-
ponents of a particular frequency (band). The common rationale ized units (by convention in MATLAB, frequency is normalized to
behind filtering in general is to attenuate noise in the recor- radians/sample; i.e., one is half the sampling rate). In the mag-
dings, while preserving the signal (of interest). In electrophysiology nitude response, amplitude is usually plotted along the ordinate in
neither noise nor signal are clearly defined as, e.g., sine-shaped linear or logarithmic scale (dB). The magnitude response reflects
oscillations of isolated frequencies. Typically, there is even an the (complex) modulus of the frequency response and can only
overlap of signal components and noise components in the same have zero or positive values (see Fig. 1C). The magnitude response
frequency band. The temporal filters discussed here cannot sepa- is the frequency domain envelope, which is effectively multiplied
rate signal from noise in the same band; they will simply attenuate with the spectrum of the signal during filtering. Frequency bands in
everything in the targeted band. It is important to realize that the passband ideally have magnitude values of one, which lets these
changes in the frequency spectrum (the attenuation or delay of spectral components pass without changing their amplitudes. Fre-
spectral components) must cause changes in the temporal signal, quency bands in the stopband ideally have zero magnitude values,
as both representations are coupled by the Fourier transform. Care thereby removing these spectral components in the output. Dig-
must be therefore taken when selecting and designing the filter, ital filters usually deviate from these ideal (zero/one) responses
that is, the filter parameters have to be adjusted in order to achieve depending on other design criteria (e.g., steepness, finite impulse
an improved signal-to-noise ratio to estimate the parameters. How- response), i.e., the stopband actually never removes the spectral
ever, it is impossible to design filters that do not alter the signal at components completely – it attenuates them by a certain (hope-
all. Instead, by selecting the appropriate filter, the signal is altered fully large) factor. In the phase response, phase is usually plotted
according to the researcher’s goals and thereby increased in its along the ordinate in radians or degree. The slope of the unwrapped
signal-to-noise ratio. phase response reflects the delay of the filter output relative to the
The systematic method to design and investigate filters con- filter input. Negative phase values reflect delayed spectral compo-
siders each filter as an element in a two-port network, which is nents. A filter with a linear phase response in the passband has
Please cite this article in press as: Widmann A, et al. Digital filter design for electrophysiological data – a practical approach. J Neurosci
Methods (2014), http://dx.doi.org/10.1016/j.jneumeth.2014.08.002
G Model
NSM-6995; No. of Pages 13 ARTICLE IN PRESS
A. Widmann et al. / Journal of Neuroscience Methods xxx (2014) xxx–xxx 3
Fig. 1. Time domain (impulse and step; panels A and B) and frequency domain (magnitude and phase; panels C–E) responses of an example filter (order 18 linear-phase
low-pass finite impulse response [FIR]). The impulse and step response reflect the filter output of a filtered impulse or step signal (black dashed lines in panels A and B). The
cutoff frequency (1) in the center of the transition band (2) separates passband (3) and stopband (4). The deviation from designed passband (one) and stopband magnitude
(zero) is described by passband ripple (5) and stopband attenuation (6). Note that the transition bandwidth is defined by passband and stopband ripple. The filter delays (7)
the output relative to the input. Signal distortions like smoothing (usually desired) or artifacts like ringing (8; usually undesired) can be evaluated with both time domain
responses, the impulse and step responses.
the same delay for all spectral components, which means that the fast the filtered signal converges to zero following signal deflec-
time domain shape of a signal with spectral components within tions: the higher the cutoff frequency, the faster the filtered signal
the filter’s passband is not changed by filtering. A non-linear phase converges to zero due to the attenuation of low frequencies. Note
introduces frequency-dependent delays, which will cause changes that zero-phase filters (see Section 2.6) introduce a symmetric
in the shape of a signal even for spectral components within the change in the signal around a step, i.e., before and after the step
filter’s passband. (see, e.g., the green line in Fig. 2G). These types of filter distort-
Fig. 1 shows a set of response functions for a linear phase low- ions can easily be observed in the step response. The evaluation
pass filter as an example. The time domain responses give a direct of the step response intuitively helps one to understand that both
impression of how the filter alters the signal (widening or smooth- low-pass and high-pass filters smear the signal in the time domain.
ing of sharp transients, ripples around larger signal changes) and Band-pass and band-stop filters combine a low-pass and a high-
they clearly show the delay introduced by the filter. The frequency pass filter. In most electrophysiology software implementations,
domain responses show details of the filter’s attenuation resolved the roll-off characteristics (or transition bandwidth) of the high-
spectrally and aid the evaluation and appropriate adjusting of the pass and low-pass parts have to be identical (with the exception of,
filter parameters, such as filter type, cutoff frequencies, roll-off e.g., the MATLAB filter design tool). However, steep high-pass filters
(steepness of the change of attenuation in the transition band), are frequently needed in applications such as event-related poten-
amplitude of ripples in pass- and stopband, and even the delay as tials/fields (ERP/Fs) to achieve the intended low cutoff frequencies
the slope of the phase response. (Acunzo et al., 2012; Luck, 2005), while on the other hand the low-
pass transition could be designed significantly shallower. Shallower
2.2. Filter type filters are widely recommended as they produce less signal distort-
ions and spread them less in the time domain (due to their shorter
Low-pass (attenuating high-frequency bands), high-pass (atten- impulse response; see Section 2.4 below). Thus, a separate suc-
uating low-frequency bands), band-pass (attenuating high- and cessive application of a steep high-pass and a shallow low-pass
low-frequency bands), and band-stop filters (attenuating specific filter is often preferred over a band-pass filter with steep high-pass
frequency bands) are implemented in the common electrophysi- and low-pass transition. The use of band-stop filters is not rec-
ology software packages. Attenuating high-frequency components ommended in ERP research as they likely produce strong artifacts
with a low-pass filter smoothens the filter output (see Fig. 2A and B). (see, e.g., Luck, 2005 for examples). In electrophysiology, band-
Attenuating DC (“direct current”) offset and low-frequency com- stop filters are almost exclusively used to suppress line (50/60 Hz)
ponents with a high-pass filter forces the filter signal to return to
zero amplitude.1 The choice of the cutoff frequency defines how
Please cite this article in press as: Widmann A, et al. Digital filter design for electrophysiological data – a practical approach. J Neurosci
Methods (2014), http://dx.doi.org/10.1016/j.jneumeth.2014.08.002
G Model
NSM-6995; No. of Pages 13 ARTICLE IN PRESS
4 A. Widmann et al. / Journal of Neuroscience Methods xxx (2014) xxx–xxx
Fig. 2. Example low-pass (panels A–E) and high-pass (panels F–J) filter responses (Hamming windowed sinc FIR). The step responses best demonstrate the prototypical
signal distortions, smoothing for the low-pass filter (stronger for lower cutoff frequencies) and the apparent roughing for the high-pass filter (also stronger for lower
cutoff frequencies). Filters with longer impulse responses have a steeper roll-off (and a narrower transition band; 0.37 and 0.12 radians/sample for the order 18 and
order 54 filters, respectively), but smear filter distortions and ringing artifacts wider in the time domain. The filter length only has a minor influence on the amplitude of
filter ringing artifacts. The -phase jumps in the phase response of the zero-phase filter reflect stopband ripple (“negative amplitudes” or 180◦ phase changes) and only
occur in the stopband. The low-pass minimum-phase filter introduces a large delay despite “minimum-phase” property. Both minimum-phase filters considerably distort
the signal.
or cathode ray tube (CRT) noise and should be replaced by time and −6 dB (half amplitude) cutoff (common for FIR and two-pass
domain regression-based approaches (Mitra and Bokil, 2007) as, IIR filters). Therefore, cutoff frequencies should always be reported
e.g., implemented in the Cleanline EEGLAB plugin (Mullen, 2012). together with the definition used. Optimally, the cutoff frequency
These approaches are superior due to the very high phase stability should separate signal from noise components in the frequency
of line noise. domain. To avoid unwanted signal distortions, it is essential to
select the cutoff frequency so that no spectral component of the sig-
2.3. Cutoff frequency nal is attenuated but as much noise as possible is removed. This may
render the use of particular filters impossible for certain sections
The cutoff frequency separates passband and stopband of the of ERP/F research. Some authors argue against high-pass filtering
filter and always lies in the transition band (see Fig. 1C). This is (or restrict the applicable high-pass cutoff to frequencies as low as
the value that is most likely to be reported when a filter is applied <0.1 Hz; in particular if estimating window mean or peak ampli-
during the signal processing, but it is not sufficient to characterize tudes; Acunzo et al., 2012; Luck, 2005) or low-pass filtering (in
the filter. Different definitions of cutoff frequency are used: −3 dB particular if estimating onset latencies; VanRullen, 2011). We cer-
(half-energy) cutoff (common for IIR filters; see Section 2.7 below) tainly want to stress their point – care is needed – but, on the other
Please cite this article in press as: Widmann A, et al. Digital filter design for electrophysiological data – a practical approach. J Neurosci
Methods (2014), http://dx.doi.org/10.1016/j.jneumeth.2014.08.002
G Model
NSM-6995; No. of Pages 13 ARTICLE IN PRESS
A. Widmann et al. / Journal of Neuroscience Methods xxx (2014) xxx–xxx 5
hand, if the filter applied really increases the signal-to-noise ratio deviation of, for example, 0.01, the filter output does not amplify
(as it should to motivate its usage) and does not systematically bias or attenuate the signal by more than 1% in the passband
the to-be-estimated parameter, these values can be determined (0.086 dB; in MATLAB passband ripple is defined as peak-to-
with greater precision with than without filtering. peak ratio: rp = 20 log10 ((1 + 0.01)/(1 − 0.01)) = 0.174 dB). Stopband
attenuation is reported most commonly in logarithmic units. With
2.4. Roll-off, transition bandwidth, and filter order a stopband attenuation of −60 dB (or 0.001), the signal is attenuated
by a factor of 1000 in the stopband. Passband ripple and stopband
The transition region between passband and stopband enclos- attenuation can be well controlled in most filter implementations.
ing the cutoff frequency is defined as the transition band. For most However, less passband ripple and stronger stopband attenuation
FIR filters the −6 dB cutoff frequency is at the center of the transi- again require longer (effective) impulse responses, thus, values
tion band. The transition band edges are defined by the magnitude should not be chosen too small. For instance, passband ripple of
response exceeding the passband and stopband ripple, respectively 0.002–0.001 (0.2–0.1%) and −54 to −60 dB stopband attenuation
(see Section 2.5 below and Fig. 1C). The slope of the magnitude are reasonable values for many ERP/F applications. For high ampli-
response in the transition band is termed roll-off. Narrow tran- tude low-frequency noise (near DC), a stopband attenuation of
sition bands lead to a steep filter roll-off, wide transition bands −100 dB or stronger might be required. Due to the very small values,
allow a shallow roll-off. Filters with a steep roll-off can better sep- stopband ripple/attenuation is best evaluated in the logarithmically
arate signal and noise components in adjacent frequency bands scaled magnitude response (Fig. 1D) while passband ripple is better
than filters with a shallow roll-off. The filter roll-off is a function evaluated in the linearly scaled magnitude response (Fig. 1C).
of the filter order (number of filter coefficients/filter length minus
one), more specifically the (effective) impulse response duration. 2.6. Delay
“Sharp” filters with narrow transition bands or steep roll-off have
longer impulse responses than filters with wide transition bands Every (non-trivial) filter necessarily delays the filter output rel-
or shallow roll-off. Sharper and longer filters produce stronger sig- ative to the filter input (see Fig. 1A, B, and E). The most relevant
nal distortions and they also produce a wider temporal smearing parameter for electrophysiological applications is the group delay,
of distortions and ringing artifacts. Convolution implies that cur- defined as the delay of the envelope of the signal at a particular
rent filter output depends not only on current input but also on frequency (computed as the derivative of the phase with respect to
past input (causal filters; or past and future input for non-causal frequency). Two classes of filters have to be distinguished. So-called
filters; see Section 2.6 below) weighted by the impulse response linear-phase filters introduce an equal (group) delay at all frequency
function. That is, the longer the impulse response, the wider the bands – the slope of the phase response is constant within the pass-
range of input data from which current output is computed. This band. Consequently, a signal with all its spectral components in the
is commonly interpreted in the sense that precision (spread) in passband will not change its temporal shape. Linear-phase filters
the frequency domain (sharper filter) is inversely related to pre- have a perfectly symmetric impulse response (or antisymmetric
cision in the time domain (spread; longer impulse responses; Luck, only changing sign between left and right half). The group delay of
2005). The filtered signal shows stronger autocorrelation at higher linear-phase filters can be easily computed based on the length of
lags up to the length of the impulse response. Thus, shorter fil- the filter’s impulse response as (N-1)/2 (in samples). So-called non-
ters with wider transition bands are preferable where possible. This linear-phase filters with an asymmetric impulse response introduce
is an important argument against the use of band-stop filters and different delays in different frequency bands (see Fig. 2 for exam-
for the careful use of high-pass filters often requiring a very steep ples). Thus, non-linear-phase filters distort the temporal shape of
roll-off. On the other hand, as the low-frequency noise is typically spectrally complex or broadband signals (such as ERP components)
the strongest source of noise in electrophysiological data, apply- even if all spectral components are in the passband (and they dis-
ing high-pass filters very likely results in significant improvements turb cross-frequency phase relationships if analyzing phase-phase
in the signal-to-noise ratio. However, it also results in prominent or phase-amplitude coupling in time-frequency analysis).
signal distortions, which have to be accounted for during further The delay of linear-phase filters can be corrected by shifting the
analysis (see below). filter output back in time, resulting in a zero-phase filter having
Ringing filter artifacts, as shown in Fig. 1B (8), occur at sharp no delay (see Fig. 2). Due to the shift, each sample in the filtered
step-like signal transients. To avoid DC and ringing artifacts, one output signal is computed from preceding (past) and following
should never filter across signal discontinuities and DC offset cor- (future) samples of the unfiltered input signal; the filter is there-
rections. Furthermore, the signal must be properly padded at the fore classified as non-causal. In practice this means that the signal
signal edges for filtering, e.g., by a time and amplitude inverted mir- in the smoothed zero-phase filter output might already deviate
ror image (as in MATLAB filtfilt; Gustafsson, 1996) or a DC constant. from baseline before signal onset in the input, possibly system-
The required amount of data padding depends on the filter order, atically underestimating onset latencies after low-pass filtering
which implies that filtering should be preferably done on contin- (cf. the step responses in Fig. 2B; see Rousselet, 2012; VanRullen,
uous rather than epoched data, in particular for high filter orders 2011; Widmann and Schröger, 2012 for discussion), introducing
(relative to epoch length) as required for high-pass filters. If critical non-causally smeared artificial or artificially enhanced components
for a particular purpose, Gaussian or Bessel filters can be used to after high-pass filtering (Fig. 7D; see Acunzo et al., 2012 for discus-
avoid or reduce ringing artifacts (Luck, 2005; Smith, 1999). sion), or smearing post-stimulus oscillations into the pre-stimulus
interval leading to spurious interpretations of pre-stimulus phase
2.5. Passband ripple/stopband attenuation (Zoefel and Heil, 2013). A causal filter, in contrast, computes the
output only on the basis of preceding (past) input samples. The step
The practically achieved magnitude response usually devi- response of a causal filter does not exhibit signal changes due to the
ates from the requested magnitude response, which is one (no step (for example smoothing or ringing) before the onset of the step
attenuation or amplification) in the passband and zero (complete in the filter input (blue line in Fig. 2B and G). Importantly, zero-
attenuation) in the stopband. This deviation is commonly termed phase (non-causal) filters preserve peak latencies, while causal
passband ripple in the passband and stopband attenuation in the filters necessarily shift the signal in time. If a causal filter is needed,
stopband (see Fig. 1C and D). Passband ripple is reported as maximal a non-linear minimum-phase filter should be considered as it intro-
passband deviation in linear or logarithmic units. With a passband duces only the minimum possible delay at each frequency for a
Please cite this article in press as: Widmann A, et al. Digital filter design for electrophysiological data – a practical approach. J Neurosci
Methods (2014), http://dx.doi.org/10.1016/j.jneumeth.2014.08.002
G Model
NSM-6995; No. of Pages 13 ARTICLE IN PRESS
6 A. Widmann et al. / Journal of Neuroscience Methods xxx (2014) xxx–xxx
given magnitude response but distorting broadband or complex length, symmetric (type I) FIR filters are applied (only odd-length
signals due to non-linearity (see Fig. 2). Causal high-pass minimum- FIR filters can be corrected to zero-phase delay by left-shifting as
phase (and other non-linear) filters introduce rather small delays the group delay is an integer number of samples). Windowed sinc
(Fig. 2F and G) while causal low-pass (and band-pass and band- FIR filters are based on the sinc-function approximating a rectan-
stop) filters introduce larger delays even with minimum-phase gular magnitude response, thus, sometimes termed “ideal” filters.
property (Fig. 2A and B), which is why they are not recommended For finite filter orders, the impulse response has to be windowed
in electrophysiology (Rousselet, 2012). by a window function to reduce passband and stopband ripple
Zero-phase delay can also be achieved with non-linear filters (equal for windowed sinc filters). The transition bandwidth is a
by filtering the filter output a second time in the reverse direc- function of filter order (filter length minus one) and window type.
tion (“two-pass filtering”) to compensate for the filter delay (Smith, The necessary filter order can be estimated based on the normalized
1999, p. 331; filtfilt function in MATLAB/Octave). Two-pass forward transition width per window type (see Table 1). Equiripple FIR filters
and reverse filtering results in a non-causal filter with a symmetric derived from the Parks-McClellan (or McClellan-Parks; McClellan
impulse response. Two-pass filtering (equivalent to concatenating et al., 1973) algorithm have equal ripples within the respective
the same filter twice in the two-port model) doubles the filter order bands. However, passband and stopband ripples can be adjusted
and doubles the length of the (effective) impulse response. Thus, separately. The requested transition bandwidth as well as passband
the two-pass filter smears the output wider in the time domain. and stopband ripple determine the filter order. Equiripple filters
Two-pass filtering squares the magnitude response, which shifts are also termed “optimal” filters as they have the smallest order for
the −3 dB half-energy and the −6 dB half-amplitude cutoff frequen- given parameters.
cies, and needs to be reported properly (attenuation at the one-pass Filter orders of IIR and FIR filters cannot be compared due to
−3 dB cutoff is enhanced to −6 dB for IIR and at the one-pass −6 dB the recursive implementation of IIR filters. Instead, the resulting
cutoff to −12 dB for FIR filters; see Section 2.7 below; Edgar et al., impulse response lengths have to be compared. Despite IIR filters
2005). Two-pass filtering enhances (squares) passband ripple and often being considered as computationally more efficient, they are
stopband attenuation. Different software implementations use dif- recommended only when high throughput and sharp cutoffs are
ferent strategies to compensate for the doubled filter order and required (Ifeachor and Jervis, 2002, p. 321). In electrophysiology,
shifted cutoff frequencies. For replicability it is thus important to throughput is only relevant during recording. For offline data anal-
report cutoff frequencies together with not only their definition but ysis, however, throughput and computational time do not matter
also whether they apply to one-pass or two-pass filtering including on modern computer hardware. So, crucially, for sharp cutoffs and
possible adjustments of order and cutoff frequency. Importantly, when a causal filter is needed an IIR filter should be considered. A
the shapes of the (squared) magnitude response of a two-pass filter causal filter can be preferable in some specific cases. A causal fil-
and the equivalent one-pass filter of double the filter order (hav- ter only smears effects from earlier toward later latencies. On the
ing the same effective impulse response length) can be significantly other hand, the effective impulse response is also finite for IIR filters
different in particular in frequency bands near the cutoff frequency. due to numerical precision, thus, all relevant properties can also be
One-pass linear-phase filters (corrected by shifting) can achieve a implemented with FIR filters. Taken together, FIR filters are eas-
similar magnitude response shape (in particular steepness at the ier to control, are always stable, have a well-defined passband, can
cutoff frequency but not stopband attenuation) at lower orders than be corrected to zero-phase without additional computations, and
a corresponding two-pass filter. This makes linear-phase one-pass can be converted to minimum-phase. We therefore recommend FIR
filtering preferable in many applications (see Fig. 4B). filters for most purposes in electrophysiological data analysis.
Please cite this article in press as: Widmann A, et al. Digital filter design for electrophysiological data – a practical approach. J Neurosci
Methods (2014), http://dx.doi.org/10.1016/j.jneumeth.2014.08.002
G Model
NSM-6995; No. of Pages 13 ARTICLE IN PRESS
A. Widmann et al. / Journal of Neuroscience Methods xxx (2014) xxx–xxx 7
Table 1
Properties of selected window types for windowed sinc FIR filters (adapted from Ifeachor and Jervis, 2002, p. 357). Required filter order m for requested transition bandwidth
f can be computed as m = F/(f/fs ). Transition bandwidth f provided by a filter order m is computed as f = (F/m) fs (Smith, 1999).
Window type Beta Stopband attenuation (dB) Max. passband deviation Normalized transition width F
firfilt-plugin distributed with EEGLAB. For this filter, −6 dB cutoff The default filter is a Butterworth filter of 6th order (high-pass,
frequencies and transition bandwidth have to be specified. Fre- low-pass), or 4th order (band-pass, band-stop). The FIR filter’s
quency band weights and filter order can be specified or estimated default filter order is computed as 3 × fix (fs /fc ) with fc being the
from the transition bandwidth and passband and stopband ripple lower cutoff frequency. All filters default to non-causal zero-phase
(MATLAB Signal Processing Toolbox required). Windowed sinc and forward and reverse filtering doubling the filter order, squaring
Parks-McClellan equiripple filters include a tool to visualize the fil- the magnitude response, and shifting the cutoff frequencies (see
ter responses. The “Basic FIR filter (legacy)” included in EEGLAB for Fig. 3B and D, and 4A). One-pass forward or one-pass reverse fil-
backward compatibility is deprecated and should no longer be used ters are available but not corrected for the filter delay. The firls
(cf., Widmann and Schröger, 2012). filter is fitted to a rectangular frequency domain function. As the
An iirfilt plugin implementing an elliptic IIR filter is available for default filter order is too low to approximate a rectangular fre-
download (version 1.0.1; Pozdin et al., 2004). Zero-phase (forward quency response, fitting may result in various adverse effects like
and reverse filtered) and causal non-linear-phase (forward filtered) excessive filter ringing, excessive passband ripple, non-unity DC
filters can be applied. As in the default Basic FIR filter, passband gain, and others, as demonstrated in the example in Fig. 4A (see also
edges instead of cutoff frequencies have to be specified. The default Widmann and Schröger, 2012). We strongly recommend not using
transition bandwidth is 1 Hz. User defined values for the transition the firls option. Filter order and −3 dB (IIR) or −6 dB (FIR) cutoff fre-
bandwidth can be specified in the user interface. Passband ripple quencies after two-pass filtering are not reported; filter responses
defaults to 0.0025 dB and stopband attenuation to −40 dB (effec- are not visualized. Transition bandwidth cannot be specified and
tively 0.005 dB and −80 dB after two-pass filtering, respectively). is not reported for the FIR filters, that is, filter order must be esti-
Ripple can only be adjusted to user defined values on the com- mated manually (see Table 1). At the time of submission of a revised
mand line. Band-pass (and band-stop) filters are implemented as version of this manuscript, the first author ported and integrated
separate high-pass and low-pass filters. the EEGLAB firfilt plugin windowed sinc FIR filters to Fieldtrip. An
upcoming version of Fieldtrip will allow control of passband ripple
3.2. ERPLAB (EEGLAB plugin) and stopband attenuation, estimation of filter order by transition
bandwidth, one-pass zero-phase filtering, and the plotting of the
ERPLAB is an EEGLAB plugin providing its own filter routines filter responses with the “firws” option.
(version 4.0.2.3; Lopez-Calderon and Luck, 2014). IIR Butterworth,
Hamming-windowed sinc FIR, and Parks-McClellan FIR (notch 3.4. BrainVision Analyzer
only) filters are all implemented as two-pass forward and reverse
filtered non-causal zero-phase filters. The −6 dB cutoff frequency The BrainVision Analyzer (version 2.0.4.368; filter component
and the filter order have to be specified for IIR and FIR filters. The version 2.0.4.1057; Brain Products GmbH, Gilching, Germany) pro-
minimum required filter order can be estimated. The graphical user vides zero-phase IIR Butterworth filters of order 2, 4, or 8 (−12,
interface visualizes magnitude and impulse responses and reports −24, or −48 dB/oct roll-off). The −3 dB cutoff frequencies have to
the −3 dB and −6 dB cutoff frequencies resulting after two-pass be specified. The magnitude response is visualized. Zero-phase is
filtering. To compensate for two-pass filtering, the filter order of presumably (judging from the filter output) achieved by applying
the applied filter is adjusted to half the reported order for IIR and a filter with half the filter order twice, i.e., in forward and reverse
FIR filters internally (see Fig. 3A and D). For FIR filters, addition- direction. The applied cutoff frequency is presumably adjusted to
ally the cutoff frequency is implicitly adjusted to achieve −6 dB compensate for two-pass filtering and to maintain −3 dB attenua-
attenuation at the specified cutoff frequency after two-pass filter- tion at the specified cutoff frequency (see Fig. 3C and D). The use of
ing (see Fig. 4A). The filter order of the FIR filters is limited to a two-pass filtering and the implicit adjustment of cutoff frequency
maximum of 4096 samples (independent of sampling rate) making and filter order are undocumented, making it difficult to replicate
it impossible to design high-pass (and band-pass) filters with very the filter with other software.
low cutoff frequencies as often recommended for ERP/F analysis
(note that for the corresponding IIR filters, longer effective impulse 3.5. EEProbe
responses are applied; e.g., 7880 points for a 0.1 Hz high-pass 1st
order Butterworth filter at sampling frequency fs = 500 Hz as esti- EEProbe (version 3.3.148; ANT Neuro, Enschede, Netherlands)
mated by MATLAB impz function, which is doubled in the case of provides non-causal zero-phase windowed sinc (Hamming, Hann,
two-pass filtering). Transition bandwidth cannot be specified and Blackman, Bartlett, Tukey, and Rectangular windows) and Parks-
is not reported for the FIR filters. McClellan (“Remez-Exchange”) FIR filters. Both are designed with
the xfir-software. Zero-phase is achieved by correcting the delay
3.3. Fieldtrip (MATLAB toolbox) of the filter output. The −6 dB cutoff frequencies have to be spec-
ified. The −3 dB cutoff frequencies are additionally reported. The
The Fieldtrip MATLAB toolbox (SVN rev. 9473; Oostenveld et al., linearly and the logarithmically scaled magnitude responses and
2011) provides IIR Butterworth, Hamming-windowed sinc FIR the step response can be displayed. For the windowed sinc FIR
and “firls” (MATLAB firls function least-square fitted) FIR filters. filters, the transition bandwidth cannot be specified and is not
Please cite this article in press as: Widmann A, et al. Digital filter design for electrophysiological data – a practical approach. J Neurosci
Methods (2014), http://dx.doi.org/10.1016/j.jneumeth.2014.08.002
G Model
NSM-6995; No. of Pages 13 ARTICLE IN PRESS
8 A. Widmann et al. / Journal of Neuroscience Methods xxx (2014) xxx–xxx
Fig. 3. Magnitude responses of a 30 Hz (sampling frequency fs = 500 Hz) low-pass 2nd order IIR Butterworth filter as implemented by ERPLAB, Fieldtrip, and BrainVision
Analyzer. ERPLAB compensates for two-pass forward and reverse filtering by adjusting filter order, BrainVision Analyzer compensates by adjusting filter order and cutoff
frequency of the applied filter, Fieldtrip does not compensate for two-pass filtering (which means cutoff frequencies and order refer to the one-pass filter although typically
a two-pass filter is applied instead). For comparison, the magnitude response of a 2nd order IIR Butterworth filter is shown as it would be found in text books (gray dashed
lines). Note that the 0–30 Hz frequency band would be considered as passband for a Butterworth filter (Ifeachor and Jervis, 2002, p. 482). The three different implementations
result in significantly different magnitude responses (and filter output) despite identical filter parameters (see panel D for direct comparison).
reported, that is, the required filter order must be estimated man- 3.6. Interim conclusion
ually (see Table 1; note that the EEGLAB firfilt plugin can export
EEProbe-compatible FIR filter settings). For the Parks-McClellan The various filter implementations result in considerably differ-
filters, transition bandwidth, passband ripple, and stopband atten- ent frequency characteristics of the applied filters despite identical
uation can be specified and the necessary filter order can be or similar filter parameters, i.e., cutoff and order. In particular, two-
automatically computed. pass filtering appears to introduce more problems than it solves.
Fig. 4. Magnitude responses of a 30 Hz (fs = 500 Hz) low-pass FIR filter with filter order 52 as implemented by the EEGLAB “Basic FIR filter (new)”, the Fieldtrip “fir” filter, the
Fieldtrip “firls” filter, and the ERPLAB FIR filter (panel A). Fieldtrip performs two-pass filtering resulting in shifted cutoff frequencies. The “firls” filter shows excessive passband
ripple (23%), and non-unity gain at DC. The ERPLAB filter adjusts filter order and cutoff frequency to compensate for two-pass filtering. The resulting −6 dB cutoff frequency
of the ERPLAB filter is 29.25 Hz. The three different implementations result in significantly different magnitude responses (and filter output) mainly due to adjustments (not)
to compensate for two-pass filtering. Effects of two-pass filtering are shown in panel B. The same roll-off slope (but not the same stopband attenuation) as achieved by the
order 52 two-pass FIR filter (an order 26 filter applied forward and reverse as the ERPLAB filter in panel A) can be achieved already by the order 32 one-pass FIR filter (30 Hz
Hamming-windowed sinc FIR, fs = 500 Hz). A one-pass filter of equal order (here 52) can achieve a significantly steeper roll-off.
Please cite this article in press as: Widmann A, et al. Digital filter design for electrophysiological data – a practical approach. J Neurosci
Methods (2014), http://dx.doi.org/10.1016/j.jneumeth.2014.08.002
G Model
NSM-6995; No. of Pages 13 ARTICLE IN PRESS
A. Widmann et al. / Journal of Neuroscience Methods xxx (2014) xxx–xxx 9
Fig. 5. Typical filter distortions resulting from low-pass (panels A–C; 20 Hz order 166 Hamming windowed sinc FIR) or high-pass filtering (panels D–F; 5 Hz order 166
Hamming windowed sinc FIR) of a Gaussian-shaped test signal ( = 10 ms; zero mean). The differences between raw and filtered signal (panels B and E) display the signal
components attenuated by filtering; they indicate and characterize the typical low-pass and high-pass filter distortions. The spectrum (panels C and F) of the test signal
(scaled to arbitrary units) compared to the filters’ magnitude responses indicate that the signal is band-limited by filtering.
For instance, a 30 Hz low-pass realized as 2nd order IIR Butter- are missing. Gaussian FIR filters as recommended by Luck (2005)
worth filter will have considerably different magnitude responses to avoid filter-ringing artifacts are not implemented in any of the
if designed and applied by either ERPLAB, Fieldtrip, or BrainVision tested software packages.
Analyzer (see Fig. 3A–D; −3 dB cutoff at 19, 23, and 30 Hz; −6 dB
cutoff at 30, 30, and 46 Hz, respectively; note that the −3 dB cutoff 4. Part 3: Recognizing and avoiding filter distortions
frequency is frequently defined as passband edge for Butterworth
filters if passband deviation is not explicitly defined; this is the The most common signals in electrophysiology are spectrally
case in all implementations tested here; Ifeachor and Jervis, 2002). complex or broadband signals. Band-limiting these signals or atten-
These different magnitude responses are due to the necessary uating or delaying signal components necessarily results in signal
adjustments in cutoff frequency and filter order to compensate for distortions and possibly biased results. As a clarification, filtering
two-pass filtering, which differ between the different implemen- always changes the signal – otherwise, what would be the pur-
tations. Two-pass filtering is not necessary and even detrimental pose of the filter? Yet often these desired changes in the signal
to linear-phase FIR filters in many use cases (see Fig. 4A and B). are accompanied by undesired distortions of the signal or filter
The use of two-pass filtering, the applied adjustments in cutoff artifacts. Both types of change in the signal may bias results depend-
frequency, and the resulting filter parameters (−3 dB or −6 dB cut- ing on estimates taken from the filtered signal. The signal-to-noise
off, order) after two-pass filtering are not consistently documented ratio in unfiltered electrophysiological recordings might, however,
and reported. This makes correct reporting of filter parameters and be too low for a specific data analysis. Filtering can be a recom-
frequency characteristics difficult and seriously undermines the mendable option in this case – however, the authors should verify
replicability of electrophysiological data analysis. Significantly dif- that filtering actually improved the signal-to-noise ratio in the
ferent results will be obtained by different software packages. We data analysis. Furthermore, the variety of signals and applications
strongly encourage users to examine the effective filter responses in electrophysiology is very diverse, hence giving strict and gen-
and parameters themselves by filtering impulses with their soft- eral recommendations for filtering is close to impossible. It is thus
ware package and analyzing the filter output. Note that we used this important to understand the underlying signal and the effects of
approach to generate Figs. 3 and 4; the MATLAB code is provided in filtering to recognize and avoid filter distortions.
the supplementary materials. Most FIR filter implementations lack We recommend three main measures to recognize and avoid
support for users to adjust the filter order to reasonable values as filter distortions: (1) considering the frequency domain structure
tools to report and/or estimate the resulting transition bandwidth of signal (and noise) components; (2) using test signals to analyze
Please cite this article in press as: Widmann A, et al. Digital filter design for electrophysiological data – a practical approach. J Neurosci
Methods (2014), http://dx.doi.org/10.1016/j.jneumeth.2014.08.002
G Model
NSM-6995; No. of Pages 13 ARTICLE IN PRESS
10 A. Widmann et al. / Journal of Neuroscience Methods xxx (2014) xxx–xxx
Fig. 6. Low-pass filter distortions in ERP data. Panels A and D: ERPs elicited by standard (panel A) and deviant (panel D) tones with different low-pass filter settings (see
text for details; noise in the raw data is attenuated by averaging across trials and participants). Panels B and E: difference between raw and filtered ERPs. Panels C and F:
spectrum of the raw ERP (scaled to arbitrary units) compared to the filters’ magnitude responses. Note that the 15 Hz low-pass filter (−6 dB cutoff, zero-phase order 330
Hamming-windowed sinc FIR) attenuates the standard’s P1 component. The 7.5 Hz low-pass filter (same parameters) smoothens the deviant’s N1/MMN and N2 components,
resulting in reduced peak amplitudes and earlier component onsets.
the effects of different filters and filter parameters; and (3), most and how they are estimated. Both low-pass and high-pass filtered
importantly, systematically inspecting the difference between fil- data show that estimation of peak latencies should not be biased
tered and unfiltered signals, that is, the signal components removed using these filters. Peak amplitudes are biased, if estimated rela-
by filtering, for obvious features. tive to a baseline, but likely unbiased (always check), if estimated
Gaussian waveforms could be used as simplified test signals for as the difference between adjacent neighboring peaks and troughs,
filtering in ERP/F analysis suitable due to their broadband spectrum thereby accounting for the observable distortion. Onset latencies
resembling many ERP/F components in the time and frequency of low-pass filtered signals are systematically biased toward ear-
domain. In Fig. 5, a Gaussian test signal is displayed in the time and lier onsets. Proper account for the onset latency bias is difficult as
frequency domain unfiltered as well as filtered by a 20 Hz low-pass it is a matter of definition when a component starts to significantly
(Fig. 5A–C) and a 5 Hz high-pass filter (Fig. 5D–E). The low-pass and differ from baseline. One may consider fitting ERP model signals to
high-pass filter will selectively attenuate frequency components the real data and estimating the parameters from the model instead
of the broadband signal. Attenuating the high-frequency compo- of from the real data.
nents with the low-pass filter results in earlier signal onset and The characteristic low-pass and high-pass filter distortions
later offset, reduced peak amplitude, and artificial oscillations with derived from the analysis of the test signal aids the recognition
a frequency near the cutoff frequency (see e.g., Luck, 2005 for a of these distortions in real data. In Figs. 6 and 7, we demonstrate
more detailed discussion of these oscillations). Similarly, attenuat- this by the example of auditory ERPs with different low-pass and
ing the low-frequency components with the high-pass filter results high-pass filters (note that the filter parameters were optimized
in reduced peak amplitude and a low-frequency artificial oscilla- to demonstrate typical distortions and we would not use or rec-
tion forcing the signal to zero amplitude. The differences between ommend these filters for real-world data analysis). The example
unfiltered and filtered data display the signal components that were data originate from an unpublished dataset of an auditory oddball
attenuated by filtering (Fig. 5B and E). The characteristic shape of paradigm including frequent standard (352 Hz, 1440 trials) and rare
the differences can be used to recognize signal distortions in more deviant sounds (422 Hz, 180 trials, 300 ms duration, 5 ms rise-and-
complex signals (see Figs. 6 and 7). Whether or not these distort- fall times, 300 ms inter-stimulus interval, 65 dB SPL intensity, task:
ions are considered relevant depends on the estimated parameters count deviants; 6 subjects, 500 Hz sampling rate, vertex electrode,
Please cite this article in press as: Widmann A, et al. Digital filter design for electrophysiological data – a practical approach. J Neurosci
Methods (2014), http://dx.doi.org/10.1016/j.jneumeth.2014.08.002
G Model
NSM-6995; No. of Pages 13 ARTICLE IN PRESS
A. Widmann et al. / Journal of Neuroscience Methods xxx (2014) xxx–xxx 11
Fig. 7. High-pass filter distortions in ERP data. Panels as in Fig. 6. Note that the 0.75 Hz high-pass filter (−6 dB cutoff, zero-phase order 1100 Hamming-windowed sinc
FIR) has only minor effects on the standard ERPs. In the deviant ERPs, it reduces P3 response amplitude and artificially enhances preceding N1/MMN and N2 response
amplitude measured relative to the pre-stimulus baseline (but only marginally measured relative to the neighboring peaks and troughs). The 1.5 Hz high-pass filter (same
parameters) drastically enhances the distortions. Panel G displays N2 (190–210 ms) scalp potentials, the raw minus filtered scalp potential difference and current density
topographies. Note that the high-pass filters may distort not only the temporal dynamics but also component topographies (relative to the pre-stimulus baseline). The causal
minimum-phase filter preserves the topography and temporal dynamics of N1/MMN and N2 components but distorts P3 component morphology due to non-linear effects.
nose reference). The unfiltered data show regular P1 and N1 vertex enhances the distortions. Note that not only peak amplitudes are
potentials for standards and deviants, and additionally mismatch artificially enhanced but also the topography of the components is
negativity (MMN; including an enhanced N1 response), N2 and P3 distorted, as exemplarily demonstrated on the scalp potential and
potentials in response to deviants. Filtering the standards with a current density topographies of the N2 component (Fig. 7G). The
15 Hz low-pass filter appears to remove only noise from the data amplitude of the fronto-central current sink-source configuration
at a first glance. Roughly, it seems as if the filtered signal preserves is attenuated by factor two. The raw minus filtered difference in the
almost all temporal parameters including onset and peak latencies N2 time window (Fig. 7E and G, middle column) shows that the N2
as well as peak amplitudes. Exploring the difference between raw component is superimposed by a distinct parietal P3-like topogra-
and filtered data, however, reveals that filtering significantly atten- phy due to the non-causal filter. Rousselet (2012) suggested causal
uated the high-frequency P1 peak (see Fig. 6B). Excessive filtering filtering to avoid the non-causal effects (the non-causal artificial
of the data with a 7.5 Hz low-pass filter clearly shows the charac- enhancement of the N1 and N2 components is due to attenuating
teristic distortions demonstrated with the test signal (cf. Fig. 5A), a the low-frequency components of the succeeding P3 component) of
smoothed signal with earlier signal onsets (cf., VanRullen, 2011), filtering. Rousselet demonstrated that causal filtering is not feasible
and reduced peak amplitudes. The oscillations in the difference for low-pass filters due to the introduced (non-linear phase) delay,
between raw and filtered waveforms, in particular for the deviants, but might be an option for high-pass filtering. Indeed, causally fil-
reveal that relevant signal components were attenuated and filter- tering the example data with a 0.75 Hz minimum-phase converted
ing resulted in significant distortions. filter reveals no indication of artificially enhanced N1/MMN and
Filtering the data with a 0.75 Hz high-pass filter (Fig. 7) has only N2 components (rather, peak amplitudes are slightly reduced due
minor effects on the standard waveform because this carries only to the attenuation of low-frequency components). The raw minus
moderate energy at low frequencies. The deviant waveforms, how- filtered difference shows no P3-like (but rather a P2-like) topog-
ever, show significant distortion with a reduced P3 peak amplitude raphy demonstrating that the effects of filtering on the N2 are
non-causally carrying over the distortion into preceding compo- indeed introduced non-causally and are not due to possibly over-
nents, resulting in artificially enhanced N1/MMN and N2 peak lapping P3 activity. Due to the non-linear phase characteristic, the
amplitudes (relative to pre-stimulus baseline but not relative to minimum phase filter, however, dramatically distorts the tempo-
neighboring peaks and troughs; see, Acunzo et al., 2012 for detailed ral dynamics of the P3 component. Thus, a causal non-linear filter
discussion). The difference between raw and filtered waveforms can be employed to separate long- and short-latency components,
intuitively demonstrates this non-causal effect (Fig. 7E). Exces- avoiding non-causal effects, but should be used carefully because
sive filtering of the data with a 1.5 Hz high-pass filter drastically it introduces a delay and signal shape distortions.
Please cite this article in press as: Widmann A, et al. Digital filter design for electrophysiological data – a practical approach. J Neurosci
Methods (2014), http://dx.doi.org/10.1016/j.jneumeth.2014.08.002
G Model
NSM-6995; No. of Pages 13 ARTICLE IN PRESS
12 A. Widmann et al. / Journal of Neuroscience Methods xxx (2014) xxx–xxx
5. Recommendations and best practices These filters always delay the signal; therefore, all latencies are
systematically delayed in time. Usually, zero-phase (non-causal)
The low signal-to-noise ratio of EEG and MEG recordings makes filters are preferable for many applications in electrophysiology.
filtering an indispensable tool for the analysis of electrophysiolog- The side effects of two-pass forward and reverse filtering must
ical data. However, filtering is also prone to introducing severe be considered. Filters should be applied to the continuous (rather
distortions into the data, biasing or even invalidating the results than segmented) data. Filters must not be applied across signal
(see, e.g., VanRullen, 2011; Acunzo et al., 2012; Zoefel and Heil, 2013 discontinuities. The persistence of signal discontinuity informa-
for prominent examples and Luck, 2005 for discussion). Thus, filter- tion must be provided throughout preprocessing. Segments have
ing should not be regarded as a default step in data preprocessing to be processed separately if this information is not provided (as,
automatically and necessarily improving signal quality. Instead we e.g., with the EEGLAB bdfimport plugin). All parameters set to
recommend putting significant effort into carefully and appropri- default values should be checked. Manual setting of all relevant
ately designing digital filters that really improve the signal quality filter parameters is preferred. All filter parameters, including filter
for the specific purpose, and verifying whether this goal has been type (high-pass, low-pass, band-pass, band-stop, FIR, IIR), cutoff
achieved. Filtering representative test signals and the exploration frequency (including definition), filter order (or length), roll-off
of the difference between raw and filtered signals are valuable or transition bandwidth, passband ripple and stopband attenua-
tools to recognize and control the impact of filter distortions on the tion, filter delay (zero-phase, linear-phase, non-linear phase) and
observed results. Furthermore, complete reporting of the applied causality, and direction of computation (one-pass forward/reverse,
filters and their parameters is mandatory to allow for the replica- or two-pass forward and reverse) must be reported. In the case of
tion of data analysis. two-pass filtering it must be specified whether reported cutoff fre-
Selectively attenuating spectral components of complex or quencies and filter order apply to the one-pass or the final two-pass
broadband signals necessarily results in distortions of the tem- filter. Finally, filtering should not replace measures to improve the
poral dynamics of the signal, systematically biasing signal (onset) signal-to-noise ratio during the recording and analysis of electro-
latencies and signal (peak) amplitudes. Crucially, there exists no physiological data such as proper electrode preparation (e.g., lower
generally valid definition as to which spectral components of the impedances; Kappenman and Luck, 2010), care for participants’
unfiltered data constitute wanted signal and which ones constitute comfort and compliance (avoid muscle artifact, sweating, etc.), pre-
unwanted noise. Rather, the definition of signal and noise depends vention of electromagnetic interference (shielding; remove fans,
on the estimated parameters and the analysis strategy. It may well transformators, cable coils, etc.), a sufficient number of recorded tri-
be appropriate to use different filters for different parameter esti- als for average-based applications; time domain based approaches
mates or analyses of the same dataset. For many ERP/F applications, (mean subtraction, removal of line noise). Unfiltered and filtered
in particular unguided, exploratory ERP/F analysis, it is recom- data should always be compared and evaluated for the improve-
mended to refrain from high-pass filtering or to apply very low ment in signal-to-noise ratio as well as distortions biasing the
(≤0.1 Hz) cutoff high-pass filters (Acunzo et al., 2012; Luck, 2005). estimated parameters. With these recommendations in mind, we
However, high-pass filtering replacing baseline and drift correc- hope the reader is well prepared for filtering electrophysiological
tion can be a valid means to remove strong low-frequency (near data without the pitfalls or myths commonly associated with this
DC) interferences, e.g., in ERP/F analysis of ongoing speech. Even analysis step.
higher high-pass cutoff frequencies accepting a minor attenuation
of evoked components such as the N400 can be reasonable (see e.g.,
Acknowledgements
Maess et al., 2006). In that study, the preprocessing including high-
pass filtering made localization of the N400 response possible in the
We are grateful to Alexandra Bendixen and Nicole Wetzel for
first place. Importantly, peak amplitudes and onset latencies were
their helpful comments on the manuscript. The research was sup-
not reported, because these parameters would have been biased by
ported by a grant from Deutsche Forschungsgemeinschaft (DFG)
the filter.
Reinhart-Koselleck awarded to ES (SCHR 375/20-1).
Various practices and recommendations exist for low-pass cut-
off frequencies in ERP/F analysis including the suggestion not to
apply low-pass filters at all (VanRullen, 2011). Indeed, low-pass Appendix A. Supplementary data
filters frequently serve primarily cosmetic purposes as high-
frequency noise (except line noise) usually has low energy in Supplementary data associated with this article can be found,
electrophysiology recordings (cf. e.g., Widmann et al., 2012, who in the online version, at http://dx.doi.org/10.1016/j.jneumeth.
recorded children’s EEG in electrically unshielded rooms at pri- 2014.08.002.
mary schools; 100 Hz low-pass cutoff filtered ERPs only show very
moderate noise levels). Furthermore, later steps in data analysis, References
such as computing mean amplitudes in given time windows, are
low-pass filter equivalents. As a rather unspecific recommenda- Acunzo DJ, Mackenzie G, van Rossum MC. Systematic biases in early ERP
tion, we suggest applying low-pass filters with cutoff frequencies and ERF components as a result of high-pass filtering. J Neurosci Methods
2012;209:212–8.
higher than 40 Hz during ERP analysis, thereby preserving the visi- Delorme A, Makeig S. EEGLAB: an open source toolbox for analysis of single-trial
ble high-frequency components in the ERPs such as the sharp peak EEG dynamics including independent component analysis. J Neurosci Methods
of the low latency (P1) component. 2004;134:9–21.
Delorme A, Mullen T, Kothe C, Akalin Acar Z, Bigdely-Shamlo N, Vankov A, et al.
In summary, we encourage the careful design of appropriate fil-
EEGLAB, SIFT, NFT, BCILAB, and ERICA: new tools for advanced EEG processing.
ters rather than avoiding filtering completely. Short filters with soft Comput Intell Neurosci 2011;2011:130714.
roll-off should be preferred. Attenuation must not be stronger than Edgar JC, Stewart JL, Miller GA. Digital filters in ERP research. In: Handy TC, edi-
tor. Event-related potentials: a methods handbook. Cambridge, MA: MIT Press;
necessary. Separate high-pass and low-pass filters should replace
2005. p. 85–113.
band-pass filters if the roll-off cannot be adjusted separately. Band- Gustafsson F. Determining the initial states in forward-backward filtering. IEEE Trans
stop filters should be avoided where possible and replaced by Signal Process 1996;44:988–92.
time domain based measures in the case of line noise. Non-linear Ifeachor EC, Jervis BW. Digital signal processing: a practical approach. Edinburgh,
UK: Pearson; 2002.
(causal) filters should be used when a transfer of information back Kappenman ES, Luck SJ. The effects of electrode impedance on data quality and
in time, i.e., from later to earlier components, needs to be excluded. statistical significance in ERP recordings. Psychophysiology 2010;47:888–904.
Please cite this article in press as: Widmann A, et al. Digital filter design for electrophysiological data – a practical approach. J Neurosci
Methods (2014), http://dx.doi.org/10.1016/j.jneumeth.2014.08.002
G Model
NSM-6995; No. of Pages 13 ARTICLE IN PRESS
A. Widmann et al. / Journal of Neuroscience Methods xxx (2014) xxx–xxx 13
Lopez-Calderon J, Luck SJ. ERPLAB: an open-source toolbox for the analysis of event- Rousselet GA. Does filtering preclude us from studying ERP time-courses? Front
related potentials. Front Hum Neurosci 2014;8:213. Psychol 2012;3:131.
Luck SJ. An introduction to the event-related potential technique. Cambridge, MA: Smith SW. The scientist and engineer’s guide to digital signal processing. 2nd ed.
MIT Press; 2005. San Diego, CA: California Technical Publishing; 1999.
Maess B, Herrmann CS, Hahne A, Nakamura A, Friederici AD. Localizing the dis- Urbach TP, Kutas M. Interpreting event-related brain potential (ERP) distributions:
tributed language network responsible for the N400 measured by MEG during implications of baseline potentials and variability with application to amplitude
auditory sentence processing. Brain Res 2006;1096:163–72. normalization by vector scaling. Biol Psychol 2006;72:333–43.
McClellan JH, Parks TW, Rabiner LR. A computer program for designing optimum FIR VanRullen R. Four common conceptual fallacies in mapping the time course of recog-
linear phase digital filters. IEEE Trans Audio Electroacoust 1973;AU-21:509–26. nition. Front Psychol 2011;2:365.
Mitra PP, Bokil H. Observed brain dynamics. Oxford University Press: Oxford; 2007. Widmann A. Firfilt EEGLAB plugin. Leipzig, Germany: University of Leipzig; 2006.
Mullen T. CleanLine EEGLAB plugin. San Diego, CA: Neuroimaging Informatics Tools Widmann A, Schröger E. Filter effects and filter artifacts in the analysis of electro-
and Resources Clearinghouse (NITRC); 2012. physiological data. Front Psychol 2012;3:233.
Oostenveld R, Fries P, Maris E, Schoffelen JM. FieldTrip: open source software for Widmann A, Schröger E, Tervaniemi M, Pakarinen S, Kujala T. Mapping symbols
advanced analysis of MEG, EEG, and invasive electrophysiological data. Comput to sounds: electrophysiological correlates of the impaired reading process in
Intell Neurosci 2011;2011:156869. dyslexia. Front Psychol 2012;3:60.
Pozdin M, Delorme A, Makeig S. iirfilt EEGLAB plugin. San Diego, CA: Swartz Center Zoefel B, Heil P. Detection of near-threshold sounds is independent of EEG phase in
for Computational Neuroscience (SCCN); 2004. common frequency bands. Front Psychol 2013;4:262.
Please cite this article in press as: Widmann A, et al. Digital filter design for electrophysiological data – a practical approach. J Neurosci
Methods (2014), http://dx.doi.org/10.1016/j.jneumeth.2014.08.002