eelbrain.table.difference
- eelbrain.table.difference(y, x, c1, c0, match, sub=None, data=None)
Subtract data in one cell from another
- Parameters:
y (NDVar | Var | str | Sequence[NDVar | Var | str]) – One or several variables for which to calculate the difference.
x (Factor | Interaction | NestedEffect | str) – Model for subtraction, providing categories to compute
c1 - c0.c1 (str | tuple[str, ...]) – Name of the cell in
xthat forms the minuend.c0 (str | tuple[str, ...]) – Name of the cell in
xthat is to be subtracted fromc1.match (Factor | Interaction | NestedEffect | str) – Units over which measurements were repeated.
c1 - c0will be calculated separately for each level ofmatch(e.g."subject", or"subject % condition").sub (Var | ndarray | str) – Only include a subset of the data.
data (Dataset) – If a Dataset is specified other arguments can be str instead of data-objects and will be retrieved from
data.
- Returns:
Dataset with the difference between
c1andc0ony.- Return type:
diff
Examples
ERP difference wave: assuming a dataset
datawith EEG data (data['eeg']), a variable named'condition'with levels'expected'and'unexpected', and multiple subjects, the following will generate theunexpected - expecteddifference waves:>>> diff = table.difference('eeg', 'condition', 'unexpected', 'expected', ... 'subject', data=data)
If
dataalso contains a different factor crossed withcondition, called'word'with levels'verb'abd'adjective', then separate difference waves for verbs and adjectives can be computed with:>>> diff = table.difference('eeg', 'condition', 'unexpected', 'expected', ... 'subject % word', data=data)
Given the latter, the difference of the difference waves could be computed with:
>>> diffdiff = table.difference('eeg', 'word', 'verb', 'adjective', ... 'subject', data=diff)