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 byterm_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. Ifx
is not anliesel.model.Var
, a named observation variable will be created usingxname
.xname (
str
|None
) – Name for the created observation variable whenx
is not already anliesel.model.Var
. (default:None
)
- Return type:
Basis
- Returns:
A
Basis
whose evaluation yields integer group indices foreach observation.