Tutorial 26: Statistics

[TUTORIAL UNDER DEVELOPMENT: NOT READY FOR PUBLIC USE]

Authors: Francois Tadel, Elizabeth Bock, Dimitrios Pantazis, Richard Leahy, Sylvain Baillet

In this auditory oddball experiment, we would like to test for the significant differences between the brain response to the deviant beeps and the standard beeps, time sample by time sample. Until now we have been computing measures of the brain activity in time or time-frequency domain. We were able to see clear effects or slight tendencies, but these observations were always dependent on an arbitrary amplitude threshold and the configuration of the colormap. With appropriate statistical tests, we can go beyond these empirical observations and assess what are the significant effects in a more formal way.

Random variables

In most cases we are interested in comparing the brain signals recorded for two populations or two experimental conditions A and B.

A and B are two random variables for which we have a limited number of repeated measures: multiple trials in the case of a single subject study, or multiple subject averages in the case of a group analysis. To start with, we will consider that each time sample and each signal (source or sensor) is independent: a random variable represents the possible measures for one sensor/source at one specific time point.

A random variable can be described with its probability distribution: a function which indicates what are the chances to obtain one specific measure if we run the experiment. By repeating the same experiment many times, we can approximate this function with a discrete histogram of observed measures.

stat_distribution.gif stat_histogram.gif

Histograms

You can plot histograms like this one in Brainstorm, it may help you understand what you can expect from the statistics functions described in the rest of this tutorial. For instance, seeing a histogram computed with only 4 values would discourage you forever from running a group analysis with 4 subjects...

Recordings

Sources (relative)

Sources (absolute)

Sources (norm)

Time-frequency

Group studies: different distributions

Statistical inference

Hypothesis testing

To show that there is a difference between A and B, we can use a statistical hypothesis test. We start by assuming that the two sets are identical then reject this hypothesis. For all the tests we will use here, the logic is similar:

Evaluation of a test

The quality of test can be evaluated based on two criteria:

Different categories of tests

Two families of tests can be helpful in our case: parametric and non-parametric tests.

Parametric Student's t-test

Assumptions

The Student's t-test is a widely-used parametric test to evaluate the difference between the means of two random variables (two-sample test), or between the mean of one variable and one known value (one-sample test). If the assumptions are correct, the t-statistic follows a Student's t-distribution.

The main assumption for using a t-test is that the random variables involved follow a normal distribution (mean: μ, standard deviation: σ). The figure below shows a few example of normal distributions.

t-statistic

Depending on the type of data we are testing, we can have different variants for this test:

p-value

Once the t-value is computed (tobs in the previous section), we can convert it to a p-value based on the known distributions of the t-statistic. This conversion depends on two factors: the number of degrees of freedom and the tails of the distribution we want to consider. For a two-tailed t-test, the two following commands in Matlab are equivalent and can convert the t-values in p-values.
To obtain the p-values for a one-tailed t-test, you can simply divide the p-values by 2.

p = betainc(df./(df + t.^2), df/2, 0.5);    % Without the Statistics toolbox
p = 2*(1-tcdf(abs(t),df));                  % With the Statistics toolbox

The distribution of this function for different numbers of degrees of freedom:

Example 1: Parametric t-test on recordings

Parametric t-tests require the values tested to follow a normal distribution. The recordings evaluated in the histograms sections above (MLP57/160ms) show distributions that are matching this assumption relatively well: the shape of the histogram follows the trace of the corresponding normal function, and with very similar variances. It looks reasonable to use a parametric t-test in this case.

Correction for multiple comparisons

Multiple comparison problem

The approach described in this first example performs many tests simultaneously. We test, independently, each MEG sensor and each time sample across the trials, so we run a total of 274*361 = 98914 t-tests.

If we select a critical value of 0.05 (p<0.05), it means that we want to see what is significantly different between the conditions while accepting the risk of observing a false positive in 5% of the cases. If we run the test around 100,000 times, we can expect to observe around 5,000 false positives. We need to better control for false positives (type I errors) when dealing with multiple tests.

Bonferroni correction

The probability to observe at least one false positive, or familywise error rate (FWER) is almost 1:
FWER = 1 - prob(no significant results) = 1 - (1 - 0.05)^100000 ~ 1

A classical way to control the familywise error rate is to replace the p-value threshold with a corrected value, to enforce the expected FWER. The Bonferroni correction sets the significance cut-off at $$\alpha$$/Ntest. If we set (p ≤ $$\alpha$$/Ntest), then we have (FWER ≤ $$\alpha$$). Following the previous example:
FWER = 1 - prob(no significant results) = 1 - (1 - 0.05/100000)^100000 ~ 0.0488 < 0.05

