Studio Tutorial: Rereferencing with Channel Operations - ucdavis/erplab GitHub Wiki

The Channel Operations tool can be used to re-reference your data to a different electrode site (or to the average of a set of electrode sites). You can re-reference continuous EEG, epoched EEG, or averaged ERPs, but the results might vary (click here for a summary of the principles underlying the order of processing steps). Here we will demonstrate re-referencing with an averaged ERP. For simplicity, we’ll use a grand average ERPset, but you will more commonly re-reference single-participant data files.

Make sure you still have grand_filt loaded in the ERPsets menu (or load it from the Extra_Files folder). If you added the CP_Cluster channel in the previous step, you will need to delete that channel before going further. To do this, make sure that the grand_filt ERPset is selected and that you can see the CP_Cluster channel as channel 31 in the Bin & Channel Selection panel. Assuming that this channel exists, go to the Edit/Delete Channel Locations panel, enter 31 in the text box (to indicate that we want to delete channel 31), and click the Delete button. Now we should be back to the original 30 channels.

Delete Channel

Re-Referencing to Cz

In our first example, we will re-reference the grand_filt ERPset to the Cz electrode site. This isn’t a common thing to do, but it makes a nice simple example. We will then re-reference the data to the average of all scalp sites, which is a much more common operation.

Most EEG/ERP analysis packages provide a re-referencing tool that is very abstract. You choose a few settings, click Run, and hope that it did what you wanted. In ERPLAB, our philosophy is that re-referencing can massively change your data, so you should know exactly how it is being performed. With the Channel Operations tool, you will provide a set of equations that specify how the re-referencing is accomplished. This requires a little more work, but it’s worthwhile in the end.

Specifying the equations may sound complicated, but it’s not. Re-referencing is usually accomplished by a very simple algebraic recombination of the existing channels, often just a subtraction (see Chapter 5 in An Introduction to the Event-Related Potential Technique). For example, when a set of channels are all referenced to the same channel, you can re-reference to a new reference channel by subtracting that new reference channel from all of the existing channels.

In our N400 data, all of the scalp channels (i.e., excluding HEOG and VEOG) were referenced to the average of P9 and P10, so we can re-reference these channels to Cz simply by subtracting the Cz channel from each of the other scalp channels. For example, we can re-reference FP1 to Cz with the equation ch1 – ch21 (because FP1 is channel 1 and Cz is channel 21).

To start the re-referencing process, go to the Channel Operations panel. [Note that there are Channel Operations panels in both the ERP tab and the EEG tab; make sure you go to the one in the ERP tab.] Re-referencing is too complicated to accomplish by modifying the channels within an existing ERPset, so we will instead create a new ERPset with the new reference. To accomplish this, select the Create New ERPset (independent transformations) option.

Now we need to fill the text box at the top of the panel with the equations for creating the re-referenced channels. We want a series of equations like this:

nch1 = ch1 - ch21 Label FP1
nch2 = ch2 - ch21 Label F3
nch3 = ch3 - ch21 Label F7

[and so on for the remaining scalp channels]
nch29 = ch29 Label HEOG
nch30 = ch30 Label VEOG

Note that we are not re-referencing channels 29 and 30, which are already bipolar channels. However, we want them in the new ERPset, so we are simply copying them.

Note also that the left side of each equation uses nch to specify a channel whereas the right side uses ch. We use nch to specify a channel in the new ERPset we are creating, whereas we use ch to specify a channel in the original ERPset. If we were modifying the channels within the original ERPset, we would use ch on both the left and right sides of the equation (because it is the same channel on both sides).

In theory, you could type an equation for each channel into the panel, but that would take considerable time and be error-prone. To make this easier, ERPLAB contains a Reference Assistant tool that can create the equations for you. To access this tool, click the Reference Asst button in the Channel Operations panel.

As shown in the screenshot below, you should type ch21 into the Ch_REF = text box. This tells the tool that ch21 is what you want to subtract from each channel to perform the re-referencing. The tool will then create equations in which ch21 is subtracted from each of the channels (as in nch1 = ch1 - ch21). You should select the option for Copy original label to new label so that it transfer the original channel label to the new channel (as in nch1 = ch1 - ch21 Label FP1).

Reference Assistant

We don’t want to re-reference the HEOG and VEOG channels (channels 29 and 30), so select Exclude these channels and enter 29 30 in the corresponding text box. However, we do want the unmodified versions of these channels in the new ERPset, so click the option for If a channel is not being re-referenced, include an equation for simply copying the channel.

Now click OK, and you should see the equations in the text box at the top of the Channel Operations panel. As shown in the screenshot below, we now have equations for each channel, subtracting ch21 from the original channel and including a label with the name of the original channel. Note that ch21 is inside parentheses, which isn’t necessary here but is helpful for more complex re-referencing operations.

ChanOps ReReferencing to Cz

