User Tools

Site Tools



EEGLAB Hackathon
Main Website


Session Three: Advanced analyses

Mass Univariate Toolbox

This session might involve some preparation in advance because I will not have time to discuss the ins and outs of the methods implemented in the Mass Univariate Toolbox

I suggest to have a quick look at the Toolbox's wiki to see what it does. You will also find a few brief explanations of the methods implemented in the toolbox.

If you have time, you can watch these talks by David Groppe (Chapter 2 & 3 should give you a pretty good insight). There is also the published paper which, if you choose to use this toolbox should become your bible. Really good discussions of when to use what tests:
Groppe, D.M., Urbach, T.P., Kutas, M. (2011) Mass univariate analysis of event-related brain potentials/fields I: A critical tutorial review. Psychophysiology. 48(12) pp. 1711-1725, DOI: 10.1111/j.1469-8986.2011.01273.x).

The following instructions are mainly reproducing instructions published on the Mass Univariate Toolbox's wiki. The tutorials are very clear and it is advised to refer to the original wiki for other analyses not covered in this hackathon.

1. Load data from ERPLAB

Before we can run analyses in the Mass Univariate Toolbox, we need to prepare the data. Because we have seen how to process data in ERPLab we are in luck as the integration with ERPLab is very tight.

Both toolboxes work on the concept of “bins” to label trials of interest. Because we have already specified bins and saved *.erpsets we can go directly from there!

If your data was processed in EEGLAB and never converted to ERPLAB the Mass Univariate Toolbox can still be used with a little extra preparation step. Head over to this page to see how.

  • Load ERPSETS into a GND file:
  • This will pop up a window where you can select your *.erpset files. (Several sets can be loaded at once by holding ⌘-cmd/ctrl + click). Let's load all our sets and hit Open (a window will come up asking if we want to load more sets. We will click No.
  • If everything goes well MATLAT should display a series of messages informing you that sets are being loaded, baselined, and giving you a summary of “bins':

  • The next window will ask you to save your *.GND file so you can come back to it later by executing the following command:
load TutorialData.GND -MAT
  • Let's name the file TutorialData

2. Visualise loaded GND


The following window will pop up:

3. Within-Subject Analyses

i. explore data

The manipulation in the current data is within-subjects. The Mass Univariate toolbox can also be used for between-subject comparisons. Head over to the Mass Univar official wiki for more information.

  • We can use the command headinfo(GND) to list the bins created in our dataset for future reference. This is what we should obtain:
1:TP7 2:FT7 3:AF7 4:FCZ 5:AF8 6:FT8 7:TP8 8:C5
9:F5 10:AF3 11:CPZ 12:AF4 13:F6 14:C6 15:CP3 16:C1
17:FC3 18:POZ 19:FC4 20:C2 21:CP4 22:TP9 23:PO7 24:P5
25:OZ 26:P6 27:PO8 28:TP10 29:P1 30:PO3 31:PO4 32:P2
33:FT9 34:F7 35:FP1 36:AFZ 37:FP2 38:F8 39:FT10 40:T7
41:FC5 42:F3 43:FZ 44:F4 45:FC6 46:T8 47:CP5 48:C3
49:FC1 50:PZ 51:FC2 52:C4 53:CP6 54:P7 55:P3 56:CP1
57:O1 58:CP2 59:P4 60:P8 61:Iz 62:PO9 63:O2 64:PO10
Bin 1: MatchHighLabel
Bin 2: MatchLowLabel
Bin 3: MatchHighSound
Bin 4: MatchLowSound
Bin 5: MismatchHighLabel
Bin 6: MismatchLowLabel
Bin 7: MismatchHighSound
Bin 8: MismatchLowSound
Bin 9: Match
Bin 10: Mismatch
Bin 11: LabelM
Bin 12: SoundM
Bin 13: HighM
Bin 14: LowM
No t-test results have been stored with these data.
  • Let's plot the Match & Mismatch conditions:
plot_wave(GND, [9,10]);

The second argument in the function is an array of bin integers that we wish to plot. This is what we should get:

NOTE: Negative is plotted UP as the toolbox is developed by the Kutas lab who plot negative up.

If we really can't cope with negative up, we can add a few arguments:

plot_wave(GND, [9,10], 'ydir', 1);

And voilà:

ii. compute difference waves

To assess the difference between those two conditions we need to compute a difference wave by subtracting condition 10 to 9

GND=bin_dif(GND, 10, 9, 'Match>Mismatch');
  • Bins are separated by commas this time
  • We will also give a name to the difference wave that we create so we know what it corresponds to.
  • MATLAB will inform us that a new bin has been created and added to the GND variable:
Condition Code 1: Experiment (not cal pulses)
Bin 15: Match vs Mismatch
  • Let's visualise this difference by calling gui_erp() like so:
