Chapter 07: Selecting Data Epochs and Comparing

Jump to: navigation, search

Arrow.small.left.gif (MT) I.6: Data Averaging
Tutorial Outline
(MT) Chapter 08: Plotting ERP images Arrow.small.right.gif


Selecting data epochs and plotting data averages

Selecting events and epochs for two conditions

To compare event-related EEG dynamics for a subject in two or more conditions from the same experiment, it is first necessary to create datasets containing epochs for each condition. In the experiment of our sample dataset, half the targets appeared at position 1 and the other half at position 2 (see sample experiment description ).

Exploratory Step: Selecting Events and Epochs for Two Conditions.

Select Edit > Select epochs or events. The pop_selectevent.m window (below) will appear. Enter "1" in the textbox next to position, which will select all epochs in which the target appeared in position 1.
Press Yes in the resulting query window (below):
Now a pop_newset.m window for saving the new dataset pops up. We name this new dataset "Square, Position 1" and press OK.
Pop newset2.gif
Now, repeat the process to create a second dataset consisting of epochs in which the target appeared at position 2. First, go back to the previous dataset by selecting menu item Datasets > Continuous EEG Data. Make sure you work on the original continuous dataset or you will be able to extract data epochs at position 2. Next select Edit > Select epoch/events. In the resulting pop_selectevent.m window, enter "2" in the text box to the right of the position field. Press OK, then name the new dataset "Square, Position 2".
Pop selectevent2.jpg
See the event tutorial, "selecting events", for more details on this topic.

Another function that can be useful for selecting a dataset subset is the function pop_select.m called by selecting Edit > Select data. The example below would select data sub-epochs with the epoch time range from -500 ms to 1000 ms. It would, further, remove dataset epochs 2, 3 and 4 and remove channel 31 completely.
Pop select.gif

Computing Grand Mean ERPs

Normally, ERP researchers report results on grand mean ERPs averaged across subjects. As an example, we will use EEGLAB functions to compute the ERP grand average of the two condition ERPs above.

Exploratory Step: Computing Grand Mean ERPs.

Select Plot > Sum/Compare ERPs. In the top text-entry boxes of the resulting pop_comperp.m window (below), enter the indices of datasets ‘3’ and ‘4’. On the first row, click the avg. box to display grand average, the std. box to display standard deviation, and the all ERPs box to display ERP averages for each dataset. Finally 0.05 for the t-test significance probability (p) threshold. Then press OK.
I72pop comperp().gif
The plot below appears.
Pop comperp3.gif
Now, click on the traces at electrode position FPz, calling up the image below. You may remove the legend by deselecting it under the Insert > Legend menu.
Pop comperp4.gif

Note: If you prefer to use positive up view for the y-axis scale, type ydir', 1 in the Plottopo options field. This can be set as a global or project default in icadefs.m. See the Options tutorial.

The ERPs for datasets 3 and 4 are shown in blue and red. The grand average ERP for the two conditions is shown in bold black, and the standard deviation of the two ERPs in dotted black. Regions significantly different from 0 are highlighted based on a two-tailed t-test at each time point. This test compares the current ERP value distribution with a distribution having the same variance and a 0 mean. Note that this t-test has not been corrected for multiple comparisons. The p values at each time point can be obtained from a command line call to the function pop_comperp.m.

Finding ERP peak latencies

Although EEGLAB currently does not have tools for automatically finding ERP peak amplitudes and latencies, one can use the convenient Matlab zoom facility to visually determine the exact amplitude and latency of a peak in any Matlab figure.

Exploratory Step: Finding ERP Peak Latencies.

For example, in the figure above select the magnifying-glass icon having the + sign. Then, zoom in on the main peak of the red curve as shown below (click on the left mouse button to zoom in and on the right button to zoom out). Read the peak latency and amplitude to any desired precision from the axis scale.
Pop comperp5.gif

Note: It may be desirable to first use the low pass filtering edit box of the pop_comperp.m interface to smooth average data peaks before measuring latency peaks.

Comparing ERPs in two conditions

Exploratory Step: Comparing ERPs in Two Conditions.

To compare ERP averages for the two conditions (targets presented in positions 1 and 2), select Plot > Sum/Compare ERPs. In the top text-entry box of the resulting pop_comperp.m window (below), enter the indices of the datasets to compare. Click all boxes in the avg. column. Enter 30 for the low pass frequency and 'title', 'Position 1-2' in the topoplot.m option edit box. Then press OK.
Pop comperp6.gif
The plottopo.m figure (below) appears.
Pop comperp7.gif
Again, individual electrode traces can be plotted in separate windows by clicking on electrode locations of interest in the figure (above). Note that here, since the two conditions are similar (only the position of the stimulus on the screen changes), the ERP difference is close to 0.
Pop comperp8.gif
This function can also be used to compute and plot grand-mean ERP differences between conditions across several subjects, and can assess significant differences between two conditions using a paired t-test (two-tailed). To do so, load the datasets for the two conditions for each subject into EEGLAB and enter the appropriate indices in the pop_comperp.m window.

In EEGLAB 5.0b, a new concept and data structure, the STUDY, has been introduced to aggregate and process datasets from multiple subjects, sessions, and/or conditions. See the Component clustering and STUDY structure tutorials for details. The new STUDY-based functions include a command line function, std_envtopo.m that visualizes the largest or selected independent component cluster contributions to a grand-average ERP in two conditions, and to their difference.

In the following sections, we will be working from the second dataset only, and will not use datasets 3 and 4. Return to the second dataset using the Datasets top menu, and optionally delete datasets numbers 3 and 4 using File > Clear dataset(s).

Data averaging collapses the dynamic information in the data, ignoring inter-trial differences which are large and may be crucial for understanding how the brain operates in real time. In the next section, we show how to use EEGLAB to make 2-D ERP-image plots of collections of single trials, sorted by any of many possibly relevant variables.

Arrow.small.left.gif (MT) I.6: Data Averaging
Tutorial Outline
(MT) Chapter 08: Plotting ERP images Arrow.small.right.gif