eelbrain.table.frequencies(y, x=None, of=None, sub=None, ds=None)

Calculate frequency of occurrence of the categories in y

y : univariate

Values whose frequencies are of interest.

x : categorial

Optional model defining cells for which frequencies are displayed separately.

of : categorial

With x constant within of, only count frequencies for each value in of once. (Compress y and x before calculating frequencies.)

sub : index

Only use a subset of the data.

ds : Dataset

If ds is specified, other parameters can be strings naming for variables in ds.

freq : Dataset

Dataset with frequencies.


A simple sample dataset:

>>> ds = Dataset()
>>> ds['a'] = Factor('aabbcc')
>>> ds['x'] = Factor('xxxyyy')

Display frequency of a single factor’s cells:

>>> print(table.frequencies('a', ds=ds))
cell   n
a      2
b      2
c      2

Display frequency of interaction cells:

>>> print(table.frequencies('a', 'x', ds=ds))
x   a   b   c
x   2   1   0
y   0   1   2