Basic ERPLAB Processing Steps - ucdavis/erplab GitHub Wiki

Basic ERPLAB Processing Steps

This section provides an outline of the typical sequence of operations for analyzing an ERP experiment using the combination of EEGLAB and ERPLAB. The details will be found in later sections, but it is useful to have an overview of the whole process.

Terminology

First, you need to know a key bit of ERPLAB terminology. In some ERP analysis systems, each ERP file contains the data from a single trial type. This can lead to a huge number of files in a complex experiment, so ERPLAB can store many ERPs in a single file. Each ERP is stored in what we call a bin. More precisely, a bin is a set of averaged ERP waveforms, one for each electrode site, which were created by averaging together a specific set of trials. A simple oddball experiment, for example, might have one bin for the targets and another bin for the standards. However, a sophisticated experiment might have dozens of different bins.

Typical Steps

Here are the typical steps in analyzing an ERP experiment:

  1. Import an EEG file into EEGLAB, where it becomes a dataset. Once you have imported the raw EEG, you should view it with Plot > Channel data (scroll) to make sure everything looks OK (noe: this is EEGLAB's plotting routine, not an ERPLAB routine). The original EEG file can come from one of the many different commercial EEG recording systems supported by EEGLAB (including Neuroscan, EGI, and Biosemi; see the EEGLAB documentation for the supported file types). Note that EEGLAB takes care of importing the EEG; this is not ERPLAB's business.
  2. There are several EEGLAB routines that you may wish to run at this point (or after epoching). For example, if you wish to filter the EEG, you can use ERPLAB > Filter & Frequency Tools (EEGLAB has its own filtering tools, but we believe the ERPLAB filters are better for most conventional ERP experiments). You may also wish to enter electrode location coordinates at this point (which will be useful later for topographic mapping). This can be accomplished with Edit > Channel locations, which allows you to automatically choose standard locations on the basis of the electrode names (or enter custom coordinates).
  3. Create the EVENTLIST structure from the current dataset using ERPLAB > EventList > Create EEG EventList. The EVENTLIST structure will ordinarily be attached to the EEG structure. It stores information about ERPLAB's event processing and bin assignments. It can also be saved as a text file, allowing you to insert, modify, or delete events and then import the new events back into the dataset. At this point, you can assign text labels for each numeric event code (or assign numeric event codes if your datafile contains text labels instead of numeric codes). You can even assign bins for the events if there is a simple 1:1 mapping between event codes and bins. Important note: ERPLAB requires numeric event markers, and if your system uses text labels (e.g., 'S23') you must convert them into numeric markers at this point.
  4. In most experiments, you will need to specify the mapping between events and bins using ERPLAB > Assign Bins (BINLISTER). This involves creating a Bin Descriptor File (BDF), a text file that provides an abstract description of the events that will be averaged together. For example, you can specify that Bin 3 will consist of targets that were preceded by a nontarget and followed 200-1500 ms later by a left-hand button-press response. This step can also be configured to extract reaction times, which are saved in the bdf field of the EVENTLIST structure and can be exported to a text file with ERPLAB > EventList > Export Reaction Times to Text.
  5. Convert the continuous EEG data in the dataset into a set of fixed-length epochs around each event using ERPLAB > Extract Bin-Based Epochs. Any of the EEGLAB functions that operate on epoched data can be applied at this point. (Note that this differs from EEGLAB's Tools > Extract epochs function in several ways, and you must not use the EEGLAB epoching function in conjunction with ERPLAB. If you have already used EEGLAB to epoch the data, you will need to re-epoch with ERPLAB before using any of the ERPLAB functions that operate on epoched data.)
  6. Perform Artifact Detection on the epoched dataset, marking problematic EEG segments so they can be excluded during the averaging process. Prior to artifact detection, you may wish to re-reference the data or create new channels in the dataset (e.g., a bipolar HEOG channel from separate HEOG-left and HEOG-right channels). This is accomplished with ERPLAB > EEG Channel Operations. After you have performed artifact detection, you can use Plot > Channel data (scroll) to see which epochs have been marked for rejection. You can also manually mark or unmark epochs using EEGLAB > Tools > Reject data epochs > Reject by inspection. You may use EEGLAB's ICA-based artifact correction instead of, or in addition to, artifact rejection. EEGLAB also contains artifact detection routines, which you can use in conjunction with ERPLAB's routines. However, you need to make sure that the EEGLAB and ERPLAB artifact information is kept synchronized, which you can do with the ERPLAB > Artifact detection in epoched data > Synchronize artifact info in EEG and EVENTLIST.
  7. Average together the epochs that have been assigned to each bin using ERPLAB > Compute Averaged ERPs. The averaged data are stored in the bindata field of the ERP structure, which is basically an Electrodes x Time x Bins matrix. Other fields within the ERP structure describe the subject, sampling rate, electrode names, etc. The new ERP structure becomes the current ERPset, and you can save it to disk as a binary file (a filename extension of ".erp"is recommended, but it is really a Matlab ".mat" file). You can also export this to a text file by using ERPLAB > Export ERP to Text. You can also import ERPs from other systems if they have been saved as text files. Note that the ERP structure also contains a copy of the EVENTLIST structure from the EEG structure that was used to provide the data that were averaged together to create the ERP structure. This can be used to perform behavioral analyses that include only the trials included in the averaged ERPs (e.g., the trials that did not contain artifacts, etc.).
  8. You can filter your ERP data with ERPLAB > Filter & Frequency Tools.
  9. You can also create new/modified bins (e.g., difference waves) using ERPLAB > ERP Operations > ERP Bin Operations or new/modified channels (e.g., re-referenced channels) using ERPLAB > ERP Operations > ERP Channel Operations. ERP Bin Operations also lets you perform operations that involve specific combinations of bins and channels (like making contralateral-minus-ipsilateral difference waves in N2pc, CDA, or LRP experiments).
  10. Plot the averaged ERP waveforms using ERPLAB > Plot ERP Waveforms or plot topographic maps of voltage using ERPLAB > Plot ERP Scalp Maps. ERPLAB is not designed to directly create publication-quality figures. However, you can export ERPLAB's plots (in vector format) as PDF files, which can then be imported into and edited by a variety of illustration programs for making publication-quality figures.
  11. Once you have completed the above steps for each subject, and have therefore created a separate ERPset for each subject, you can create a grand average across subjects using [ERPLAB > Average Across ERPsets](./Averaging-Across-ERPSETS-(Creating-Grand-Averages). Note that you may want to process the first 1-3 subjects using the GUI and then write a script for processing subsequent subjects. A history of the functions called by your GUI actions can be obtained by typing eegh or EEG.history and erph or ERP.history in the command window, and this can provide an excellent starting point for writing a script (see scripting guide for more details).
  12. Perform ERP measurements, such as mean amplitude and peak latency using ERPLAB > ERP Measurement Tool. The measurements are saved in a text file in a manner that is easily imported by Excel or SPSS.