If you scroll down the text box, you will see that channels 29 and 30 (HEOG and VEOG) are simply copied without subtracting ch21.

Make sure that you have everything set as shown in the screenshot, and then click Run. You’ll get the usual window for naming and saving the new ERPset. The new ERP name will have a suffix of _chop (for “channel operations”), but we recommend changing this to _ref to indicate the particular type of channel operation you performed.

If you select all channels and bins 3-5 in the Bin & Channel Selection panel, you should see waveforms like those shown in the screenshot below.

Cz Referenced Data

If you compare these waveforms to the original waveforms (e.g., by selecting the original grand_filt file), you will see that re-referencing had a huge impact on the shape and scalp distribution of the waveforms. This is why ERPLAB requires that an explicit equation is specified for each new channel when you re-reference the data. That way you will know exactly how the re-referencing was accomplished.

You’ll also note that the Cz channel is now flat. Because we re-referenced by subtracting Cz from every channel, we get a value of zero at each time point in the new Cz channel. That’s not a bug. It’s an accurate representation of the new scalp distribution. ERPs always approach zero when you get close to the reference site.

You can read the manual page on Channel Operations for more information about re-referencing and the Reference Assistant tool.

Re-Referencing to the Average of All Scalp Sites

We are now going to re-reference the grand_filt ERPset to the average of all scalp sites (except for the HEOG and VEOG channels). Start by selecting grand_filt in the ERPsets panel. Then go to the Channel Operations tool and click Clear to clear the previous equations. Make sure that the Create New ERPset (independent transformations) option is still set.

Now click the Reference Asst button. Delete ch21 from the Ch_REF = text box and replace it with avgchan(1:28). This tells the tool that you want to subtract the average* of channels 1–28 from each channel (which is how re-referencing to the average of a set of channels works). Note that Matlab uses a colon to specify a range (e.g., 1:28 is used to specify all values between 1 and 28). Make sure everything is set up as shown in the screenshot below, and then click OK.

Reference Assistant

You’ll now see a set of equations in the Channel Operations panel that look like this: nch1 = ch1 - ( avgchan(1:28) ) Label FP1

Note that you can save these equations and use them again later using the Save EQ and Load EQ buttons. That way, you won’t need to run the Reference Assistant tool every time you want to re-reference data that have the same set of channels.

If you click Run in the Channel Operations panel, you’ll see the window for naming and saving the new ERPset. We recommend changing the suffix from _chop to _avgref. The new ERPset should look like the screenshot below (if you select channels 1-28 and bin 5 in the Bin & Channel Selection panel).

Avg Referenced Data

If you compare this to the original grand_filt ERPset, you’ll see that re-referencing again had a massive effect on the data. Here’s an important fact: When you re-reference to the average of all scalp sites, every ERP component and ERP effect will be positive in some channels and negative in other channels. In other words, every component and every effect will exhibit a polarity reversal. That’s just a consequence of the algebra underlying re-referencing to the average of all sites.

You can see this by changing CHANNELS with BINS overlay to BINS with CHANNELS overlay in the Plot Settings panel (and clicking Apply). This overlays the channels, as shown in the screenshot below, and you can see that you have equal amounts of positive and negative voltages across channels at each time point (see screenshot below). By contrast, all most all of the voltages are negative prior to 400 ms if you look at the grand_filt ERPset.

Channel Overlay

You can also see this by using the Plot Scalp Maps to plot the mean voltage between 300 and 500 ms in the original grand_filt ERPset and in the new grand_filt_avgref ERPset.

You can also visualize this by overlaying the waveforms from grand_filt and grand_filt_avgref. This cannot be done with the simple plotting tool in the main ERPLAB Studio window. However, it can be accomplished by selecting Advanced Waveform Viewer from the Plotting Options menu under the lower right corner of the plotting region. In that tool, you can select multiple ERPsets and specify that the different ERPsets should be overlaid (see screenshot below).

Advanced Viewer

This example demonstrates how re-referencing to the average of all scalp sites can massively change your data. For a detailed discussion, see Chapter 5 in An Introduction to the Event-Related Potential Technique.


Previous Page Next Page 🏠
◀️ Averaging (Channels) Measurement Tool ▶️ Home
Part 1 Part 2 Part 3 Part 4
General Overview Filtering EEG Plotting ERPs Shifting Event Codes
Importing EEG Data The EventList ERP Information Epoch Continuous EEG
Example Experiment BINLISTER Grand Average Spectral Data Quality
Load and View Data Epoch and Baseline Bin Operations Channels and Locations
Artifact Detection Filtering ERPs Re-Sampling; Re-Epoching
Averaging (ERPs) Averaging (Channels) Converting to CSD
Artifact Correction ➡️ Channel Operations
Interpolation Measurement Tool
⚠️ **GitHub.com Fallback** ⚠️