**Description****Usage***myeegfile*: input**.eeg**file to process (with extension).**.eeg***myposfile*: input event file (with extension).**.pos***myparfile*: text parameter file (with extension), similar to that used for eegavg, but with some additional parameters.**.par****Fields of parameter file and examples****Example****Comments**- eegstat_kruskal_modified : This option allows, for instance, to compare each position in time in an active condition (related to event code #2) to a resting state defined by the mean value computed in a given time-window (related to event code #1).
- eegstat_flag_fdr : This option allows to compute the False Detection Rate statistics after a Wilcoxon or a Kruskal-Wallis test. This is a possible solution for multiple testing problem. See: Genovese, C. R., N. A. Lazar, et al. (2002). "Thresholding of statistical maps in functional neuroimaging using the false discovery rate." Neuroimage 15(4): 870-8.
- See eegchref to create a re-referenced .eeg data file (several referencing options available).
**Current version****History**- 1.12 25-08-2005 (PEA) : modification for time window : same as eegranddiff.
- 1.13 07-02-2006 (PEA) : correction in baseline computation.
- 1.14 08-02-2006 (PEA) : adds computation on all samples : eegstat_time_hw and eegstat_time_step become optional. If omitted, computation is done on all samples.
- 1.15 18-04-2006 (OB) : correction for exact time window values (not rounded to 1 msec anymore). The output sampling step is exactly the one given as parameter with eegstat_time_step.
- 1.16 13-08-2008 (PEA) : minor modification.
- 1.17 09-09-2008 (PEA) : adds kruskal_wallis_modified case : for 2 event types, the baseline is defined in the first event type window. Adds the following fields to the parameter file :

eegstat_kruskal_modified (optional : value 1 or 0, 0 if omitted) : if 1, Kruskal-Wallis is computed as defined above.

eegstat_kruskal_modified_baseline_beg_msec (required only if eegstat_kruskal_modified=1) : beginning (in msec) of the baseline.

eegstat_kruskal_modified_baseline_end_msec (required only if eegstat_kruskal_modified=1) : end (in msec) of the baseline.

Adds masking with FDR result and creation of new output files (.Z.fdr.p (Wilcoxon) ou .H.fdr.p (Kruskal-Wallis)). Adds the following fields to the parameter file :

eegstat_flag_fdr (optional : value 1 or 0, 0 if omitted) : if 1, FDR is computed.

eegstat_threshold_fdr (required only if eegstat_flag_fdr=1) : probability (p) threshold value to be used for masking the statistical results (Z or H) by the thresholded FDR statistics. - 1.18 14-10-2009 (PEA) : correction baseline computation (Kruskal-Wallis).
- 1.19 23-09-2010 (PEA) : update to use cmake and free release of Elan.
- 1.20 15-04-2011 (PEA) : changes Shell sort to Heap sort in FDR (faster algorithm).
- 1.21 07-10-2011 (PEA) : adds test for at least 2 samples to test in Wilcoxon test.
- 1.22 17-07-2012 (PEA) : fixes an error in wilcox function of libstat when all samples are ties.
- 1.23 21-03-2013 (PEA) : fixes an error of parameter file reading for eegstat_time_hw and eegstat_time_step parameters when working on all samples.
- 1.24 10-04-2014 (PEA) : fixes memory desallocation in parameter reading. Fixes output FDR filename creation for Kruskal-Wallis.
**Files****See also**

Performs a statistical analysis from single-trials stored in an * .eeg* file. Two statistical tests are proposed on the signal values averaged over moving time-windows.

- a Wilcoxon test (non-parametric paired comparison) for the detection of an emerging 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 responses across different event codes.

This program creates

*files representing the statistical values (Z for Wilcoxon, H for Kruskal-Wallis and their related probability values p) computed for each channel over each moving window. They can be viewed by erpa as curve plots.*

**.p****eegstat** *myeegfile .eeg myposfile.pos myparfile.par*

with :

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

nb_eventcode 3 | Number of event codes to process. |

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

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

poststim_nbsample 800 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. |

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. |

eegstat_type_stat 2 | Type of statistical analysis based on single-trial data: 1: Wilcoxon test on each moving time-window with respect to a baseline period 2: Kruskal-Wallis test on each moving time-window between the different event codes. |

eegstat_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 the value is 0, the analysis is performed on single point. If omitted, all time points are considered in the analysis. |

eegstat_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. Optional if eegstat_time_hw is omitted. |

eegstat_baseline_start -300 -300 -300 | List of the baseline start latencies (in ms) by event code. Required when eegstat_type_stat=1 (Wilcoxon test) or when eegstat_type_stat=2 and eegstat _baseline_flag=1. If omitted, the start latency is the first point of the pre-stimulus baseline defined by prestim_nbsample. |

eegstat_baseline_stop -100 -100 -100 | List of the baseline end latencies (in ms) by event code. Required when eegstat_type_stat=1 (Wilcoxon test) or when eegstat_type_stat=2 and eegstat _baseline_flag=1. If omitted, the start latency is the first point of the pre-stimulus baseline defined by prestim_nbsample. |

eegstat_baseline_flag 1 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. |

eegstat_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 *.p 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). This field is optional. If omitted, the default value is 0. |

