ri()

Contents

ri()#

liesel_ptm.ri(x, xname=None)[source]#

Create a random-intercept basis from grouping labels.

The returned Basis maps arbitrary group labels (strings or integers) to contiguous integer indices suitable for indexing group coefficients. The produced basis yields, for each observation, the integer group index which can be used by term_ri to select the corresponding group effect.

Parameters:
  • x (Union[Array, ndarray, bool, number, bool, int, float, complex, Series, Var]) – Grouping labels for each observation. If x is not an liesel.model.Var, a named observation variable will be created using xname.

  • xname (str | None) – Name for the created observation variable when x is not already an liesel.model.Var. (default: None)

Return type:

Basis

Returns:

  • A Basis whose evaluation yields integer group indices for

  • each observation.