Evoked analysis
Once preprocessing is complete, event-related analysis proceeds from condition averages (evoked responses) to group-level statistics. This section covers subject groups, loading evoked data, and mass-univariate tests.
Analysis workflow
With preprocessing completed, there are different options for analyzing the data.
The most flexible option is loading data from the desired processing stage using
one of the many .load_... methods of the Pipeline. For
example, load a eelbrain.Dataset with source-localized condition averages using
Pipeline.load_evoked() (with inv set for source space), then test a hypothesis using one of the
mass-univariate test from the testnd module. To make this kind of
analysis replicable, it is probably useful to write the complete analysis as a
separate script that imports the experiment (see the example experiment folder).
Many statistical comparisons can also be specified in the
Pipeline.tests attribute, and then loaded directly using the
Pipeline.load_test() method. This has the advantage that the tests
will be cached automatically and, once computed, can be loaded very quickly.
However, these definitions are not quite as flexible as writing a custom script.
Subject groups
- Pipeline.groups
A subject group called 'all' containing all subjects is always implicitly
defined. Additional subject groups can be defined in
Pipeline.groups with {name: group_definition}
entries:
|
Group defined as collection of subjects |
|
Group defined by removing subjects from a base group |
Example:
groups = {
'good': SubGroup('all', ['R0013', 'R0666']),
'bad': Group(['R0013', 'R0666']),
}
The current group is selected through the group state, and restricts group-level analysis to the group’s subjects.
Groups are used the same way in TRF analysis (e.g., the subjects argument of Pipeline.load_trfs() and the group state in Pipeline.load_model_test()).
To compare groups statistically, add a GroupVar to Pipeline.variables, and use it in a TTestIndependent or in an
ANOVA with subject nested in the group variable:
class MyExperiment(Pipeline):
groups = {
'patient': Group(['S001', 'S002']),
'control': Group(['S011', 'S012']),
}
variables = {
'diagnosis': GroupVar(['patient', 'control']),
}
tests = {
'patient=control': TTestIndependent('diagnosis', 'patient', 'control'),
}
Tests
- Pipeline.tests
Statistical tests are defined as {name: test_definition} dictionary.
This allows automatic caching of permutation test results when using Pipeline.load_test().
Tests are defined using the following classes:
|
One-sample t-test |
|
Related measures t-test |
|
Independent measures t-test (comparing groups of subjects) |
|
ANOVA test |
|
Contrasts of T-maps (see |
|
Two-stage test: T-test of regression coefficients |
Example:
tests = {
'my_anova': ANOVA('noise * word_type * subject'),
'my_ttest': TTestRelated('noise', 'a_lot_of_noise', 'no_noise'),
}
State parameters
group
Any group defined in Pipeline.groups. Will restrict the analysis
to that group of subjects.
equalize_evoked_count
By default, the analysis uses all epochs marked as good during rejection.
Set equalize_evoked_count='eq' to discard trials to make sure the same number of epochs goes into each cell of the model (see equal_count parameter to Dataset.aggregate()).
- ‘’ (default)
Use all epochs.
- ‘eq’
Make sure the same number of epochs
nis used in each cell by discarding epochs. The firstnepochs are used for each condition (assuming that habituation increases by condition).