eelbrain.Var.split

Var.split(self, n=2, name=None)

A Factor splitting y into n categories with equal number of cases

Parameters:
n : int

number of categories

name : str

Name of the output Var (default is current name).

Examples

Use n = 2 for a median split:

>>> y = Var([1,2,3,4])
>>> y.split(2)
Factor(['0', '0', '1', '1'])

>>> z = Var([7, 6, 5, 4, 3, 2])
>>> z.split(3)
Factor(['2', '2', '1', '1', '0', '0'])