Studio Tutorial: Converting Epoched EEG to Continuous EEG - ucdavis/erplab GitHub Wiki

There are a few situations where it is useful to convert an epoched EEGset into a continuous EEGset. For example, you may not have the original continuous EEGset, but you may want to perform operations that require continuous data (e.g., assigning events to bins with BINLISTER). In this situation, you can convert the epoched EEGset into a continuous EEGset, perform the operations, and then re-epoch the data. Note that the continuous EEGset will contain a boundary event (code -99) wherever epochs have been joined together. Also, the EventList from the epoched EEGset will not be transferred to the new continuous EEGset (but can easily be recreated).

Another use for this conversion arises when you are creating response-locked averages, but you want to use the prestimulus period on each trial as the baseline. Once you have time-locked to the response, the prestimulus period will vary across epochs (assuming that the response time varies from trial to trial). ERPLAB won’t know what the prestimulus period is for a given epoch, so it won’t be able to use the prestimulus period for baseline correction. There is a “trick” for this that includes converting between epoched and continuous EEGsets. Here’s a summary of the steps:

  1. Run BINLISTER with the stimulus as the time-locking event
  2. Epoch the data with the prestimulus period as the baseline and a long post-stimulus epoch length
  3. Convert the epoched data back to continuous data (with a very long epoch length)
  4. Recreate the EventList for the new continuous EEGset
  5. Run BINLISTER again with the response as the time-locking event
  6. Epoch the data again without any additional baseline correction

Let’s now go through these steps with some real data. Go to the EEGsets panel and select 6_N400_filt_elist_bins. If you don’t still have this EEGset loaded, you can find it in the Extra_Files folder. BINLISTER has already been run on this EEGset using the bin descriptors in BDF_N400.txt, which created stimulus-locked bins for the primes and the targets (Step 1 in the list above).

Long Epoching

Now we’re going to epoch this EEGset, using a 200-ms prestimulus interval and using this interval as the baseline period. However, we’re going to use a long epoch length that extends until 2500 ms after the stimulus (see screenshot above). The bin descriptors for the targets in BDF_N400.txt specify that the response must occur within 1500 ms of the stimulus for the stimulus to be assigned to the bin, so we are guaranteed that the our epoch of -200 2500 (relative to the stimulus) will extend at least 1000 ms after the response. Go ahead and epoch the data this way using the Extract Bin-Based Epochs panel, naming the new EEGset 6_N400_filt_elist_bins_longepoch. You’ve now completed Step 2.

Now go to the Utilities panel and click Convert to Continuous EEG. You can use the default EEGset name of 6_N400_filt_elist_bins_longepoch_ep2con (where ep2con stands for “epoched to continuous”). You’ll see a window like the one shown in the screenshot below. Make sure the box is checked for Restore event codes. This ensures that the event codes in EEG.event are converted from bin numbers back to the original event codes (e.g., from “B2(121)” to “121”).

Convert to Continuous

If you look at the new continuous EEG, you’ll see boundary codes every 2700 ms. Note that many event codes appear twice, once as the time-locking event and once within the epoch following the previous stimulus (because our epoch length extends past the time of the next stimulus). You’ve now completed Step 3.

Continuous EEG

The EventList is not copied from the epoched EEGset to the continuous EEGset (because it might no longer be valid). Step 4 is therefore to re-create the EventList in the new continuous EEGset. You can do this by going to the EventList panel, clicking Create, and then clicking CREATE in the new window that appears. You can name the new EEGset 6_N400_filt_elist_bins_longepoch_ep2con_elist.

For Step 5, we will run BINLISTER again with a different bin descriptor file in which the responses are the time-locking events. Go to the Assign Events to Bins panel, click Browse and select the bin descriptor file named BDF_N400_resplocked.txt. Click Run and accept the default name for the new EEGset (6_N400_filt_elist_bins_longepoch_ep2con_elist_bins).

Here’s what the bin descriptor file looks like:

Bin 1
Target word, related to previous prime, time-locked to correct response
{t<200-1500>211;212}.{201}

Bin 2
Target word, unrelated to previous prime, time-locked to correct response
{t<200-1500>221;222}.{201}

Bins are defined only for the targets, not for the primes (because there were no responses for the primes). In the lines that define the bins, the period symbol is right before the event code for the response (201), indicating that the response event code will be time zero.

The final step is to epoch the data again, but without performing any additional baseline correction. As shown in the screenshot below, we will use a Time Range that goes from 500 ms before the response until 500 ms after the response, and we will specify None for the Baseline Period. Click Run, and accept the default name for the new EEGset (6_N400_filt_elist_bins_longepoch_ep2con_elist_bins_be).

Epoching w/o Baseline Correction

Just for fun, let’s make averaged ERPs from the epoched EEG. Go to the Compute Averaged ERPs panel and click Run. Name the new ERPset 6_N400_resplock. As shown in the screenshot below, the average voltage in the baseline period (the 500 ms prior to the response) is not zero. Although you can’t visualize it, the voltages are relative to the 200 ms prior to the stimulus (which occurred at different times relative to the response on different trials).

If you look at the VEOG channel in the lower right corner, you can see a large negative deflection right after time zero. This is because this participant often blinked right after responding. This deflection is much more obvious in the response-locked average than in the stimulus-locked average.

Response Locked Average


Previous Page Next Page 🏠
◀️ Shifting Event Codes Spectral Data Quality ▶️ 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** ⚠️