2.5: Exercise- Creating an EventList
-
- Last updated
- Save as PDF
Our next step is to add something called an EventList to the EEG dataset. An EventList is a simple, easy-to-access list of all the event codes in a dataset. EEGLAB stores event codes in a Matlab data structure that’s a little bit difficult for beginners to access, so we added the EventList structure when we created ERPLAB. After all, event is in the name of the ERP technique, so we wanted to make it easy to see and manipulate the event codes.
If you don’t still have the filtered dataset from the previous exercise loaded in EEGLAB, go ahead and load it now (6_N400_preprocessed_filt).
In the EEGLAB GUI, select ERPLAB > EventList > Create EEG EVENTLIST . In the GUI that appears, check the box labeled Export EventList to text file and enter events in the text box to indicate the filename. When the EventList is created, it’s attached to the EEG dataset, and the Export EventList to text fil e option also saves it as a text file so that you can easily see the event codes.
Make sure that the rest of the GUI matches the settings shown in Screenshot 2.7 and then click the CREATE button.
You’ll then see a new window that asks What do you want to do with the new dataset? Just accept the default settings by clicking OK . You’ve now created a new copy of the dataset that has the EventList attached. The starting dataset was named 6_N400_preprocessed_filt , and the new one should be named 6_N400_preprocessed_filt_elist . You can see the loaded datasets in the Datasets menu. You will need the new dataset for the next exercise, so make sure you keep EEGLAB open or save the dataset to your hard drive (using EEGLAB > File > Save current dataset as ).
It’s a little tricky to look at the EventList directly, but we can look at the copy you saved as a text file, which should be named events.txt . You should be able to see this file listed in the Current folder section of the main Matlab GUI (see the lower left corner of Screenshot 2.8).
You can look at this file in virtually any text editor, but the easiest thing to do is to use Matlab’s built-in text editor. You can just double-click the filename in the Current folder box to open the file. It should look something like Screenshot 2.9.
At the top of the file, you’ll see a bunch of general information about the EEG recording, such as the number of channels and the sampling rate. Then you’ll see a list of the event codes, with one per line. Each line contains several columns, many of which we will discuss later. For now, the key columns are item (which indicates the ordering of the event codes), ecode (which is the actual event code), onset (which is the time of the event code relative to the beginning of the recording), and diff (which is the amount of time between the current event code and the previous event code, in milliseconds rather than seconds). In principle, event codes can have a duration (listed in the dura column), but this feature is not used by ERPLAB and event codes are typically considered to be instantaneous (i.e., a duration of 0).
If you look at the diff column, you can now see exactly how much time elapsed between the onset of each target word and the preceding prime word, and you can see the response times. For example, the behavioral response on the first trial (item #5, event code 201) was 563.48 ms after the preceding target word.
You can actually modify the text file and import it back into EEGLAB/ERPLAB to modify the event codes in an EEG dataset (using ERPLAB > EventList > Import EEG EVENTLIST from text file ). For example, imagine that the subject was confused about the task between event codes 120 and 160. You could set the enable column to 0 for these events, which would cause them to be ignored by all ERPLAB processes. Similarly, if you used an eye tracker during the experiment, you could add event codes corresponding to fixations. If you know how to program in Matlab, you can directly modify the EVENTLIST structure rather than modifying the text file and importing it.
Our last step will be to verify that we have the current number of occurrences of each event code. As shown in Table 2.1, there should have been 30 occurrences of each of stimulus event codes. The number of occurrences of each response event code varies across subjects depending on the number of errors. However, there were 120 trials, so there should be 120 total response event codes (plus the two at the beginning during the instruction phase).
To see the number of occurrences, select EEGLAB > ERPLAB > EventList > Summarize current EEG event codes . It will plot a table in the Matlab command window. Do we have the correct number of occurrences of each event code type? On what proportion of trials did this participant make a correct response?
Pro tip: Checking the number of event codes for every participant
In my experience, the most common error in ERP experiments is that there is some kind of problem with the event codes. If you are designing and running your own experiments, perhaps the single most important thing you can do to avoid trouble later is to make sure that your event codes are correct. A given experiment might have 1000+ event codes, so it is difficult to check every single one. However, if you set up your experiment properly, you can at least make sure that you have the right number of occurrences of each event code (for the stimuli).
The first step is to know exactly how many occurrences there should be for each code. And I do mean “exactly” rather than “approximately.” You can have major problems with your event codes and end up with approximately the right number. Then you can simply run your stimulus presentation program while recording the EEG but without a participant. You will then import your data into EEGLAB, add the EventList, and check the number of occurrences of each event code using EEGLAB > ERPLAB > EventList > Summarize current EEG event codes . You should also “spot check” a few dozen randomly selected event codes to make sure that they are correct with respect to the stimulus that was actually presented.
You should also check the number of occurrences of each event code for every participant you run (immediately after the recording session). Lots of things can go wrong with event codes, and this will allow you to catch a problem before you’ve wasted weeks of time collecting data that turn out to be useless. Checking the number of each event code is easy, and you absolutely must do it to avoid problems.