Skip to main content
Social Sci LibreTexts

6.5: Exercise - A Basic Assignment of Events to Bins

  • Page ID
    87964
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Enough theory—let’s make some bins! If EEGLAB is already running, I recommend quitting it and restarting it to make sure everything is fresh. Set Chapter_6 to be Matlab’s current folder. Load the dataset named 12_P3_corrected_elist.set (using EEGLAB > File > Load existing dataset). Scroll through the EEG (using EEGLAB > Plot > Channel data (scroll)) 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 a dataset or ERPset, I don’t do anything until I’ve looked at the waveforms. Many times, this visual inspection has made me realize that I have the wrong data or that there is something about the data that is incompatible with what I was planning to do next.

    Do you see any eyeblinks in the VEOG-lower or FP1 channels? Did you need to remove the DC offset to see all the channels? 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, the waveforms have had an artifact correction procedure applied. 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, and the EventList was added.

    We’re finally read to assign the events to bins. Select EEGLAB > ERPLAB > Assign bins (BINLISTER), and set it up like Screenshot 6.1. Specifically, use the Browse button near the top to select the bin descriptor file (BDF_P3.txt). We want to read the EventList from the current dataset, and we want to write the updated version with the bin information to the current dataset. We also want to write it to a text file, so check the Text file box and put elist_bins.txt in the corresponding text box. Click RUN, and then name the new dataset 12_P3_corrected_elist_bins.

    Screenshot 6.1

    BJzPOU9IB7y-n7Z4JstYfpfrgtK1w1qcJRsdTo7LHdJiofRwOGvx0RUc3JFD6vIsckI5aDsthOyCJ-W64E9FacDdJEZs3MlHHJrbK9XjT4USYzjaU7oszyadfEfsDpDkKvPVUIA

    You should see the text file with the EventList in it (elist_bins.txt) in Matlab’s Current Folder pane. Double-click on it to open it the text editor. Near the top, just under the head information, you should see this:

    bin 1, # 30, Rare, Correct
    bin 2, # 153, Frequent, Correct

    This tells you that 30 events were found that match the bin descriptor for Bin 1, and 153 were found that match the bin descriptor for Bin 2. How many should we have had? This is an extremely important question to answer, because errors in event codes and in assigning events to bins are quite common, and many of these errors will lead to the wrong number of trials per bin. In the task description in 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, 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?

    The answer is that Bins 1 and 2 are limited to trials with correct responses and an RT of 200-1000 ms. So, we can’t use these numbers to verify that we have the correct number of event codes. As described in Chapter 2, another way that we can verify the number of event codes is to use EEGLAB > ERPLAB > EventList > Summarize current EEG event codes. Give that a try.

    The resulting list should print in the Matlab Command Window, but it still isn’t very informative. First, we have a ton of different event codes. Second, when we created the randomized sequences of events in our stimulus presentation script, we specified a certain probability of each letter but not a certain number. That is, we guaranteed that there were 8 instances of the letter A when A was the target, but the other 32 stimuli in this block were sampled completely at random from the other 4 letters. So, you can verify that we had eight targets in each block, but it’s not immediately obvious that we had the right number of nontargets.

    To verify that we had the right number of Rare and Frequent stimuli, make a copy of BDF_P3.txt, and edit this copy so that the event descriptors don’t require a correct response. Then run BINLISTER again (on 12_P3_corrected_elist) but choose a new filename for the text file that will contain the new EventList. When you look at this new EventList, you should see 40 trials in Bin 1 and 160 trials in Bin 2.

    Now go back to the text file with the first EventList (elist_bins.txt). Every event code is listed, with the bin assignment in the bin column at the far right. Note that the bin field is empty for the response event codes, because these event codes are not used as time-locking events in this analysis. For the stimulus event codes, you should find a 1 or 2 in this field, indicating whether the stimulus was the target letter or one of the nontarget letters. However, the bin field is empty for some of the stimulus event codes. These are error trials. We’ll take a closer look at the errors in a later exercise.


    This page titled 6.5: Exercise - A Basic Assignment of Events to Bins is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by Steven J Luck directly on the LibreTexts platform.

    • Was this article helpful?