fsm

fsm(x, order, *, s_function='dopt', q_initial=None, eps=0.001, ties='random', intercept=True, standardize=True, pol_mat=None, w_pol=None, keep_criteria=False, rng=None)[source]

Allocate units to groups with the Finite Selection Model.

Parameters:
  • x (ndarray) – Covariates, one row per unit.

  • order (SelectionOrder | ndarray) – Selection order; order[i] is the group choosing at stage i. Must have one stage per unit.

  • s_function (Literal['constant', 'dopt', 'aopt', 'negative_dopt', 'max_pc', 'min_pc', 'dopt_pc', 'max_average', 'min_average', 'dopt_average', 'marginal_var_sum']) – Selection function. "dopt" (D-optimality) picks the unit that most increases the determinant of the choosing group’s information matrix.

  • q_initial (ndarray | None) – Matrix used in place of the full-sample X’X to ridge an ill-conditioned group information matrix.

  • eps (float) – Ridge scale; the ridge is eps * Q0 / N.

  • ties (Literal['random', 'smallest']) – Pick a random maximizer, or the earliest-listed one.

  • intercept (bool) – Include an intercept column in the design matrix.

  • standardize (bool) – Standardize covariates (sample SD) before selection.

  • pol_mat (ndarray | None) – Policy matrix for "aopt"; one column per design column.

  • w_pol (ndarray | None) – Policy weights for "aopt".

  • keep_criteria (bool) – Also return the stage-by-unit criterion matrix.

  • rng (Generator | None) – Random generator for tie-breaking.

Returns:

The allocation.

Raises:

ValueError – If the order does not have one stage per unit, or the covariates are collinear and no q_initial is given.

Return type:

FSMResult