6.5: Exercise - A Basic Assignment of Events to Bins

Applied Event-Related Potential Data Analysis 2e · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    Read aloud

    How

    Speed: 1×
    Light up
    Highlight

    Symbols: Mulberry Symbols, © 2018–2026 Steve Lee, CC BY-SA 4.0 (licence, the set), the site's own copies.

    From LibreTexts, under CC BY-NC 4.0, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    6.5: Exercise - A Basic Assignment of Events to Bins

    Enough theory—let’s make some bins! To make sure there aren't any unwanted settings left over from the previous exercise, start by clicking the Reset button under the lower right corner of the plot region and then clicking Reset ERPLAB Studio in the window that appears. Make sure that Chapter_6 is Matlab’s current folder. Using the EEGsets panel, load the EEGset named 12_P3_corrected.set. Scroll through the EEG and familiarize yourself with it. For example, take a look at the sequence of event codes and match them with the codes in Table 6.1. When I load an EEGset or ERPset, I always look at the waveforms before I do anything else. Many times, this visual inspection has made me realize that I had the wrong data or that there was something about the data that was incompatible with what I was planning to do next.

    Do you see any eyeblinks in the VEOG-lower or FP1/FP2 channels? Did you see much low-frequency drift in the EEG? The answer is “no” for both questions. This gives you some clues about the preprocessing steps that have already been applied to this dataset. What operations do you think have already been applied?

    To keep the exercises in this chapter simple, I have already applied an artifact correction procedure to the EEGsets. Instead of excluding epochs that contain blinks and eye movements, the voltages for the blinks and eye movements have been estimated and subtracted from the waveforms. That way, we won’t need to throw out any trials in the exercises in this chapter. This is why the filename for the dataset has _corrected in it. A high-pass filter (half-amplitude cutoff at 0.1 Hz) has also been applied to remove slow drifts.

    Creating an EventList

    Before we can assign events to bins, we need to create a data structure called an EventList and attach it to the EEG structure. EEGLAB stores event codes in a somewhat complicated fashion, and the EventList makes the event codes much easier to see and manipulate.

    To create the EventList, go to the EventList panel and click the Create button. You should see a window like the one shown in Screenshot 6.1. There are several options in the window, and a whole lot more become available if you click the Advanced button, but most users can just use the default options. If you want to know more about the EventList structure, you can read this page in the ERPLAB Studio Manual, and if you want to know more about the available options for creating an EventList, you can read this page.

    Create EventList

    Screenshot 6.1

    Go ahead and click the Create button inside the Create EventList window. This will create the EventList from the event code information inside the current EEGset and attach it to the EEGset, creating a new EEGset. You can use the automatically suggested name for this new EEGset, 12_P3_corrected_elist, and you should save it to disk by checking the Save EEGsets to disk and Use EEG name as filename options (because you will need this file for a later exercise). Note that the EventList panel has a little table showing the number of occurrences of each event code. That can be useful for verifying that your stimulus presentation program is working the way you expect.

    Now click the View button in the EventList panel to see the EventList you just created. You should see a new window like the one shown in Screenshot 6.2. The top portion of the window provides "header" information, such as the name of the EEGset (setname), the number of channels (nchan), and the sampling rate (srate). The bottom portion shows the list of event codes. The key columns are item (the item number for each event), ecode (the event code for that event), onset (the time of the event code relative to the onset of the recording, in seconds), diff (the amount of time between the current event code and the previous event code, in milliseconds), and bin (the bins that this event code has been assigned to). You can see that the first two items are event code 202 (incorrect response); these were automatically generated by the stimulus presentation script and can be ignored. Item 3 is the event code for the first stimulus in the trial block. It has an event code 54, which is the letter D when E was the target according to Table 6.1 in Section 6.3. Item 4 has event code 201, which is the event code for a correct response. The diff column tells us that the amount of time between this response and the preceding stimulus was 625 ms.

    View EventList

    Screenshot 6.2

    If you scroll through the list of events, you'll see that item 45 was event code 55 (the letter E when E was the target), and it was followed by event code 202 (an incorrect response). Once we assign event codes to bins, item 45 should not be included in the bin for targets, because we are including only stimuli that are followed by a correct response. If you scroll further, you'll see that item 121 was event code 23 (the letter B when C was the target), and it was followed by a correct response (event code 201). However, the diff column for the response indicates that it occurred 173.83 ms after the stimulus, which is too fast for a controlled behavior. Consequently, item 121 will be excluded from the bin for the nontargets.

    You may now close the window showing the EventList.

    Assigning Events to Bins

    Now let's assign the events to bins. Go to the Assign Events to Bins (BINLISTER) panel and use the Browse button to select the bin descriptor file (BDF_P3.txt). There are a bunch of options that you could access by clicking the Advanced button, but you won't ordinarily need any of them. If you're interested, you can read about them in the manual page for this panel. Just click Run to perform the BINLISTER process, and give the new EEGset the suggested name (12_P3_corrected_elist_bins).

    You can now see the number of trials that were assigned to each bin in the panel (see Screenshot 6.3). There were 30 events that matched the bin descriptor for Bin 1, and 153 that matched the bin descriptor for Bin 2. How many should we have had? In the task description provided at the beginning of the chapter, you learned that there were 5 equiprobable letters, 5 blocks of trials (one with each letter as the target), and 40 trials per block. This gives us 200 total trials. Given that 1 of the 5 letters was the target in each block, the target probability was 20%. This means that we should have had 40 targets and 160 nontargets over the course of a session. Why, then, do we only have 30 instances of Bin 1 and 153 instances of Bin 2?

    BINLISTER panel

    Screenshot 6.3

    The answer is that our bin descriptors for Bins 1 and 2 specified that a given stimulus event code must be followed by a correct response within 200-1000 ms, and the response was incorrect, too fast, or too slow on some of the trials. These trials were not assigned to any bin. (Later, we will do an exercise where we have separate bins for correct and incorrect trials.)

    To see that everything worked correctly, we need to look at the EventList, because the BINLISTER process simply updates the EventList to add bin numbers to any events that matched a bin description. Go to the EventList panel and click the View button to pop up a window showing the updated EventList. Note that the bin column, which was empty before, now has a 1 or a 2 for many of the events. If you look more closely, you'll see that most of the stimulus events have a 1 or a 2 in the bin column, but none of the response events have anything in the bin column. This is because we are using stimuli rather than responses as the time-locking events in this analysis. Later, you'll see an example of how to make response-locked averages.

    Most of the stimulus events are assigned to Bin 2 (the Frequent nontarget category), because 80% of the stimuli were in this category. But if you scroll down, you'll see that item 25 was a target (event code 55, which was the letter E when E was the target) and is assigned to Bin 1. Items 43 and 45 were also targets, but they were not assigned to any bin. This is because each of them was followed by an event code 202 (indicating an incorrect response). If you scroll down to item 121, you will see that it was a nontarget stimulus, and it was followed by a correct response, but the response was faster than 200 ms (i.e., the diff column for the response event had a value of 173.53). Thus, event 121 was not assigned to a bin.

    After you're finished looking at the EventList, you can close this window.


    This page titled 6.5: Exercise - A Basic Assignment of Events to Bins was last modified on Thu, 01 Oct 2026 18:52:55 GMT and is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Steven J Luck directly on the LibreTexts platform.