This works well in a context where all the tests are strictly independent. However, in the case of MEG/EEG recordings, the tests have an important level of dependence: two adjacent sensors or time samples often have similar values. In the case of highly correlated tests, the Bonferroni correction tends too be conservative, leading to a high rate of false negatives.

FDR correction

The false discovery rate (FDR) is another way of representing the rate of type I errors in null hypothesis testing when conducting multiple comparisons. It is designed to control the expected proportion of false positives, while the Bonferroni correction controls the probability to have at least one false positive. FDR-controlling procedures have greater power, at the cost of increased rates of Type I errors (Wikipedia)

In Brainstorm, we implement the Benjamini–Hochberg step-up procedure for FDR correction:

In the interface

stat_mcp_gui.gif

You can select interactively the type of correction to apply for multiple comparison while reviewing your statistical results. The checkboxes "Control over dims" allow you to select which are the dimensions that you consider as multiple comparisons (1=sensor, 2=time, 3=not applicable here). If you select all the dimensions, all the values available in the file are considered as the same repeated test, and only one corrected p-threshold is computed for all the time samples and all the sensors.

If you select only the first dimension, only the values recorded at the same time sample are considered as repeated tests, the different time points are corrected independently, with one different corrected p-threshold for each time point.

When changing these options, a message is displayed in the Matlab command window, showing the number of repeated tests that are considered, and the corrected p-value threshold (or the average if there are multiple corrected p-thresholds, when not all the dimensions are selected):

BST> Average corrected p-threshold: 5.0549e-07  (Bonferroni, Ntests=98914)
BST> Average corrected p-threshold: 0.00440939  (FDR, Ntests=98914)

Nonparametric permutation tests

Principle

A permutation test (or randomization test) is a type of test in which the distribution of the test statistic under the null hypothesis is obtained by calculating all possible values of the test statistic under rearrangements of the labels on the observed data points. (Wikipedia)

If the null hypothesis is true, the two sets of tested values A and B follow the same distribution. Therefore the values are exchangeable between the two sets: we can move one value from set A to set B, and one value from B to A, and we expect to obtain the same value for the test statistic T.

By taking all the possible permutations between sets A and B and computing the statistic for each of them, we can build a histogram that approximates the permutation distribution.

Then we compare the observed statistic with the permutation distribution. From the histogram, we calculate the proportion of permutations that resulted in a larger test statistic than the observed one. This proportion is called the p-value. If the p-value is smaller than the critical value (typically 0.05), we conclude that the data in the two experimental conditions are significantly different.

The number of possible permutations between the two sets of data is usually too large to compute an exhaustive permutation test in a reasonable amount of time. The permutation distribution of the statistic of interest is approximated using a Monte-Carlo approach. A relatively small number of random selection of possible permutations can give us a reasonably good idea of the distribution.

Permutation tests can be used for any test statistic, regardless of whether or not its distribution is known. The hypothesis is about the data itself, not about a specific parameter. In the examples below, we use the t-statistic, but we could use any other function.

Practical limitations

Computation time: If you increase the number of random permutations you use for estimating the distribution, the computation time will increase linearly. You need to find a good balance between the total computation time and the accuracy of the result.

Memory (RAM): The implementations of the permutation tests available in Brainstorm require all the data to be loaded in memory before starting the evaluation of the permutation statistics. Running this function on large datasets or on source data could quickly crash your computer. For example, loading the data for the non-parametric equivalent to the parametric t-test we ran previously would require:
276(sensors) * 461(trials) * 361(time) * 8(bytes) / 1024^2(Gb) = 0.3 Gb of memory.

This is acceptable on most recent computers. But to perform the same at the source level, you need:
45000*461*361*8/1024^3 = 58 Gb of memory just to load the data. This is impossible on most computers, we have to give up at least one dimension and run the test only for one region of interest or one time sample (or average over a short time window).

FieldTrip implementation

FieldTrip functions in Brainstorm

We have the possibility to call some of the FieldTrip toolbox functions from the Brainstorm environment. For this, you need first to install the FieldTrip toolbox on your computer and add it to your Matlab path.

Cluster-based correction

One interesting method that has been promoted by the FieldTrip developers is the cluster-based approach for non-parametric tests. In the type of data we manipulate in MEG/EEG analysis, the neighbouring channels, time points or frequency bins are expected to show similar behavior. We can group these neighbours into clusters to "accumulate the evidence". A cluster can have a multi-dimensional extent in space/time/frequency.

