eelbrain.Dataset.equalize_counts

Dataset.equalize_counts(x, n=None)

Create a copy of the Dataset with equal counts in each cell of x

Parameters
  • x (categorial) – Model which defines the cells in which to equalize the counts.

  • n (int) – Number of cases per cell (the default is the maximum possible, i.e. the number of cases in the cell with the least number of cases). Negative numbers to subtract from maximum possible.

Returns

equalized_ds – Dataset with equal number of cases in each cell of x.

Return type

Dataset

Notes

First, the cell with the smallest number of rows is determined (empty cells are ignored). Then, for each cell, rows beyond that number are dropped.