====== Lab 9: EEG and ERPs Part 2 ======
Today we will continue our three-part lab exercise concerned with EEG and ERP recording and analysis. You will analyze the EEG/ERP data collected during various EEG sessions.
===== Readings to be completed prior to this lab: =====
* none
===== Readings to be completed prior to next week's lab: =====
* {{psyc410:documents:engell_2010_jneuro.pdf|Engell, A.D. & McCarthy, G. (2010). Selective Attention Modulates Face-Specific Induced Gamma Oscillations Recorded from Ventral Occipitotemporal Cortex.}}
* {{psyc410:documents:rossion_2015.pdf|Rossion, Torfs, Jacques, & Liu-Shuang (2015). Fast periodic presentation of natural images reveals a robust face-selective electrophysiological response in the human brain.}}
===== Housekeeping =====
**1. ** Rename the old EEG directories. In Terminal:
mv ~/Desktop/input/eeg/CNV ~/Desktop/input/eeg/CNV_old1
**2.** Download the [[https://www.dropbox.com/s/n7dllercuiac8wo/CNV.zip?dl=0|data]] for lab 9.
* Make sure the downloaded file ''CNV.zip'' is on your Desktop. If not, move it there.
* Double click the file to unzip it.
**3.** Move the data directory. In Terminal:
mv ~/Desktop/CNV ~/Desktop/input/eeg/
===== Goals for this lab exercise: =====
Our goal today is to use the skills you developed from last week's lab to analyze EEG/ERP data. There will be less hand-holding in this lab exercise. //I want you to explore your data as though you were the first experimenter to ever run the task//. Such an experimenter would be searching for differences in the ERP waveforms and their scalp topographies that discriminate their experimental conditions from one another.
===== Software introduced in this exercise: =====
* none
===== Laboratory Reports =====
- You will generate one lab report (LR9) from tonight's work.
- [[#lab_report_9|Lab Report ]] is [[psyc410_s2x:syllabus#Lab Reports|due]] **Monday, May 4th @ 7 pm.**
- You should also review (or even start working on) [[http://www.andrewengell.com/wiki/doku.php?id=psyc410_s2x:eeg4|next week's lab]] so that you can come to class prepared with questions about the EEG project's logistics.
- The EEG/ERP Project is [[psyc410_s2x:syllabus#Lab Reports|due]] Wednesday, May 13th @ 11:55 pm.
====== Lab Report #9 ======
Lab Report #9 will be [[psyc410_s2x:syllabus#Lab Reports|due]] Monday, May 4 @ 7 pm
This will be a brief report that ensures ...
* you are running your ERP/EEG analysis correctly
* can generate relevant and reasonably attractive figures
* and interpret the data appropriately.
**This does //not// need to be presented as a journal article.**
What I expect:
**//Methods//**
* a brief description of the task paradigm
* number of participants (i.e., sample size)
* a description of the EEG parameters (e.g., sampling rate, ADC conversion, bandpass parameters, number of electrodes, etc.)
See the methods section of published ERP papers (I've linked a couple below) to get a feel for what's reported and how it's reported. Of course, you are only responsible for reporting the information that's been made available to you. You should not report everything you see in the example papers because you do not now have/know some of this information. But you do need to report everything you know.
{{:psyc410:documents:mohr_2018.pdf|Mohr, Wang, & Engell, 2018}}
{{:psyc410:documents:colombatto_2016.pdf|Colombatto & McCarthy, 2016}}
**//Results//**
* A summary of your main findings with figures (this can be very brief, even bullet-pointed)
* This does **not** mean displaying "everything". Selectively display the electrodes/ERPs/topographies/etc that are the focus of your findings (see "Questions to Address" below).
* At minimum, include the following figures to demonstrate your results
* Time-voltage plots (i.e., ERPs) illustrating the major experimental comparisons for your experiment
* Include plot(s) showing data from a good representative single individual
* Include plot(s) showing data from a an average across individuals (i.e., a grand average)
* Topographic maps illustrative of the major experimental effects.
* From an individual, a grand-average, or both.
I expect to see polished and attractive figures with legends.
You may work with a partner on the data analysis and figure creation, but your report should be written independently. If you choose to work with a partner, please note your partner's name on the cover page of your report.
=== Questions To Address ===
*Is there a CNV evoked between the Ready! and Respond/Hold stimuli?
*Is there a CNV evoked between the Relax and Hold stimuli?
*What is the scalp distribution of the CNV?
*Are there differences between the hemispheres for the Ready-Respond condition related to the responding hand (right)?
* Hints:
* compare FC3 and FC4 (roughly over left and right motor cortex, respectively).
* compare voltage distribution in the scalp topography.
===== Data used =====
The data for this section of the lab were acquired at the Yale Human Neuroscience Lab.
These data were
* Acquired on a Neuroscan SynAmps2 EEG system
* Sampling rate of 500 Hz (later downsampled to 125 Hz)
* Data was low-pass filtered with a cutoff of 100 Hz
* Digitized with 24-bit resolution
===== Data used =====
=== Task Description ===
The **C**ontingent **N**egative **V**ariation is a large, sustained negative deflection that is maximal over central and frontal scalp. It occurs during the interval between a warning stimulus (e.g., 'Ready!') and an imperative stimulus (e.g., 'Respond!'). The CNV was the first ERP discovered that was linked to a cognitive process.
You can learn more about the CNV {{:psyc410:documents:erp_handbook_cnv.pdf|here}}, or refer back to the EEG/ERP class lecture slides.
In this experiment, there were three different conditions:
- ''Relax!'' => 2 sec => ''Hold!''
* Subjects knew that they did //not// have to prepare a response.
- ''Ready!'' => 2 sec => ''Respond!''
* Subjects prepared to respond (Ready!), and then responded (Respond!).
- ''Ready!'' => 2 sec => ''Hold!''
* Subjects prepared to respond (Ready!), but then learned that should withhold their response (Hold!).
=== Event Marker Codes Parameters ===
^Code^Condition^Label^
|1|Relax --> Hold|Relax-Hold|
|2|Ready --> Respond|Ready-Respond|
|3|Ready --> Hold|Ready-Hold|
=== Study Participants ===
You will analyze data from the following participants:
* p01
* p02 (this participant shows the result particularly well)
* p03
=== Data Location ===
* ''~/Desktop/class/input/eeg/CNV/p01''
* ''~/Desktop/class/input/eeg/CNV/p02''
* ''~/Desktop/class/input/eeg/CNV/p03''
===== Analyzing the Data =====
I want you to use the ERPLAB technical skills you learned [[http://www.andrewengell.com/wiki/doku.php?id=psyc410_s2x:eeg2#part_2creating_erps_with_the_erplab_suite|last week]] to analyze your data set. I will therefore only give you step-by-step instructions for aspects of the analysis that differ from what you've already done. In some cases I've asked you to do the analysis steps in a different order than you did last week (e.g., you will filter the EEG data earlier in the pipeline than you did last week).
Always rename and save the created files using the name "suggested" by EEG/ERPlab, unless I specify otherwise.
It will be useful to change your directory in Matlab to the relevant output directory for your task.
You will repeat all steps for each of the three participants. You will then create the ''grand-averaged ERP'' across all three participant ERPs. I suggest you complete one participant at a time rather than completing one step at a time across all three participants. I **__suggest starting with p02__** because this participant has the best results.
I will specify participant ''p01'' in all of the instructions below. Of course, this should be changed to whatever participant number you are currently working on.
Remember, that each of these steps build on the one prior. So you always want to make sure you're applying a given operation to the output file that was created by the prior operation. For example, you will rereference the data and then apply filtering. The filtering should be done to the rereference data, not the raw data.
==== Load the Data ====
**1.** Load the dataset
* ''~/Desktop/class/input/eeg/CNV''
**2. ** Plot the data
You should get in the habit of plotting the data after each preprocessing / analysis step. This way you can see how each step is affecting the data.
**3. ** Add channel location information
==== Rereference the Data ====
//This is not something you did last week.//
During data acquisition, the electrodes on the left and right mastoids (''M1'', ''M2'') were used as the reference. However, we want to use the "average reference" for this analysis. That is, we want to create the average EEG from all 64 EEG electrodes, and then subtract that average from each electrode. Of course, this means that any fluctuations that are in common across all the electrodes will be removed from the data.
**1. ** ''ERPLAB'' -> ''EEG Channel operations''
* Click the ''Clear equations'' button
* Click the ''Reference assistant'' button
* In the window that opens, click the ''average reference'' button
* This is a shortcut that ERPLAB has built-in to do the kind of referencing we want
* Make sure the rest of your window looks like the example below.
{{ :psyc410:images:erplab_reref.png?600 | }}
* Click ''OK''
* Click ''RUN''
**2. ** The **Dataset info** window will pop up when the referencing is done.
* Change the name to ''p01_ref''
* Save it as a file
==== Filter the EEG Data ====
**1. ** Apply an IIR Butterworth [[http://www.andrewengell.com/wiki/doku.php?id=psyc410_s2x:eeg2#filtering_eeg|bandpass filter]] to the EEG data with cutoffs of .1 - 30 Hz.
**2. ** Change the dataset name and save the file as ''p01_ref_bp'' (''bp'' for "bandpass").
**3. ** Plot your data again to observe the effects of applying the bandpass filter.
==== Create Eventlist ====
**1. ** See the event codes in CNV task data [[#Event Marker Codes Parameters|description above]]. For this analysis we can use the event names and numbers as our bin names and numbers.
**2. ** Save the **Equation List** as ''cnv_list.txt'' so that you can use it again for the next participants.
**3. ** Save the **EVENTLIST** as ''p01_elist.txt''.
==== Create Bin-based EEG Epochs ====
* Create epochs of ''-150 to 3000'' ms.
* Use ''-150 to 0'' ms as your baseline.
==== Artifact detection ====
We will use a different artifact detection method than those we used [[:psyc410_s2x:eeg2#Example 1: Moving window peak-to-peak threshold|last week]].
**1. ** Select the ''Simple voltage threshold'' artifact detection and specify the following parameters:
* Test period: ''0 1500''
* Voltage limits: ''-100 100''
* Channels: ''1:64''
We are directing the algorithm to mark as an artifact any trials in which the recorded voltage exceeds the range of -100 to 100 microvolts within the 0 to 1500 ms time-window. Further, we are specifying that the trial should be marked as an artifact if thais occurs on any of the 64 EEG channels.
**2. ** Click ''ACCEPT''
Note how many trials were accepted/rejected for each bin (this information will print out to the MATLAB command window).
You will want to report this information in your methods section.
==== Create Average ERPs ====
We want to reject the artifacts that were detected in the prior step. So make sure ''Exclude epochs marked during artifact detection'' is selected.
Name the ERP ''p01_cnv_erp'' and save it to a file of the same name.
==== Create a Difference wave ====
A difference wave is a wave that shows the difference between two ERPs. It is nothing more than the difference at each time point; that is, a simple subtraction.
Let's create a difference wave that highlights the effect of //preparing to respond//. To do so, we can contrast (i.e., difference) the **Relax-Hold** and **Ready-Hold** ERPs or the **Relax-Hold** and **Ready-Respond** ERPs. Either wave will show the effect of **preparing** to perform a task because the participant thinks they'll need to perform the task in either of the **Ready** conditions.
**1. ** ''ERPLAB'' -> ''ERP Operations'' -> ''ERP Bin operations''
**2. ** Click ''Clear equations'' in the window that opens
**3. ** In the lefthand window type ''b4 = B3-B1 label Ready_minus_Relax''
You are telling the program to create a new bin (''b4'') by subtracting bin 1 (''B1'') from bin 3 (''B3''), and to name the new bin ''Ready_minus_Relax''.
==== Plot the Participant's ERP ====
You can plot your ERP however you think is most informative. Indeed, **you should plot it several times with different parameters to find the way that best highlights your results**. Some tips:
* The electrodes of interest for the CNV ERP are central and central frontal.
* Plotting from -100 to 2500 ms would be most useful.
* Sometimes the autoscale of the y-axis is not sensitive enough to highlight your results so you might want to manually specify the range.
* If you plot all 64 electrodes it might be hard to see what's going on at any one electrode. If you click on the ERP for a specific electrode, a new window will open zoomed in on that one electrode.
* Make your line colors and line widths visible and easy on the eyes. You can adjust these parameters by clicking the ''LINE SPEC'' button in the ''ERP PLOTTING'' window.
==== Plot the Participant's Scalp Voltage Map (aka "topography") ====
If you get a warning that there is no channel location info, select ''Yes'' to load it now, then click ''Ok'' -> ''Ok''.
* Plot the topography of the difference wave that you created (bin #4).
* Because we are looking at a slow wave that persists over time, it will be most helpful to plot the ''mean between two latencies''.
* Set ''500 2000'' as the ''Latency to plot''. This will show the mean voltage between 500 and 1500 ms post stimulus.
* Be mindful of the color bar scale. The default setting is ''Max-Min'', but this is not very useful because the colors are not symmetric around zero. I suggest you use ''Abs Max'' or ''Custom''.
* I urge you to continue to learn how to make cool plots by playing around with the different options.
==== Analyze the remaining participants ====
Rerun all of the above steps for the next two participants.
==== Group Averaging ====
We will now create a grand average of all three subjects.
It might be helpful to close and then reopen EEGLAB so that you're starting with a blank canvas.
**1. ** Load each of the three participant ERPs. ''ERPLAB'' -> ''Load Existing ERPset''
* When you're done, click on ''ERPsets'' and you should see all three participants listed
**2. ** ''ERPLAB'' -> ''Average across ERPsets (Grand Average)''
**3. ** Click the button next to ''From ERPset in the ERPset Menu''. This tells ERPLAB that we'll be specifying which ERPsets to average by using those that we've already loaded.
* Enter ''1:3'' in the box. This tells ERPLAB to use the ERPsets labeled 1 to 3. These are the only ERPsets we have loaded, but this doesn't have to be the case. For instance, you could load the ERPsets of five particpants, but then choose to only average over some subset of them.
**4. ** Click ''RUN''
* Name the file and save it as ''gavg_cnv_erp''
==== Plot the results of your Grand Average ====
Once you have your grand-average and difference waveforms, plot them just as before. A couple of things to consider:
* How similar is the grand-average to the individual subject averages you already viewed?
* How useful is the difference waveform for isolating the main experimental effects?