POP_COMPERP Compute the grand average ERP waveforms of multiple datasets currently loaded into EEGLAB, with optional ERP difference-wave plotting and t-tests. Creates a plotting figure.


Usage: >> pop_comperp( ALLEEG, flag ); % pop-up window, interactive mode
>> [erp1 erp2 erpsub time sig] = pop_comperp( ALLEEG, flag, datadd, datsub, 'key', 'val', ...);

Inputs:
ALLEEG   
Array of loaded EEGLAB EEG structure datasets
flag   
[0|1] 0 -> Use ICA components; 1 -> use data channels {default: 1}
datadd   
[integer array] List of ALLEEG dataset indices to average to make an ERP grand average and optionally to compare with 'datsub' datasets.

Optional inputs:
datsub   
[integer array] List of ALLEEG dataset indices to average and then subtract from the 'datadd' result to make an ERP grand mean difference. Together, 'datadd' and 'datsub' may be used to plot and compare grand mean responses across subjects or conditions. Both arrays must contain the same

number of dataset indices and entries must be matched pairwise (Ex: 'datadd' indexes condition A datasets from subjects 1:n, and 'datsub',
condition B datasets from the same subjects 1:n). {default: []}
'alpha'   
[0 < float < 1] Apply two-tailed t-tests for p < alpha. If 'datsub' is not empty, perform t-tests at each latency. If 'datasub' is empty, perform two-tailed t-tests against a 0 mean dataset with same variance. Significant time regions are highlighted in the plotted data.
'chans'   
[integer array] Vector of chans. or comps. to use {default: all}
'geom'   
['scalp'|'array'] Plot erps in a scalp array (plottopo()) or as a rectangular array (plotdata()). Note: Only channels (see 'chans' above) can be plotted in a 'scalp' array.
'tlim'   
[min max] Time window (ms) to plot data {default: whole time range}
'title'   
[string] Plot title {default: none}
'ylim'   
[min max] y-axis limits {default: auto from data limits}
'mode'   
['ave'|'rms'] Plotting mode. Plot either grand average or RMS (root mean square) time course(s) {default: 'ave' -> grand average}.
'std'   
['on'|'off'|'none'] 'on' -> plot std. devs.; 'none' -> do not interact with other options {default:'none'}

Vizualisation options:
'addavg'   
['on'|'off'] Plot grand average (or RMS) of 'datadd' datasets {default: 'on' if 'datsub' empty, otherwise 'off'}
'subavg'   
['on'|'off'] Plot grand average (or RMS) of 'datsub' datasets {default:'off'}
'diffavg'   
['on'|'off'] Plot grand average (or RMS) difference
'addall'   
['on'|'off'] Plot the ERPs for all 'dataadd' datasets only {default:'off'}
'suball'   
['on'|'off'] Plot the ERPs for all 'datasub datasets only {default:'off'}
'diffall'   
['on'|'off'] Plot all the 'datadd'-'datsub' ERP differences {default:'off'}
'addstd'   
['on'|'off'] Plot std. dev. for 'datadd' datasets only {default: 'on' if 'datsub' empty, otherwise 'off'}
'substd'   
['on'|'off'] Plot std. dev. of 'datsub' datasets only {default:'off'}
'diffstd'   
['on'|'off'] Plot std. dev. of 'datadd'-'datsub' differences {default:'on'}
'diffonly'   
['on'|'off'|'none'] 'on' -> plot difference only; 'none' -> do not affect other options {default:'none'}
'allerps'   
['on'|'off'|'none'] 'on' -> show ERPs for all conditions; 'none' -> do not affect other options {default:'none'}
'tplotopt'   
[cell array] Pass 'key', val' plotting options to plottopo()

Output:
erp1   
Grand average (or rms) of the 'datadd' datasets
erp2   
Grand average (or rms) of the 'datsub' datasets
erpsub   
Grand average (or rms) 'datadd' minus 'datsub' difference
times   
Vector of epoch time indices
sig   
T-test significance values (chans,times).

Author: Arnaud Delorme, CNL / Salk Institute, 15 March 2003

Note: t-test functions were adapted for matrix preprocessing from C functions
by Press et al. See the description in the pttest() code below
for more information.

See also: eeglab(), plottopo()

See the matlab file pop_comperp.m (may require other functions)

Back to functions