Performs a statistical analysis of the time-frequency representation of single-trials computed from an .eeg file. Two statistical tests are proposed on the TF power averaged over regions of interest defined in the time-frequency domain.
- a Wilcoxon test (non-parametric paired comparison) for the detection of an emerging TF component with respect to a baseline period. The test is performed indepedantly for each event code and each channel.
- a Kruskal-Wallis test (one-way analysis of variance by ranks) for the statistical comparison of the time-frequency activities across different event codes.
The region of interest is defined by its size and a moving step (in Hz x ms) to cover the whole time-frequency domain. This program creates .tf files representing the statistical values (Z for Wilcoxon, H for Kruskal-Wallis and their related probability values p) computed in each time-frequency window. They can be viewed by tfviz as time-frequency plots.
The False Detection Rate (FDR) procedure is also possible on the Wilcoxon or Kruskal-Wallis statistical results (see comments).
tfstat myeegfile.eeg myeventfile.pos myparfile.par
with :
fileprefix myfilename | Prefix of the output TF 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 1000 1000 | 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. |
tf_channel_flag 1 1 0 1 0 0 0 | List of the channels to process: 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 processed. |
tf_channel_ref 0 3 0 5 0 0 0 | List of the new reference for each channel before processing (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 myfile.eeg file; the last 2 flags should be set to 0. If omitted, the channels are not modified. In this example, N=5, and channel 1 is unchanged, channel 2 is referenced to channel 3, and channel 4 re-referenced to channel 5. |
tf_freq_start 10 10 | List of the starting frequencies (in Hz) for the time-frequency analysis (one value for each event code). |
tf_freq_stop 80 80 | List of the ending frequencies (in Hz) for the time-frequency analysis (one value for each event code). |
tf_freq_step 2 2 | List of the frequency steps (in Hz) for the time-frequency analysis (one value for each event code). |
tf_nb_sample_blackman 100 100 | List of the number of samples in the rise or fall time period of the blackman window applied on the single trials before the wavelet transform (one value for each event code). |
tf_wavelet_type 1 1 | List of the types of wavelet used for the time-frequency analysis (one value for each event code): 1: Morlet wavelet. 2: Gabor wavelet. |
tf_morlet_m 7 7 | In case of Morlet wavelet, list of the m ratio used for the time-frequency analysis (one value for each event code): m=f0/sigmaf Suggested values for m: m>5, usually m=7. This determines the number of cycles of the wavelet. |
tf_gabor_sigmat 100 100 | In case of Gabor wavelet, list of the half-window durations of the wavelets (in msec) irrespective of the frequency band (one value for each event code). |
tf_type_stat 2 | Type of statistical analysis based on single-trial time-frequency regions of interest: 1: Wilcoxon test on each moving time-frequency region of interest with respect to a baseline period. 2: Kruskal-Wallis test on each moving time-frequency region of interest between the different event codes. |
tfstat_baseline_flag 1 1 | List of flags by event code for applying a baseline correction on single-trials prior to the Kruskal-Wallis test: 0: no baseline correction. 1: baseline correction applied. If omitted, the default value is 0. |
tfstat_freq_hw 10 10 | List of the frequency half-windows (in Hz) by event code, used to defined the moving time-frequency regions of interest on which statistical analysis will be performed. |
tfstat_freq_step 5 5 | List of the frequency steps (in Hz) by event code, used to define the moving step of the time-frequency regions of interest on which statistical analysis will be performed. |
tfstat_time_hw 200 200 | List of the time half-windows (in ms) by event code, used to define the moving time-frequency regions of interest on which statistical analysis will be performed. If = 0, then all time points are considered in the analysis. |
tfstat_time_step 50 50 | List of the time steps (in ms) by event code, used to defined the moving step of the time-frequency regions of interest on which statistical analysis will be performed. |
tfstat_baseline_start -300 -300 | List of the baseline start latencies (in ms) by event code. Required when tfstat_type_stat=1 (Wilcoxon test) or (tfstat_type_stat=2 and tfstat_baseline_flag=1). If omitted, the start latency is the first point of the pre-stimulus baseline defined by prestim_nbsample. |
tfstat_baseline_stop -100 -100 | List of the baseline end latencies (in ms) by event code. Required when tfstat_type_stat=1 (Wilcoxon test) or (tfstat_type_stat=2 and tfstat_baseline_flag=1). If omitted, the stop latency is 0 ms. |
tf_flag_log 0 | Statistical test on the power or the log of the power in the TF domain: 0: statistics on power 1: statistics on the log10 of the power. If omitted, the default value is 0. |
tfstat_flag_fdr 0 | Flag allowing to compute False Detection Rate (FDR) after the statistical test: 0: no FDR computation 1: FDR computation, and generation of a TF file with a mask of the statistical results (Z or H) with the computed FDR (see output files below). This requires a probability (p) threshold value (tfstat_threshold_fdr). If omitted, the default value is 0. |
tfstat_threshold_fdr 0.05 | To be used in case of tfstat_flag_fdr = 1. Defines the probability (p) threshold value to be used for masking the statistical results (Z or H) by the threshold FDR statistics. |
tfstat_kruskal_modified 0 | In case of Kruskal-Wallis test with 2 conditions (2 event codes), this flag allows to indicate that all TF windows related to event code #2 is compared to a baseline window related to event code #1. For the definition of the baseline, see tfstat_kruskal_modified_baseline_beg_msec and tfstat_kruskal_modified_baseline_end_msec. Possible values are: 0: standard case (no comparison of event code #2 to the baseline of even code #1) 1: comparison of event code #2 to the baseline of event code #1 If omitted, the default value is 0. |
tfstat_kruskal_modified_baseline_beg_msec -300 | To be used if tfstat_kruskal_modified = 1. Latency of the beginning of the baseline period (in msec) relative to event code #1. |
tfstat_kruskal_modified_baseline_end_msec -50 | To be used if tfstat_kruskal_modified = 1. Latency of the end of the baseline period (in msec) relative to event code #1. |
tf_substract_epfile ep.2.p ep.5.p | List of the EP file names with extension (.p) used for substracting an averaged response to each single trial prior to time-frequency computation (one string for each event code). These .p files should be compatible to the time-frequency analysis parameters (number of channels, number of samples pre and post-stimulus). If omitted, no .p file is substracted to the single trials. |
tfstat_wilcox_modified 0 | In case of Wilcoxon test with 2 conditions (2 event codes), this flag allows to indicate that all TF windows related to event code #2 is compared to a baseline window related to event code #1. Events must be paired. Possible values are: 0: standard case (no comparison of event code #2 to the baseline of even code #1) 1: comparison of event code #2 to the baseline of event code #1 If omitted, the default value is 0. |
In this example, all trials with codes 2 and 5 be processed with a time window ranging from 400 samples prior to 1000 samples after event code. The evoked potential read from respectively ep.2.p and ep.5.p are substracted to single trials. The time-frequency analysis will be performed on channels 1 (not re-referenced), 2 (re-referenced to channel 3),and 4 (re-referenced to channel 5), from 10 to 80 Hz by steps of 2 Hz with a Blackman window having 100 samples for the rise- and for the fall-time, and with Morlet wavelets with a m ratio set to 7. The statistical analysis is here a Kruskal-Wallis test between event codes 2, 5 and 8. On each trial, the time-frequency analysis is performed with a baseline correction defined between –300 and –100 ms and over a time-frequency region of interest of 20 Hz x 400 ms (2x10 Hz x 2x200 ms) moving by step of 5 Hz x 50 ms.
Output files :
Name | Comments# |
myfilename.2.wil.Z.tf myfilename.5.wil.Z.tf myfilename.8.wil.Z.tf |
For the Wilcoxon test: TF files of the Z value of the Wilcoxon test for each event code. |
myfilename.2.wil.p.tf myfilename.5.wil.p.tf myfilename.8.wil.p.tf |
For the Wilcoxon test: TF files of the probability value (p) of the Wilcoxon test for each event code. |
myfilename.2.5.8.KW.H.tf | For the Kruskal-Wallis test: TF file of the H value of the Kruskal-Wallis test computed on the 3 event codes (2, 5, 8). |
myfilename.2.5.8.KW.p.tf | For the Kruskal-Wallis test: TF file of the probability value (p) of the Kruskal-Wallis test computed on the 3 event codes (2, 5, 8). |
myfilename.2.Z.fdr.tf | For the Wilcoxon test: TF file of the Wilcoxon Z value masked by the thresholded probability value (p) of the FDR procedure. |
myfilename.2.5.8.H.fdr.tf | For the Kruskal-Wallis test: TF file of the Kruskal-Wallis H value masked by the thresholded probability value (p) of the FDR procedure. |
1.30 22-09-2014
$ELANPATH/bin/tfstat
tfavg [2]
Links:
[1] http://elan.lyon.inserm.fr/?q=eegstat
[2] http://elan.lyon.inserm.fr/?q=tfavg