Published on *elan* (http://elan.lyon.inserm.fr)

*Description**Usage*- myeegfile.eeg : input EEG file to process (with extension).
- myposfile.pos : event position file.
- myparfile.par : parameter file, similar to that used for eegavg, but with some additional parameters.
- nb_drawings : number of drawings that are made to estimate the distribution of differences under the null hypothesis (example: 10000 drawings enables a resolution of p=0.0001).
*Fields of parameter file and example*

Performs a statistical randomization test without replacement between k conditions from single-trials stored in an EEG file. This program is very similar to eegranddiff [1]. It compares the sum of the first 2 conditions against the third condition.

eegrandadd myeegfile.eeg myposfile.pos myparfile.par nb_drawings

with :

fileprefix myfilename | Prefix of the output .p files. |

nb_eventcode 2 | Number of event codes to process. |

list_eventcode 2 5 | List of the event codes to process. |

prestim_nbsample 400 400 | List of the numbers of samples in the prestimulus period; one value for each event code. |

poststim_nbsample 800 800 | List of the numbers of samples in the poststimulus period; one value for each event code; the total number of samples of the analysis is prestim_nbsample + poststim_nbsample + 1, the extra sample corresponds to the event itself |

ep_channel_flag 1 1 0 1 0 0 0 | List of the channels to average: 1/0 for selected/unselected channels; the total number of flags is N+2, N being the number of recorded channels in myeegfile.eeg file; the last 2 flags should be set to 0. In this example, N=5, and only channels number 1, 2, 4 will be averaged and stored in the output .p files. |

ep_channel_ref 0 5 0 6 0 0 0 | List of the new reference for each channel before averaging (bipolar montage for instance): 0: no change of the reference, ≠0: electrode number (rank) to which the current channel should be re-referenced. The total number of values is N+2, N being the number of recorded channels in myeegfile.eeg file; the last 2 flags should be set to 0. This field is optional. If omitted, the channels are not modified. In this example, N=5, and channel 1 is unchanged, channel 2 is referenced to channel 5, and channel 4 re-referenced to channel 6. |

eegranddiff_baseline_eventcode 2 2 | List of the event codes used to compute the baseline. 0: no baseline correction (default), ≠0: event code on which baseline will be computed. In this example, the baseline for event code 2 will be computed from event code 2, and the baseline of event code 5 from event code 2. Warning: the event-code should be chosen among those listed in list_eventcodes. This field is optional. |

eegranddiff_baseline_msec_start -300 -300 | List of the baseline start latencies (in ms); one value for each event code; required only if baseline_eventcode≠0. If omitted and baseline_eventcode≠0, the baseline value is computed on the whole epoch. |

eegranddiff_baseline_msec_stop -100 -100 | List of the baseline stop latencies (in ms); one value for each event code; required only if baseline_eventcode≠0. If omitted and baseline_eventcode≠0, the baseline value is computed on the whole epoch. |

eegranddiff_time_hw 200 200 200 | List of the time half-windows (in ms) by event code, used to defined the moving time-window on which statistical analysis will be performed. If omitted, no smoothing is applied and computation is performed on each time-sample. |

eegranddiff_time_step 50 50 50 | List of the time steps (in ms) by event code, used to defined the moving step of the moving time-window on which statistical analysis will be performed. If omitted, the time step is one sample. |

eegranddiff_measure 1 | Statistic on which the permutation test will be made : 1: Sum of squared sums of values by conditions (two-sided test) 2: Sum of values in the first condition (one-sided test), valid only if k=2 conditions. If omitted, default value is 1. |

eegranddiff_compute 1 | Choice for multiple test correction : 0: no multiple test correction 1: multiple test correction based on the maximum number of consecutive samples 2: multiple test correction based on the minimum significance across samples 3: same as 2 across samples and channels If omitted, default value is 0 (no correction). |

eegranddiff_proba_measure 0.05 | If eegrandiff_compute = 1, statistical probability threshold for the determination of significant samples. |

eegranddiff_proba_compute 0.05 | If eegrandiff_compute ≥ 1, statistical probability threshold for the computation of consecutive significant sample. |

eegranddiff_compute_msec_start 50 | If eegrandiff_compute ≥ 1, start latency (in msec) of the analysis window for the correction across samples. |

eegranddiff_compute_msec_stop 50 | If eegrandiff_compute ≥ 1, stop latency (in msec) of the analysis window for the correction across samples. |

erpa_positivity_up 1 | Value stored in all output .p file to set the default upward/downward positivity orientation for curve display (by erpa). -1 (positivity down) or 1 (positivity up) This field is optional. If omitted, erpa will display curve with positivity down. |

erpa_view 4 | Value stored in all output .p file. It is used by erpa to set the default mapping view. 1: right view 2: left view 3: top view 4: back view 5: large top view 6: back-top view This field is optional. If omitted, it is set to 0, and erpa default will be top view. |

- See eegchref [2] to create a re-referenced .eeg data file (several referencing options available).

1.11 15-04-2011

- 1.01 30-06-2006 (JB) : 1st version, derived from eegranddiff v 2.01 .
- 1.02 02-07-2006 (JB) : fixes smoothing (compatible with eegstat).
- 1.03 03-07-2006 (JB) : fixes baseline correction.
- 1.04 05-07-2006 (JB) : adds compute_msec_start and compute_msec_stop to have independant analysis window and baseline window.
- 1.05 06-07-2006 (JB) : optimizes computing with copy of data out of permutations loop.
- 1.06 11-12-2006 (JB) : fixes bilateral statistic (see eegranddiff [1]).
- 1.07 24-01-2007 (JB) : fixes for event numbers. Adds unilateral test.
- 1.08 26-01-2007 (JB) : modifies decision for loading data to memory (if data size<= whole memory, not just available).
- 1.09 26-01-2007 (JB) : removes count of n_max out of window.
- 1.10 28-09-2010 (PEA) : update to use cmake and free release of Elan. Changes for parameter names : compute_msec_start and compute_msec_stop become eegranddiff_compute_msec_start and eegranddiff_compute_msec_stop. Changes for baseline parameters : baseline_eventcode, baseline_msec_start and baseline_msec_stop become eegranddiff_baseline_eventcode, eegranddiff_baseline_msec_start and eegranddiff_baseline_msec_stop.
- 1.11 15-04-2011 (PEA) : changes Shell sort to Heap sort in FDR (faster algorithm).

$ELANPATH/bin/eegrandadd

eegranddiff [3], eegstat [4], eegavg [5], eegchref [2]

**Links:**

[1] http://elan.lyon.inserm.fr/?q=node/72

[2] http://elan.lyon.inserm.fr/?q=eegchref

[3] http://elan.lyon.inserm.fr/?q=eegranddiff

[4] http://elan.lyon.inserm.fr/?q=eegstat

[5] http://elan.lyon.inserm.fr/?q=eegavg