Basic data processing pipeline (no artifact correction)

1. Load the data

2. Filter the data
ERPLAB > Filter and frequency tools > Filters for EEG data.

Use a bandpass filter of .1 (high pass) to 30 Hz (low pass). The default IIR Butterworth filter is best. Make sure “Remove mean value (DC bias) before filtering” and “Apply filter to segments defined by boundary events” are checked. Use either a 2nd or 4th order filter (12 or 24 dB/octave roll off). Higher order filters will cause more distortion in your data.

3. Downsample the data
Tools > Change sampling rate.

Downsample the data to 200 Hz. Make sure this is done after you filter, otherwise you can get aliasing artifacts. Downsampling makes the data files MUCH smaller, and things will run faster in subsequent processing steps.

4. Re-reference the data
ERPLAB > EEG Channel operations

You can use the “Reference assistant” button. Enter the equation “.5*ch32” into the field. Make sure the “All channels” radio button is checked. When back in the Channel operations window, make sure the “Create new dataset” radio button is checked. This will re-reference the original data (left mastoid during recording) to the average of the left and right mastoids.

At this point you can also compute ‘bipolar’ eye channels. The eye channels were recorded referenced to the left mastoid, and with the equations you generated above, ERPLAB will re-reference them to the average of the left and right mastoids. However, bipolar eye channels can aid in the detection of large ocular artifacts. Adding the two equations below to the equation window will add two new channels to the dataset that are bipolar derivations of existing channels.

Add two new channels with the following equations in the equations window:

nch33 = ch31 – ch1 label VEOG
nch34 = ch30 – ch29 label HEOG

This will add two new channels to your dataset by creating a VEOG channel consisting of the lower eye (IO1) channel referenced to FP1 and the right eye channel (LO2) referenced to the left eye channel (LO1).

Make sure the “Warning on” check box unchecked and click Run.

5. Append the Channel Location file
Edit > Channel locations

Accept the default file, and click Ok when the coordinates window pops up.

Attaching this file to the dataset will let it know how to do topographic plotting and scalp maps.

6. Create the Event List
ERPLAB > EventList > Create EEG EVENTLIST

Accept the default settings. It can be useful to save each participant’s event list file as a text file to your hard drive. This will let you inspect trigger timings, and you can –if you need to – change event codes by hand or script if you need to for some reason. Otherwise you do not necessarily need to save the event file as a text file to disk, but you do have to create it and attach it to the dataset in this step.

ERPLAB will as you to take off the alphabetic characters from your event codes. Go ahead and do this. Another window might pop up saying that there are some field reserved for ERPLAB. Don’t worry about it. Just click Continue As Is.

7. Assign Bins
ERPLAB > Assign bins (BINLISTER)

Find the bdf file you created for your experiment. Keep the other default settings and click Run.

A good documentation for bdf syntax for ERPLAB can be found here: http://erpinfo.org/erplab/erplab-documentation/manual_4/Binlister.html

8. Epoch data
ERPLAB > Extract bin-based epochs

A window will pop up asking how much time around each event code you want to keep in each epoch. Your choice here will depend on your experiment. For most experiments -200 through 1200 will be acceptable, but there may be reasons that you want to look at longer (or shorter) time windows after the trigger onset, depending on your experiment design or research question (e.g., if you need to look at multi-word epochs, or if your design is only interested in the first couple hundred milliseconds).

Leave prestimulus baseline as the default correction.

9. Perform artifact detection to reject bad epochs/blinks

I suggest running two rounds of artifact detection – the first one one the eye channels, looking for fast-moving artifacts like blinks and saccades, and the second one on the scalp channels (1-28) for large drift, skin potentials, electrode shifts, excessive alpha, etc.

Round 1
ERPLAB > Artifact detection in epoched data > Moving window peak-to-peak threshold

For most cases, a voltage threshold of 40µV will usually work well. Run this on channels 33 and 34 only (VEOG and HEOG that we created earlier). A 200ms window width and a 100ms step should be fine.

Round 2
ERPLAB > Artifact detection in epoched data > Simple voltage threshold

A voltage value of ±75 should screen out most large artifacts and leave the good EEG untouched. Run this only on channels 1:28 (the scalp channels).

After each round of detection, a window with the EEG will pop up with bad trials highlighted in yellow, and the offending channels highlighted in red. Scroll through the final flagged dataset and make sure it’s rejecting the right trials (the ones with CRAP) and keeping the good trials. If things are not working (that is, if bad trials are getting through or good trials are being rejected), change the thresholds accordingly and re-run detection until you find a threshold that works correctly.

At this point is also a good idea to save the dataset with bad trials flagged so that you can inspect it later. You will also want to save the artifact detection results as a text file to your hard drive. You will need this to identify which individuals need to be excluded from data analysis (e.g., anyone with more than 30% rejected trials in any one condition). You will also need to report the average number of trials rejected across participants in each condition when you write your experiment up for publication. The text file will help you do this.

To do this go to ERPLAB > Summarize artifact detection > Summarize EEG artifacts in a table. Select Save in a file, and choose your file path and file name.

10. Average the ERPs
ERPLAB > Compute averaged ERPs

Keep the default settings

Now you have ERPs for this person!

11. Compute any ROIs you want to create for your analysis
ERPLAB > ERP operations > ERP channel operations

Enter equations for any electrode groups that you want to put together for your analysis. For normal sentence processing experiments (N4/P6 experiments), I suggest the following groups:

Left frontal (LF): F7, F3, FC5, FC1
Right front (RF): F8, F4, FC6, FC2
Left posterior (LP): CP5, CP1, P7, P3
Right posterior (RP): CP6, CP2, P8, P4
Centro-parietal (CP): C3, Cz, C4, CP1, CP2, P3, Pz, P4

If you’re looking at other components (e.g., no-go N200), you’ll need different electrode groups (e.g., frontal regions).

12. Compute any difference waves that you might want to look at
ERPLAB > ERP operations > ERP bin operations

In the equation window, enter equations for any new bins you want to create (e.g., create a bin for the ungrammatical condition minus the grammatical condition, or whatever contrasts your experimental design dictaes).

If you’re doing LRP work, you’ll need to do a bit more work here to compute the LRPs, but you’ll do this with bin operations at this stage. You’ll need to specify channels, and compute contra minus ipsilateral waveforms. For LRPs, the primary electrodes you’ll need to look at are C3 (left central, for right-hand responses) and C4 (right central, for left-hand responses).

You can see the ERPLAB guide for LRPs here: http://erpinfo.org/erplab/erplab-documentation/manual_4/Bin_Operations.html

 

Write a script!

All of this will be much easier (and less error-prone) if you automate your data processing with a script that loops over participants. Automated scripting should never be a substitute for manually inspecting each data file, however. You need to know what’s going on in your data file, and you need to know if artifact detection is working.  Spend the time loving your data, and your data will love you back.

The ERPLAB manual has an excellent scripting guide, which is very appropriate for MATLAB beginners!  Check it out here:

http://erpinfo.org/erplab/erplab-documentation/scripting_4