In the context of a non-parametric test, the test statistic computed at each permutation is the extent of the largest cluster. To reject or accept the null hypothesis, we compare the largest observed cluster with the randomization distribution of the largest clusters.

This approach solves the multiple comparisons problem, because the test statistic that is used (the maximum cluster size) is computed using all the values at the same time, along all the dimensions (time, sensors, frequency). There is only one test that is performed, so there is no multiple comparisons problem.

The result is simpler to report but also a lot less informative than FDR-corrected non-parametric tests. We have only one null hypothesis, "the two sets of data follow the same probability distribution", and the outcome of the test is to accept or reject this hypothesis. Therefore we cannot report the spatial or temporal extent of the most significant clusters. Make sure you read this recommendation before reporting cluster-based results in your publications.

Reference documentation

For a complete description of non-parametric cluster-based statistics in FieldTrip, read the following:

Process options

There are three separate processes in Brainstorm, to call the three FieldTrip functions.

Test statistic options (process options in bold):

Cluster-based correction:

Input options: All the data selection is done before, in the process code and functions out_fieldtrip_*.m.

Example 2: Uncorrected non-parametric t-test

Let's run the non-parametric equivalent to the test we ran in the first example.

Example 3: Cluster-based test

Run again the same test, but this time select the cluster correction.

Example 4: Non-parametric t-test on sources

To reproduce the same results at the source level, we need to limit the data we are looking at, alternatively the amount of data that has to be loaded to run the non-parametric tests will not fit in memory. Here we average a short time window during which we observed major differences (150-170ms).

Issues with unconstrained sources

Scouts and statistics

Example 5: Non-parametric t-test on scouts

The previous example was showing how to get rid of one dimension buy restricting the analysis to one averaged time window. Alternatively, we can keep the time dimension and run the test only on the regions of interest.

Advanced

Example 6: Non-parametric t-test on time-frequency maps [TODO]

Two run a test on time-frequency maps, first you need to have all the time-frequency files available in the database, for each individual trials. In the time-frequency tutorial, we saved only the averaged time-frequency decompositions of all the trials.

Now delete the TF decomposition for the individual trials (because it probably uses a lot of disk space):

Advanced

Workflow: Single subject

For one unique subject, test for significant differences between two experimental conditions:

Sensor recordings:

Constrained source maps (one value per vertex):

Unconstrained source maps (three values per vertex):

Time-frequency maps:

Advanced

Workflow: Group analysis [TODO]

Subject averages

You need first to process the data separately for each subject:

  1. Compute the subject-level averages, using the same number of trials for each subject.
    Sources: Average the non-normalized minimum norm maps (current density maps, no Z-score).

  2. Sources and time-frequency: Normalize the data to bring the different subjects to the same range of values (Z-score normalization with respect to a baseline - never apply an absolute value here).

  3. Sources computed on individual brains: Project the individual source maps on a template (see the coregistration tutorial). Not needed if the sources were estimated directly on the template anatomy.
    Note: We evaluated the alternative order (project the sources and then normalize): it doesn't seem to be making a significant difference. It's more practical then to normalize at the subject level before projecting the sources on the template, so that we have normalized maps to look at for each subject in the database.

  4. Constrained sources: Smooth spatially the sources, to make sure the brain responses are aligned. Problem: This is only possible after applying an absolute value, smoothing in relative values do not make sense, as the positive and negative signals and the two sides of a sulcus would cancel out. [TODO]

Group statistic

Two group analysis scenarios are possible:

Paired tests

Workflow: Current problems [TODO]

The following inconsistencies are still present in the documentation. We are actively working on these issues and will update this tutorial as soon as we found solutions.

Advanced

Convert statistic results to regular files

Apply statistic threshold

You can convert the results computed for a statistic test to a regular file. This can be useful because lots of menus and processes are not accessible for the files with the "stat" tag display on top of their icon.

Simulate recordings from these scouts

Advanced

Export to SPM

An alternative to running the statistical tests in Brainstorm is to export all the data and compute the tests with an external program (R, Matlab, SPM, etc). Multiple menus exist to export files to external file formats (right-click on a file > File > Export to file).

Two tutorials explain to export data specifically to SPM:

Advanced

On the hard drive

Right click one of the first test we computed in this tutorial > File > View file contents.

Description of the fields

Useful functions

Advanced

References

Advanced

Additional documentation

Delete all your experiments

Before moving to the next tutorial, delete all the statistic results you computed in this tutorial. It will make the database structure less confusing for the following tutorials.








Feedback: Comments, bug reports, suggestions, questions
Email address (if you expect an answer):


Tutorials/Statistics (last edited 2016-01-13 20:50:46 by FrancoisTadel)