eelbrain.Celltable

class eelbrain.Celltable(y, x=None, match=None, sub=None, cat=None, ds=None, coercion=<function asdataobject>, dtype=None)

Divide y into cells defined by x.

Parameters:
y : data-object

dependent measurement

x : categorial

Model (Factor or Interaction) for dividing y.

match : categorial

Factor on which cases are matched (i.e. subject for a repeated measures comparisons). If several data points with the same case fall into one cell of x, they are combined using match_func. If match is not None, Celltable.groups contains the {Xcell -> [match values of data points], …} mapping corres- ponding to self.data

sub : bool array

Bool array of length N specifying which cases to include

cat : None | sequence of cells of x

Only retain data for these cells. Data will be sorted in the order of cells occuring in cat.

ds : Dataset

If a Dataset is specified, input items (y / x / match / sub) can be str instead of data-objects, in which case they will be retrieved from the Dataset.

coercion : callable

Function to convert the y parameter to to the dependent varaible (default: asdataobject).

Examples

Split a repeated-measure variable y into cells defined by the interaction of A and B:

>>> c = Celltable(y, A % B, match=subject)
Attributes:
y : data-object

y after evaluating input parameters.

x : categorial

x after evaluating input parameters.

match : categorial | None

match after evaluating input parameters.

sub : bool array | None

sub after evaluating input parameters.

cells : list of (str | tuple)

List of all cells in x.

data : dict(cell -> data)

Data (y[index]) in each cell.

data_indexes : dict(cell -> index-array)

For each cell, a boolean-array specifying the index for that cell in x.

**If ``match`` is specified:**
within : dict(cell1, cell2 -> bool)

Dictionary that specifies for each cell pair whether the corresponding comparison is a repeated-measures or an independent measures comparison (only available when the input argument match is specified.

all_within : bool

Whether all comparison are repeated-measures comparisons or not.

groups : dict(cell -> group)

A slice of the match argument describing the group members for each cell.

Methods

cellname(self, cell[, delim]) Produce a str label for a cell.
cellnames(self[, delim]) Return a list of all cell names as strings.
data_for_cell(self, cell) Retrieve data for a cell, allowing advanced cell combinations
get_data(self[, out])
get_statistic(self[, func]) Return a list with a * func(data) for each data cell.
get_statistic_dict(self[, func]) Return a {cell: func(data)} dictionary.
variability(self[, error, pool]) Variability measure