eegstat_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 thresholded FDR statistics. |

eegstat_kruskal_modified 0 | In case of Kruskal-Wallis test with 2 conditions (2 event codes), this flag allows to indicate that all windows related to event code #2 is compared to a baseline window related to event code #1. For the definition of the baseline, see eegstat_kruskal_modified_baseline_beg_msec and eegstat_kruskal_modified_baseline_end_msec. 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 This field is optional. If omitted, the default value is 0. |

eegstat_kruskal_modified_baseline_beg_msec -300 | To be used if eegstat_kruskal_modified = 1. Latency of the beginning of the baseline period (in msec) relative to event code #1. |

eegstat_kruskal_modified_baseline_end_msec -50 | To be used if eegstat_kruskal_modified = 1. Latency of the end of the baseline period (in msec) relative to event code #1. |

In the example above, all trials with codes 2, 5 and 8 will be processed on a time window ranging from from 400 samples prior to 1000 samples after event code. The analysis will be performed on channels 1 (not re-referenced), 2 (re-referenced to channel 3),and 4 (re-referenced to channel 5). The statistical analysis is here a Kruskal-Wallis test between event codes 2, 5 and 8. On each trial, the data are averaged over a moving window having 200 ms of half duration (total duration of 400 ms), moving by step of 50 ms, and with a baseline correction defined between –300 and –100 ms.

Output files :

myfilename.2.wil.Z.p myfilename.5.wil.Z.p myfilename.8.wil.Z.p |
For the Wilcoxon test: p files of the Z value of the Wilcoxon test for each event code (2, 5, 8). |

myfilename.2.wil.p.p myfilename.5.wil.p.p myfilename.8.wil.p.p |
For the Wilcoxon test: p files of the probability value (p) of the Wilcoxon test for each event code. |

myfilename.2.5.8.kw.H.p | For the Kruskal-Wallis test: p files of the H value of the Kruskal-Wallis test computed on the 3 event codes (2, 5, 8) |

myfilename.2.5.8.kw.p.p | For the Kruskal-Wallis test: p files of the probability value (p) of the Kruskal-Wallis test computed on the 3 event codes (2, 5, 8) |

myfilename.2.Z.fdr.p | For the Wilcoxon test: p files of the Wilcoxon Z value masked by the thresholded probability value (p) of the FDR procedure. |

myfilename.2.5.8.H.fdr.p | For the Kruskal-Wallis test: p files of the Kruskal-Wallis H value masked by the thresholded probability value (p) of the FDR procedure. |

**Warning : **no control of the compatibility of the prestim/post-stim duration and the baseline for statistics is performed. Incorrect results in case of a too long baseline.

1.24 10-04-2014

$ELANPATH/bin/eegstat

- Printer-friendly version
- Login to post comments
- PDF version