Differences between revisions 6 and 7
Revision 6 as of 2011-05-31 12:47:21
Size: 4040
Comment:
Revision 7 as of 2011-05-31 12:49:47
Size: 4209
Comment:
Deletions are marked like this. Additions are marked like this.
Line 87: Line 87:
 1. Highpass filter (lines 14-15).  1. Highpass filter (lines 14-15). Highpass filtering may be beneficial to reduce the impact of drifts.
    But the choice of the filter has quite some impact on the ERPs, in particular, the later ERPs.


Documentation: Some Practical Examples of how to use the BBCI Toolbox


IN CONSTRUCTION


Table of Contents

  • ERP Analysis: #ERP-Aanylsis

  • Spectral Analyses: <to come>

  • <more to come>

ERP Analysis

   1 % Define some settings
   2 disp_ival= [-200 1000];
   3 ref_ival= [-200 0];
   4 crit_maxmin= 70;
   5 crit_ival= [100 800];
   6 crit_clab= {'F9,z,10','AF3,4'};
   7 clab= {'Cz','PO7'};
   8 colOrder= [1 0 1; 0.4 0.4 0.4];
   9 
  10 file= 'VPibv_10_11_02/CenterSpellerMVEP_VPibv';
  11 [cnt, mrk, mnt]= eegfile_loadMatlab(file);
  12 
  13 % Apply highpass filter to reduce drifts
  14 b= procutil_firlsFilter(0.5, cnt.fs);
  15 cnt= proc_filtfilt(cnt, b);
  16   
  17 % Artifact rejection based on variance criterion
  18 mrk= reject_varEventsAndChannels(cnt, mrk, disp_ival, 'verbose', 1);
  19 
  20 % Segmentation
  21 epo= cntToEpo(cnt, mrk, disp_ival);
  22   
  23 % Artifact rejection based on maxmin difference criterion on frontal chans
  24 epo= proc_rejectArtifactsMaxMin(epo, crit_maxmin, ...
  25             'clab',crit_clab, 'ival',crit_ival, 'verbose',1);
  26 
  27 % Baseline subtraction, and calculation of a measure of discriminability
  28 epo= proc_baseline(epo, ref_ival);
  29 epo_r= proc_r_square_signed(epo);
  30 
  31 % Select some discriminative intervals, with constraints to find N2, P2, P3 like components.
  32 fig_set(1);
  33 constraint= ...
  34       {{-1, [100 300], {'I#','O#','PO7,8','P9,10'}, [50 300]}, ...
  35        {1, [200 350], {'P3-4','CP3-4','C3-4'}, [200 400]}, ...
  36        {1, [400 500], {'P3-4','CP3-4','C3-4'}, [350 600]}};
  37 [ival_scalps, nfo]= ...
  38     select_time_intervals(epo_r, 'visualize', 1, 'visu_scalps', 1, ...
  39                           'title', untex(file), ...
  40                           'clab',{'not','E*'}, ...
  41                           'constraint', constraint);
  42 printFigure('r_matrix', [18 13], opt_fig);
  43 ival_scalps= visutil_correctIvalsForDisplay(ival_scalps, 'fs',epo.fs);
  44 
  45 fig_set(3)
  46 H= grid_plot(epo, mnt, defopt_erps, 'colorOrder',colOrder);
  47 grid_addBars(epo_r, 'h_scale',H.scale);
  48 printFigure(['erp'], [19 12], opt_fig);
  49 
  50 fig_set(2);
  51 H= scalpEvolutionPlusChannel(epo, mnt, clab, ival_scalps, defopt_scalp_erp2, ...
  52                              'colorOrder',colOrder);
  53 grid_addBars(epo_r);
  54 printFigure(['erp_topo'], [20  4+5*size(epo.y,1)], opt_fig);
  55 
  56 fig_set(4, 'shrink',[1 2/3]);
  57 scalpEvolutionPlusChannel(epo_r, mnt, clab, ival_scalps, defopt_scalp_r2);
  58 printFigure(['erp_topo_r'], [20 9], opt_fig);

Even in this very basic ERP analysis, there are several steps, in which the choice of processing can have quite a big impact on the results, but nevertheless, the correct choice is not clear to us (maybe we will find out a recommendable choice at some point).

  1. Highpass filter (lines 14-15). Highpass filtering may be beneficial to reduce the impact of drifts.
    • But the choice of the filter has quite some impact on the ERPs, in particular, the later ERPs.

      Alternatives are proc_subtractMovingAverage(cnt, 1500, 'centered', 'sinus'), other highpass filters, or no highpass filtering at all. Also bandpass filtering is an alternative (e.g. [0.5 30]), but typically the lowpass filtering is not required since high frequency are dampened also by the normal ERP averaging across trials.

  2. Baseline correction (line 28). For the ERP themselves the choice of baseline correction does not matter.
    • They stay the same. But for the measure for discriminability (e.g. r^2-values) it may have a big impact. In this example, baseline correction is performed on a trialwise basis. This way it is done for online experiments. For the ERP analysis this may be have the disturbing consequency, that the r^2-values in/near the baseline interval can become spuriously high, since the trial-to-trial variance is artificially reduced. Alternatives are to subtract the across-trials

      average of the baseline (option 'trialwise',0 in proc_baseline) or to subtract the classwise average of the baseline (option 'classwise',1 in proc_baseline).

  3. Measure for discriminability (line 29). Choices are, e.g., signed r^2, t-values, p-values, AUC-score.

IDA Wiki: IDA/BerlinBCI/ToolBox/ToolboxPracticalExamples (last edited 2013-11-06 15:46:45 by BenjaminBlankertz)