eelbrain.Dataset.equalize_counts

Dataset.equalize_counts(self, 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

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

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.