som

som(treat_sizes, *, method='scomars', n_units=None, control=False, marginal_treat=None, rng=None)[source]

Generate a selection order matrix (SOM).

Parameters:
  • treat_sizes (list[int] | tuple[int, ...]) – Size of each treatment group. With control=True the first entry is the control group.

  • method (Literal['scomars', 'global_percentage', 'randomized_chunk']) – "scomars" (two groups only), "global_percentage" or "randomized_chunk".

  • n_units (int | None) – Total number of units. When it exceeds sum(treat_sizes) the remainder forms an extra “discard” group that also takes turns, labelled after the treatment groups.

  • control (bool) – Label groups 0, 1, …, g-1 instead of 1, 2, …, g.

  • marginal_treat (ndarray | None) – SCOMARS only. Marginal probability that the second group chooses at each stage; defaults to its share of units.

  • rng (Generator | None) – Random generator.

Returns:

The selection order.

Raises:

ValueError – If the sizes or method are inconsistent.

Return type:

SelectionOrder