gui_erp(GND, 'bin', 15, 'ydir', 1);

Ta Da:

The waveforms are clickable, and topographies are updated as we navigate through the waveforms.

NOTE: Dots for electrode positions are not displayed in our case because our dataset exceeds 64 electrodes and by default the function does not add them for legibility. Dots will however appear after analyses are done to show you electrodes of significant differences.

iii. Time Point Analyses

For thorough explanations of each statistical analyses methods refer to:
Groppe, D.M., Urbach, T.P., Kutas, M. (2011) Mass univariate analysis of event-related brain potentials/fields I: A critical tutorial review. Psychophysiology. 48(12) pp. 1711-1725, DOI: 10.1111/j.1469-8986.2011.01273.x).

Tmax permunation test

This is the type of test I introduced at the beginning of the session. This method is probably one of the most conservative MCP corrections out of the three methods implemented in this toolbox.

This test controls the family-wise error rate –probability of making one or more false discoveries. Because we will be running a test over 700 time points over 64 electrodes we will be running 44,800 comparisons, which if non-corrected augment the chances of finding false discoveries well beyond the commonly accepted alpha level of 5%.

  • The test is performed on the difference wave so we will be running the test on the newly created “bin 15”
GND=tmaxGND(GND, 15, 'time_wind', [90 790], 'n_perm', 2500);
  • Two windows pop up:
    • The familiar guy_erp

Notice now, that a threshold is displayed on the t-scores (all t-scores out lower or higher than those are significant). White dots are also displayed for each electrode that displays a significant difference.

  • The second window is a significance raster which plots all electrodes and colours each time point of significant difference:

The default setting is to plot vertical lines to separate each time points. While this is not a problem at low sampling rates, for sampling rates of 500Hz and above it becomes hard to read.

It is advisable to plot the sig_raster again adding the option 'plot_vert_lines', 'no'

  • The significance raster can be invoked again by using the following command:
sig_raster(GND,1, 'use_color', 'rgb', 'plot_vert_lines', 0);
FDR control

The toolbox implement another popular (esp. with the fMRI crowd) MCP correction, known as control for False Discovery Rate (FDR) from Benjamini & colleagues.

  • To perform such test we use the tfdrGND() function:
GND=tfdrGND(GND, 15, 'method', 'by', 'time_wind', [90 790]);
  • check help tfdrGND for details about the methods: Three popular FDR methods exist varying in sensitivities.

From this test we get the following:

We can clearly see that FDR is more powerful as more electrodes show significant differences, as well as more time points (especially for later positive time windows.)

Cluster Mass Permunations

The last method, mainly advocated by Maris & Oostenveld (2007) is similar to the tmax permutation test, which builds the null hypothesis from random permutations from the data, but rather than collecting the most extreme values from each channel and each time point, it clusters each neighbouring extreme (time and/or channel) t-scores and builds the null hypothesis from the most extreme cluster statistics. (For more info check Maris & Oostenveld, 2007 or Groppe, Urbach, & Kutas, 2011

This approach is particularly suited to ERPs or ERFs as ERP effects are likely to extend over several electrodes and time points compared to noise. It will be especially suited for slower types of ERP waves.

  • We perform the test by using the following command:
GND=clustGND(GND,15,'time_wind',[90 790],'chan_hood',40,'thresh_p',.05, 'n_perm', 2500);

This is what we get:

As we can see this method is much less restrictive than the tmax permutation method.

  • 2 things need to be pointed out:
    1. the output from this test is a little bit different: It summarises the numbers of negative and positive clusters and tells us how many of those were found to be significant along with associated p-values.
    2. As you will see from the GUI we do not have a threshold around the t-scores anymore, and this is due to the fact that it is tricky to determine a threshold for cluster based tests (So David Says…)
Misc Commands
  • Outputs seen in the command window can also be saved for each test by adding 'output_file', 'name.txt'
GND=tmaxGND(GND, 15, 'time_wind', [90 790], 'n_perm', 2500, 'output_file', 'tmaxMatchMismatch.txt');
  • We can save a copy of any figure by doing so:
print -f7 -depsc ClusterRaster

Where the second argument is the figure window, the 3rd, is the file type (here eps) and the 4th is the name of the file.

  • All tests can be ran on a the mean of a time window by adding 'mean_wind', 'yes'
GND=tmaxGND(GND, 15, 'time_wind', [90 790], 'mean_wind', 'yes', 'n_perm', 2500, );
  • Finally, just like the we can call the significance raster by sig_raster(GND, bin); we can do so for the topographical plot like so:
sig_topo(GND, 15, 'units', 'uV'); %for voltage plot
sig_topo(GND, 15, 'units', 't'); %for t-scores
eeglabsesh3.txt · Last modified: 2014/10/08 03:14 (external edit)