Edited by:
Reviewed by:
*Correspondence:
This article was submitted to the journal Frontiers in Human Neuroscience.
This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) or licensor are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.
ERPLAB toolbox is a freely available, open-source toolbox for processing and analyzing event-related potential (ERP) data in the MATLAB environment. ERPLAB is closely integrated with EEGLAB, a popular open-source toolbox that provides many EEG preprocessing steps and an excellent user interface design. ERPLAB adds to EEGLAB’s EEG processing functions, providing additional tools for filtering, artifact detection, re-referencing, and sorting of events, among others. ERPLAB also provides robust tools for averaging EEG segments together to create averaged ERPs, for creating difference waves and other recombinations of ERP waveforms through algebraic expressions, for filtering and re-referencing the averaged ERPs, for plotting ERP waveforms and scalp maps, and for quantifying several types of amplitudes and latencies. ERPLAB’s tools can be accessed either from an easy-to-learn graphical user interface or from MATLAB scripts, and a command history function makes it easy for users with no programming experience to write scripts. Consequently, ERPLAB provides both ease of use and virtually unlimited power and flexibility, making it appropriate for the analysis of both simple and complex ERP experiments. Several forms of documentation are available, including a detailed user’s guide, a step-by-step tutorial, a scripting guide, and a set of video-based demonstrations.
The event-related potential (ERP) technique is widely used in basic and translational research on sensory, cognitive, affective, and motor processes (
The last decade has seen an explosion in the development of commercial systems for recording the electroencephalogram (EEG), including inexpensive systems of good quality and more expensive systems with greatly improved features and performance (e.g., driven right leg circuits, 24- or 32-bit resolution, ultra-high input impedance). This has led to a dramatic increase in the number of installed EEG/ERP systems. However, a significant impediment to the optimal use of these systems has been the lack of high quality, full featured, and widely available ERP analysis tools. Several commercial packages are available, but they are very expensive, lacking in important features, difficult to customize, and inconvenient to use for state-of-the-art research. In addition, commercial analysis packages necessarily focus on methods that have been used in prior research and are widely known, whereas science requires the constant creation of new analysis methods. Researchers must therefore have access to software that easily allows the creation and dissemination of new analysis techniques.
We have therefore created an open-source ERP analysis package called ERPLAB toolbox that is designed to meet the needs of a wide variety of researchers. ERPLAB can be downloaded for free at
ERPLAB toolbox operates in the MATLAB programming environment. MATLAB (The Mathworks, Inc., Natick, MA, USA) is a full-featured programming language that is widely used in science and engineering. It has several features that make it easy for novices to write small programs (scripts) and for more sophisticated users to create new data processing functions. Thousands of science-oriented mathematical functions are available in add-on toolboxes. Many of these toolboxes are available for a modest fee from The Mathworks, and many others (such as ERPLAB) are provided at no cost by individual scientists and engineers. MATLAB runs on all major operating systems, so ERPLAB can be used in a variety of computing environments. MATLAB has become the most common programming environment for cognitive neuroscientists, in part because of the widespread use of the SPM package in neuroimaging (
The most significant disadvantages of MATLAB are that it is not free, that it is slow for some kinds of processing operations, and that it sometimes uses memory inefficiently. However, it is an order of magnitude less expensive than commercial EEG/ERP analysis systems, is extremely fast for matrix operations, and is now available in 64-bit versions that can address very large amounts of memory.
ERPLAB toolbox is tightly integrated with EEGLAB Toolbox (
ERPLAB relies heavily on EEGLAB’s functions for: (a) importing EEG data from all major EEG data collection systems; (b) plotting EEG waveforms and EEG/ERP scalp maps; and (c) performing independent component analysis (ICA;
EEGLAB has some built-in routines for calculating conventional averaged ERPs, but it does not emphasize ERP processing and therefore does not include many of the standard processing tools needed for ERP research. ERPLAB was created to provide these tools.
A convenient GUI is an important aspect of an ERP analysis package. It dramatically reduces the time required for both experienced and novice researchers to learn to use the package. It also makes the various options very salient, because a user can see what options are available without consulting the documentation. Consider, for example, the GUI for the ERPLAB filtering function (
Although GUIs are very useful, they can be cumbersome for processing large data sets. Imagine, for example, that a manuscript is submitted to a journal describing an experiment with 50 subjects, and a reviewer asks for a reanalysis of the data that requires changing one of the first steps in the data processing pipeline (e.g., the cutoff of a high-pass filter that was applied to the continuous EEG prior to any other processing steps). Reanalyzing the data by means of a GUI might require 2 h of pointing and clicking per subject, for a total of 100 h of effort. It is therefore very useful to be able to create automated scripts for data processing (but with the possibility of using different settings for different subjects, e.g., to deal with a broken electrode in one of the subjects). However, scripting languages are often difficult to learn, especially for researchers who do not have a computer programming background. Some commercial ERP analysis packages have automation/scripting abilities, but they are either difficult to learn or not sufficiently flexible.
One of the greatest strengths of EEGLAB is that it provides an easy-to-follow path from using the GUI to writing automated but flexible scripts. In EEGLAB, any operation that is performed in the GUI (e.g., loading a set of EEG data from the hard drive into memory) has an equivalent script command [e.g.,
ERPLAB uses this same approach, in which each operation that is performed in the GUI is saved in a history as an equivalent script command. We have extended this slightly, adding commands to the history whether they were called from a script or from the GUI. Because the history is stored in the same data structure as the EEG or ERP data, this provides a means of remembering the sequence of steps that was used to process a given file (e.g., when writing a manuscript two years after the data were processed). In addition, we have written an
In EEGLAB, a
ERPLAB inherits this scheme and adds to it by creating
In ERP experiments, a signal is sent from the stimulus presentation computer to the EEG acquisition computer whenever a stimulus or response occurs. In EEGLAB and ERPLAB, these signals are called
ERPLAB takes the event codes that are present in EEGLAB’s data and creates a special data structure called an
The EVENTLIST structure can be exported as a text file, allowing it to be easily viewed with the MATLAB text editor. It can also be edited and then imported back into the EEG data. This provides a very easy way for the user to add, delete, or modify information in the EVENTLIST. For example, if an eye tracker is used concurrently with the EEG recordings, information about saccade onsets in the eye tracker’s data file can be integrated into the EVENTLIST text file and then imported back into the EEG data. Similarly, if the stimulus presentation program’s data file contains events that were not sent as event codes during the experiment, these events can be integrated into the EVENTLIST text file and then imported back into the EEG data. These events could therefore be used as the time-locking events for averaged ERP waveforms. Note that an
ERPLAB also contains tools for inserting event codes when specific features are identified in the EEG data. For example, it would be possible to automatically insert an event code at the onset of an alpha burst, an eyeblink, or a burst of muscle activity. Again, these events could be used as the time-locking events for averaged ERP waveforms.
ERPLAB also contains a sophisticated tool for determining which event codes should be averaged together. In an oddball experiment, for example, it is necessary to separately average the standard and oddball stimuli. Separate averages are computed for each electrode site, but based on the same set of events. We refer to the averaged data from each electrode site for a given set of events as a
To address this fundamental need of ERP experiments; ERPLAB contains a
BINLISTER is both easy to use for simple experiments and capable of complex event sorting for more sophisticated experiments. If BINLISTER is insufficient for a given experiment, a sophisticated user can write a MATLAB script (or Excel macro) that sorts the events into bins, according to the special needs of that experiment. This information can then be imported back into the data using ERPLAB’s tools.
BINLISTER can also be used for analyses of behavioral data, which can then be linked with the ERP data. For example, the following bin descriptor will extract the reaction time for event code 101:
There are many different types of artifacts that may contaminate EEG data, adding noise or confounding comparisons between conditions (see
When an artifact has a stable scalp distribution, it is usually possible to use ICA to decompose the EEG data into a set of underlying components and then reconstruct the data without the component corresponding to the artifact. This effectively eliminates the artifact from the EEG. This method of
However, ICA-based artifact correction has some important limitations. First, ICA cannot work for artifacts that do not have a consistent scalp distribution for a given subject (e.g., skin potentials). Second, the number of time samples required for ICA to effectively isolate the components is a function of the square of the number of electrodes (
For these reasons, it is often necessary to perform artifact rejection rather than, or in addition to, performing artifact correction. Most commercial ERP analysis systems provide only primitive algorithms for identifying trials with artifacts (e.g., rejecting trials on which the overall voltage exceeds a given criterion). ERPLAB contains several different artifact detection algorithms that are tailored to the distinctive properties of the specific artifacts that commonly occur in ERP experiments (as illustrated in
As in many other ERP analysis packages, ERPLAB’s artifact detection algorithms are applied to segmented EEG data, not continuous EEG data. EEG segments containing artifacts are marked rather than being deleted from the data; marked segments can then be excluded during the process of computing averaged ERP waveforms.
EEGLAB contains its own artifact detection algorithms, including a method for visually inspecting the data and marking segments that contain artifacts (or unmarking segments that were marked by the automatic artifact detection algorithms). These methods can be used instead of, or in combination with, ERPLAB’s artifact detection algorithms.
ERPLAB also has a tool for automatically detecting and deleting segments of the continuous EEG that contain artifacts. The main purpose of this tool is to delete periods of data in which extremely large, idiosyncratic artifacts are present (e.g., when the subject stretches during a break). These artifacts are so large that they may cause ICA to work poorly for ordinary artifacts, and deleting segments of data with these enormous artifacts prior to ICA can improve ICA’s performance.
It is recommended that laboratories establish preset criteria for excluding subjects for whom a large proportion of trials were rejected because of artifacts (see Chap. 4 in
The EEG is typically recorded using differential amplifiers, which provide the difference in potential between two recording electrodes, subtracting out any noise in the ground circuit. Some systems instead record the single-ended voltage between the recording electrode and a ground electrode. In either case, both the recording and reference/ground electrodes contribute equally to the recorded signal.
It is frequently useful to change the reference (or add a reference) offline. For example, if the data are initially recorded using a reference electrode on the left or right mastoid, researchers typically re-reference the data to the average of the left and right mastoids to avoid biasing the data toward one hemisphere (
ERPLAB includes a
This creates and adds a channel 33 that is the difference between the existing channels 26 and 27, and gives it the label
To use the average of many electrodes as the reference (e.g., to re-reference to the average of all scalp sites), an
It would be laborious and error-prone for the user to enter individual equations for each of a large number of channels, and a
It is also simple to write an equation to replace a bad electrode with the average voltage from the surrounding electrodes (i.e., with interpolated values). This can be done by replacing the bad channel rather than by creating a new channel. For example, to replace channel 14 with the average of channels 10, 12, 16, and 18, the user could provide one of the following equations:
or, equivalently,
Operations such as re-referencing and interpolation are most often applied to the EEG, but they are sometimes applied to averaged ERPs. ERPLAB’s channel operations procedure can therefore operate on either EEG or ERP structures.
In the context of ERP research, filters are often poorly understood and applied inappropriately (see Chap. 5 in
In many commercial ERP analysis systems, filtering is a “black box” procedure in which the details of the filtering are not easily available to the user. For example, most commercial systems do not show the user the filter’s
ERPLAB uses non-causal finite impulse response (FIR) and infinite impulse response (IIR, Butterworth) filters, implemented by means of the Signal Processing Toolbox’s filtfilt() routine.
The user can apply a high-pass filter, a low-pass filter, or both (i.e., a bandpass filter). The user specifies the roll-off of the filter (the slope of the filter at its steepest point) and the half-amplitude cutoff of the filter (the frequency at which the amplitude is attenuated by 50%, which is equal to a 6 dB attenuation). When the user specifies the half-amplitude cutoff, the GUI indicates the corresponding half-power value (the frequency at which the power is attenuated by half, which is equal to a 3 dB attenuation). Many ERP researchers appear to be unaware that these values are different and that it is not sufficient to indicate that a filter had, for example, “a cutoff at 30 Hz” without specifying whether this is the half-amplitude or half-power cutoff. By providing both values in the GUI, ERPLAB makes it explicit that these are different values and allows the user to decide which value to report when writing a journal article. This is another example of how ERPLAB implicitly serves an educational purpose.
Filters may produce extremely large distortions at the beginning and end of the waveform being filtered (
A related problem arises when a data set includes several blocks of trials, each separated by a gap of a few minutes. The DC offset in the data may change during the gap, leading to a large and sudden shift in the waveform at the transition between trial blocks.
The averaging process is relatively simple. All EEG segments that have been assigned to a given bin within a dataset are simply averaged together. The resulting ERPset contains the averaged ERPs for each bin. In some commercial systems, the data from each bin is stored in a separate file, which can lead to a very large number of files in a complex experiment and which makes further processing very tedious. In ERPLAB, all bins are stored together in a single file, so the number of files per subject is small and the application of further processing steps is more efficient.
It is often convenient to store the EEG data from different trial blocks in different files. ERPLAB makes it possible to average across multiple EEG files in a single step.
During averaging, ERPLAB gives the user three options for dealing with EEG segments that have been marked for rejection during the artifact detection process. Specifically, the user may choose to (a) exclude segments marked for rejection, (b) ignore the marks and average all segments, or (c) include only the segments marked for rejection. The last of these options is useful for determining whether the artifacts are consistent and for seeing how they would impact the data if they escaped rejection.
ERPLAB also makes it possible to select random or non-random subsets of EEG epochs for averaging. For example, to compute the split-half reliability of an ERP component measurement, one could average the odd-numbered trials separately from the even-numbered trials and compute the correlation between the component measures from the resulting averaged ERPs. Similarly, it is sometimes useful to equate the number of trials contributing to the averaged waveforms in different conditions, and ERPLAB allows the user to select a random subset of the trials in a given condition for inclusion in the averaged ERP waveforms.
ERPLAB can export the averaged ERP waveforms into a text file using a common file format, allowing the data to be imported into other ERP analysis packages. ERPLAB can also import text files in this format, allowing the user to export data from another package and import it into ERPLAB.
ERPLAB toolbox provides simple tools for plotting ERP waveforms and scalp maps. For ERP waveforms, the user has full control of the bins that are overlaid, the channels that are plotted, the time and voltage axes, the font used for labels, etc. For scalp maps, the user can plot 2D or 3D images, can plot maps of individual time points or mean voltages over specified time windows, and can make movies showing changes in topography over time. However, ERPLAB is not designed to directly produce publication-quality figures. Instead, ERPLAB allows users to save the plots as files in several different formats (including portable document format, PDF), which can be imported into any general-purpose graphics program (e.g., Adobe Illustrator).
ERPLAB provides a
As with channel operations, an enormous number of possible equations can be specified by the user. For example, to compute a waveform that is equivalent to the absolute value of the sum of bins 1 to 4 at each time point, the user could specify the following equation:
In some experiments, it is desirable to combine bins in different ways for different electrode sites. For example, studies of the N2pc component (
In the earliest days of ERP research, before general-purpose computers were widely available, specialized hardware was used to record the data, and the output was a set of waveforms plotted on paper. The only easy way to summarize the data from a given subject was to use a ruler to measure the amplitudes and latencies of the peaks in the waveforms (
Quantification of amplitudes and latencies is achieved in ERPLAB with the
Given that single-subject ERP waveforms may differ widely across individuals, it is important to verify that the measurement is working in the desired manner for each subject. The measurement tool therefore includes a
Several measurement algorithms are available. Peak amplitude and peak latency can be measured, including a
Limiting the algorithm to just the negative region or just the positive region can allow the user to specify a relatively broad measurement window without having negative and positive effects cancel each other. Consider, for example, the oddball-minus-standard difference wave from a single subject that is shown in
ERPLAB also implements two approaches to latency measurement that have been demonstrated to be both highly accurate and highly reliable (as shown in rigorous simulation studies by
A second algorithm, called
These sophisticated methods for quantifying latencies can be limited by the sampling rate of the data. For example, there may not be a time point at which the voltage is exactly 50% of the peak. The measurement tool therefore allows the user to specify an interpolation factor, which is used to increase the precision of the latency measures by applying a spline interpolation to the waveform prior to measurement. This is particularly useful when the
ERPLAB toolbox does not directly include any statistical functions, but it contains several features designed to facilitate statistical analysis. First, as described in the previous section, the output of the measurement tool can be formatted for major statistical packages, such as SPSS. Second, permutation-based approaches are becoming very popular in ERP research (
Finally, ERPLAB makes it easy for users to use the jackknife approach, in which the measurements are taken from a series of
Extensive documentation for ERPLAB is available at
Users can also receive support via email. A general email list provides a forum for posing questions to the entire ERPLAB user community. Users can sign up for this list at
It is important to ensure that a software package produces accurate results. ERPLAB’s tools for computing, transforming, plotting, and measuring waveforms have been extensively tested using both real and simulated EEG/ERP datasets. Using these datasets, we (and our beta testers) compared ERPLAB’s output against the output of three well-known commercial EEG packages: Neuroscan
Bugs are an inevitable part of any complex software development project. Users are encouraged to report ERPLAB bugs via email to the ERPLAB developers (
ERPLAB toolbox provides an inexpensive, easy-to-use, flexible, transparent, and powerful system for analyzing both simple and complex ERP experiments, and it also promotes the understanding and appropriate use of ERP methods. ERPLAB’s GUI dramatically reduces the time required for experienced and novice researchers to learn the package and also aids researchers in learning to write custom scripts. Therefore, ERPLAB has become an excellent alternative to commercial ERP analysis packages. At the time of this writing, it has been publicly available for three years, and the latest version is 4.0. It is stable and reliable, has been downloaded over 7000 times, and has been used in many published papers that examine a broad variety of topics (e.g.,
The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.
ERPLAB was inspired by the