difference(y, x, c1, c0, match, sub=None, ds=None, by=None)¶
Subtract data in one cell from another
y (Var | NDVar) – Dependent variable.
x (categorial) – Model for subtraction, providing categories to compute
c1 - c0.
c1 (str | tuple) – Name of the cell in
xthat forms the minuend.
c0 (str | tuple) – Name of the cell in
xthat is to be subtracted from
match (categorial) – Units over which measurements were repeated.
c1 - c0will be calculated separately for each level of
"subject % condition").
sub (None | index) – Only include a subset of the data.
ds (Dataset) – If a Dataset is specified other arguments can be str instead of data-objects and will be retrieved from
diff – Dataset with the difference between
- Return type
ERP difference wave: assuming a dataset
dswith EEG data (
ds['eeg']), a variable named
'unexpected', and multiple subjects, the following will generate the
unexpected - expecteddifference waves:
>>> diff = table.difference('eeg', 'condition', 'unexpected', 'expected', ... 'subject', ds=ds)
dsalso contains a different factor crossed with
'adjective', then separate difference waves for verbs and adjectives can be computed with:
>>> diff = table.difference('eeg', 'condition', 'unexpected', 'expected', ... 'subject % word', ds=ds)
Given the latter, the difference of the difference waves could be computed with:
>>> diffdiff = table.difference('eeg', 'word', 'verb', 'adjective', ... 'subject', ds=diff)