Skip to main content
  • Description
  • Performs a statistical randomization test between several paired groups (conditions) of ep files (*.p). The output is a statistical *.p file
    This program basically creates a .rand.p.p file representing the probability values p that the actual difference between two conditions is found by chance (the distribution of differences under the null hypothesis is estimated by randomly permuting conditions), independently computed for each channel over each moving window. They can be viewed by erpa as curve plots.

    Optionally, this program can take into account the number of samples of the window of analysis and correct for multiple tests in different ways:
    - The minimum number of consecutive significant samples (at a given probability threshold proba_measure) appearing in permutations with a given probability threshold proba_compute is computed independently for each channel (i.e. the maximum number of significant samples appearing with a given probability under the null hypothesis).
    - The maximum significance probability appearing in permutations with a given probability threshold proba_compute (i.e. the minimum significance probability appearing with a given probability under the null hypothesis) is computed across samples (i.e. independently for each channel) or accross channels and electrodes.
    The output files for these options are 2 statistical .p files (uncorrected and corrected) and a .txt file including the correction value for each channel.

  • Usage
  • epranddiff myparfile.par mycondfile.cond nb_permut
    with :

    • myparfile.par : parameter file (with extension).
    • mycondfile.cond : ascii file including the list of .p to process (with extension).
    • nb_permut : number of permutations that are made to estimate the distribution of differences under the null hypothesis (example: 10000 drawings enables a resolution of p=0.001).


  • Fields of parameter file and example
  • fileprefix myfilename Prefix of the output .p files.
    eprand_channel_flag 1 1 0 1 0 List of the channels to process: 1/0 for selected/unselected channels.
    In this example, N=5, and only channels number 1, 2, 4 will be processed.
    eprand_time_hw 10 Time half-window (in ms), used to define the moving time-window on which statistical analysis will be performed.
    eprand_time_step 5 Time step (in ms), used to define the moving step of the moving time-window on which statistical analysis will be performed.
    eprand_normalization 1 Normalization type. Possible values are :
    0: no normalization
    1: for each subject, each sample is divided by the norm of the vector in channel  condition space
    2: for each subject and each condition, each sample is divided by the norm of the vector in channel space
    3: for each condition and sample, each sample is divided by the norm of the mean vector (across subjects) in channel space
    4, 5, 6: same as 1, 2, 3 except that the maximum norm in the analysis time-window is taken
    eprand_measure 2 Statistic on which the permutation test will be made
    0: Sum of squared Student T across electrodes
    1: Sum of squared sums of values by conditions (two-sided test)
    2: Sum of values in the first condition (one-sided test)
    eprand_compute 1 0: no multiple test correction
    1: multiple test correction on the minimum consecutive samples
    2: multiple test correction on the maximum significance across samples
    3: same as 2 across samples and channels
    eprand_lat_beg_ms 100 Start latency of the window in which the test will be performed (in milliseconds).
    eprand_lat_end_ms 300 End latency of the window in which the test will be performed (in milliseconds).
    eprand_proba_measure 0.01 Statistical probability threshold for the computation of significant samples when eprand_compute is set to 1.
    eprand_proba_compute 0.05 Statistical probability threshold for the computation of the minimumnumber of consecutive significant sample when eprand_compute is set to 1 or the maximum probability when eprand_compute is set to or 3.

    The condition file is a text file formatted as follow:

    Parameter (example) Comment
    1 2 4 Number of factors (must be 1).
    Number of conditions for this factor (must be 2).
    Number of .p files for each condition.
    fact1 cond1 suj1 Myfile_cond1_suj1.p
    fact1 cond1 suj2 Myfile_cond1_suj2.p
    fact1 cond1 suj3 Myfile_cond1_suj3.p
    fact1 cond1 suj4 Myfile_cond1_suj4.p
    fact1 cond2 suj1 Myfile_cond2_suj1.p
    fact1 cond2 suj2 Myfile_cond2_suj2.p
    fact1 cond2 suj3 Myfile_cond2_suj3.p
    fact1 cond2 suj4 Myfile_cond2_suj4.p
    List of .p files preceded by the following labels:
    name of the factor
    name of the condition
    name of the subject
    name of the .p file
    Each file in condition 1 has its paired file in condition 2.
    For one-sided tests, the condition with the predicted most positive mean must be placed first.


  • Examples
  • In the above example, two paired groups of 4 files are compared. They will be processed on a time window ranging from 100 ms post-stimulus to 300 ms post-stimulus. The analysis will be performed on the sum of values in condition one averaged over a moving window having 10 ms of half duration (total duration of 20 ms), moving by step of 5 ms, on channels 1, 2 and 4. As correction for multiple comparison is on, the minimum number of consecutive significant (with p = 0.01) samples appearing with a probability of 0.05 across permutations will be computed.
    The output files are :

    Name Comments
    myfilename.rand.p.p p file of the p values of the randomization test.
    myfilename.n_max.txt For the multiple-test correction across samples.
    List of the maximum number of successive significant samples n_max (or the minimum probability p_min) under the null hypothesis for each channel when eprand_compute is set to 1 or 2.
    myfilename.rand.mask.p.p For the multiple-test correction.
    Only p values included in a succession of samples that is above the computed minimum number of significant samples (or smaller than the p_min value) are kept. The other samples are set to p=1.


  • Comments
    1. All ep files should be compatible (in terms of number of channels and samples, number of pre-stimulus samples, sampling frequency) to the first ep file (file 1 in condition 1).


  • Current version
  • 2.18 15-04-2011

  • History
    • 1.00 24-04-2003 (PEA) : 1st version.
    • 1.01 09-11-2004 (PEA) : minor modification.
    • 1.02 25-01-2005 (PEA) : minor modification.
    • 1.04 02-05-2005 (PEA) : adds shell sort. Major modifications.
    • 1.05 02-07-2005 (PEA) : minor modification.
    • 1.06 09-08-2005 (PEA) : adds eprand_compute=2.
    • 1.07 09-08-2005 (PEA) : fixes error.
    • 1.08 06-03-2006 (JB) : adds correction for multiple test for topographical test (eprand_measure=0), and fixes error for probability if eprand_compute=1.
    • 2.01 13-03-2006 (JB) : adds eprand_measure=5 (sum of values of condition 1).
    • 2.02 15-03-2006 (JB) : adds eprand_measure=6 (sum of squared condition sums).
    • 2.03 15-03-2006 (JB) : modifies unilateral tests (eprand_measure = 1,2,5) : the user must specify the condition with the largest mean by putting it in 1st rank in the .cond conditions file.
    • 2.05 18-03-2006 (JB) : adds minimum of significativity for samples. Integrates T2 sum to general case.
    • 2.06 19-03-2006 (JB) : adds minimum of significativity for channels x samples.
    • 2.07 19-03-2006 (JB) : modifies eprand_measure field : 0=topographical test, 1=bilateral test, 2=unilateral test.
    • 2.08 21-03-2006 (JB) : includes conditions in permutations.
    • 2.09 21-03-2006 (JB) : adds normalization.
    • 2.10 24-03-2006 (JB) : adds normalization with vector of maximum of analysis window.
    • 2.12 28-03-2006 (JB) : enhances correction of minimum significativity algorithm.
    • 2.13 29-03-2006 (JB) : normalizes subsampled values.
    • 2.14 30-03-2006 (JB) : fixes error when few number of permutations, and subsampling.
    • 2.15 18-05-2006 (JB) : adds check for file compatibility.
    • 2.16 13-12-2006 (JB) : fixes error (rounded value) of time step and half-window size.
    • 2.17 29-09-2010 (PEA) : updates to use cmake and free release of Elan.
    • 2.18 15-04-2011 (PEA) : removes static allocation for reading and writing EP file. Changes Shell sort to Heap sort in FDR (faster algorithm).


  • Files
  • $ELANPATH/bin/epranddiff

  • See also
  • eegranddiff