eelbrain.Celltable

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

Divide y into cells defined by x.

Parameters:
  • y (Var | NDVar | str) – dependent measurement

  • x (Factor | Interaction | NestedEffect | str) – Model (Factor or Interaction) for dividing y.

  • match (Factor | Interaction | NestedEffect | str) – 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 (Var | ndarray | str) – Bool array of length N specifying which cases to include

  • cat (Sequence[str | Tuple[str, ...]]) – Only retain data for these cells. Data will be sorted in the order of cells occuring in cat.

  • data (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).

  • dtype (dtype) – If specified, y will be converted to this type.

Examples

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

>>> c = Celltable(y, A % B, match=subject)
Variables:
  • 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 ({cell: data}) – Data (y[index]) in each cell.

  • data_indexes ({cell: index-array}) – For each cell, a boolean-array specifying the index for that cell in x.

  • specified** (**If match is)

  • 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.

Parameters:

Methods

cellname(cell[, delim])

Produce a str label for a cell.

cellnames([delim])

Return a list of all cell names as strings.

data_for_cell(cell)

Retrieve data for a cell, allowing advanced cell combinations

get_data([out])

get_statistic([func])

Return a list with a * func(data) for each data cell.

get_statistic_dict([func])

Return a {cell: func(data)} dictionary.

variability([error, within_subject, cell, ...])

Variability measure